fp/services/migrations-schema/migrations/00118_create-timestamps_vod...

50 lines
1.6 KiB
SQL

-- Table: api.timestamps_vod_links
-- DROP TABLE IF EXISTS api.timestamps_vod_links;
CREATE TABLE IF NOT EXISTS api.timestamps_vod_links
(
id integer NOT NULL,
timestamp_id integer,
vod_id integer,
timestamp_order double precision,
CONSTRAINT timestamps_vod_links_pkey PRIMARY KEY (id),
CONSTRAINT timestamps_vod_links_unique UNIQUE (timestamp_id, vod_id),
CONSTRAINT timestamps_vod_links_fk FOREIGN KEY (timestamp_id)
REFERENCES api.timestamps (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE CASCADE,
CONSTRAINT timestamps_vod_links_inv_fk FOREIGN KEY (vod_id)
REFERENCES api.vods (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE CASCADE
)
TABLESPACE pg_default;
ALTER TABLE IF EXISTS api.timestamps_vod_links
OWNER to postgres;
-- Index: timestamps_vod_links_fk
-- DROP INDEX IF EXISTS api.timestamps_vod_links_fk;
CREATE INDEX IF NOT EXISTS timestamps_vod_links_fk
ON api.timestamps_vod_links USING btree
(timestamp_id ASC NULLS LAST)
TABLESPACE pg_default;
-- Index: timestamps_vod_links_inv_fk
-- DROP INDEX IF EXISTS api.timestamps_vod_links_inv_fk;
CREATE INDEX IF NOT EXISTS timestamps_vod_links_inv_fk
ON api.timestamps_vod_links USING btree
(vod_id ASC NULLS LAST)
TABLESPACE pg_default;
-- Index: timestamps_vod_links_order_inv_fk
-- DROP INDEX IF EXISTS api.timestamps_vod_links_order_inv_fk;
CREATE INDEX IF NOT EXISTS timestamps_vod_links_order_inv_fk
ON api.timestamps_vod_links USING btree
(timestamp_order ASC NULLS LAST)
TABLESPACE pg_default;