50 lines
1.5 KiB
SQL
50 lines
1.5 KiB
SQL
-- Table: api.vods_stream_links
|
|
|
|
-- DROP TABLE IF EXISTS api.vods_stream_links;
|
|
|
|
CREATE TABLE IF NOT EXISTS api.vods_stream_links
|
|
(
|
|
id integer NOT NULL,
|
|
vod_id integer,
|
|
stream_id integer,
|
|
vod_order double precision,
|
|
CONSTRAINT vods_stream_links_pkey PRIMARY KEY (id),
|
|
CONSTRAINT vods_stream_links_unique UNIQUE (vod_id, stream_id),
|
|
CONSTRAINT vods_stream_links_fk FOREIGN KEY (vod_id)
|
|
REFERENCES api.vods (id) MATCH SIMPLE
|
|
ON UPDATE NO ACTION
|
|
ON DELETE CASCADE,
|
|
CONSTRAINT vods_stream_links_inv_fk FOREIGN KEY (stream_id)
|
|
REFERENCES api.streams (id) MATCH SIMPLE
|
|
ON UPDATE NO ACTION
|
|
ON DELETE CASCADE
|
|
)
|
|
|
|
TABLESPACE pg_default;
|
|
|
|
ALTER TABLE IF EXISTS api.vods_stream_links
|
|
OWNER to postgres;
|
|
-- Index: vods_stream_links_fk
|
|
|
|
-- DROP INDEX IF EXISTS api.vods_stream_links_fk;
|
|
|
|
CREATE INDEX IF NOT EXISTS vods_stream_links_fk
|
|
ON api.vods_stream_links USING btree
|
|
(vod_id ASC NULLS LAST)
|
|
TABLESPACE pg_default;
|
|
-- Index: vods_stream_links_inv_fk
|
|
|
|
-- DROP INDEX IF EXISTS api.vods_stream_links_inv_fk;
|
|
|
|
CREATE INDEX IF NOT EXISTS vods_stream_links_inv_fk
|
|
ON api.vods_stream_links USING btree
|
|
(stream_id ASC NULLS LAST)
|
|
TABLESPACE pg_default;
|
|
-- Index: vods_stream_links_order_inv_fk
|
|
|
|
-- DROP INDEX IF EXISTS api.vods_stream_links_order_inv_fk;
|
|
|
|
CREATE INDEX IF NOT EXISTS vods_stream_links_order_inv_fk
|
|
ON api.vods_stream_links USING btree
|
|
(vod_order ASC NULLS LAST)
|
|
TABLESPACE pg_default; |