forked from MarseyWorld/MarseyWorld
28 lines
781 B
SQL
28 lines
781 B
SQL
create table media_usages (
|
|
id integer primary key,
|
|
filename character varying(55) NOT NULL,
|
|
post_id integer,
|
|
comment_id integer,
|
|
created_utc integer not null,
|
|
deleted_utc integer,
|
|
removed_utc integer
|
|
);
|
|
|
|
CREATE SEQUENCE public.media_usages_id_seq
|
|
AS integer
|
|
START WITH 1
|
|
INCREMENT BY 1
|
|
NO MINVALUE
|
|
NO MAXVALUE
|
|
CACHE 1;
|
|
|
|
ALTER SEQUENCE public.media_usages_id_seq OWNED BY public.media_usages.id;
|
|
|
|
ALTER TABLE ONLY public.media_usages ALTER COLUMN id SET DEFAULT nextval('public.media_usages_id_seq'::regclass);
|
|
|
|
|
|
alter table media_usages
|
|
add constraint media_usages_post_fkey foreign key (post_id) references posts(id);
|
|
|
|
alter table media_usages
|
|
add constraint media_usages_comment_fkey foreign key (comment_id) references comments(id); |