fp/services/migrations-schema/migrations/00120_create-vods_mux_asset...

41 lines
1.2 KiB
SQL

-- Table: api.vods_mux_asset_links
-- DROP TABLE IF EXISTS api.vods_mux_asset_links;
CREATE TABLE IF NOT EXISTS api.vods_mux_asset_links
(
id integer NOT NULL,
vod_id integer,
mux_asset_id integer,
CONSTRAINT vods_mux_asset_links_pkey PRIMARY KEY (id),
CONSTRAINT vods_mux_asset_links_unique UNIQUE (vod_id, mux_asset_id),
CONSTRAINT vods_mux_asset_links_fk FOREIGN KEY (vod_id)
REFERENCES api.vods (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE CASCADE,
CONSTRAINT vods_mux_asset_links_inv_fk FOREIGN KEY (mux_asset_id)
REFERENCES api.mux_assets (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE CASCADE
)
TABLESPACE pg_default;
ALTER TABLE IF EXISTS api.vods_mux_asset_links
OWNER to postgres;
-- Index: vods_mux_asset_links_fk
-- DROP INDEX IF EXISTS api.vods_mux_asset_links_fk;
CREATE INDEX IF NOT EXISTS vods_mux_asset_links_fk
ON api.vods_mux_asset_links USING btree
(vod_id ASC NULLS LAST)
TABLESPACE pg_default;
-- Index: vods_mux_asset_links_inv_fk
-- DROP INDEX IF EXISTS api.vods_mux_asset_links_inv_fk;
CREATE INDEX IF NOT EXISTS vods_mux_asset_links_inv_fk
ON api.vods_mux_asset_links USING btree
(mux_asset_id ASC NULLS LAST)
TABLESPACE pg_default;