50 lines
1.5 KiB
MySQL
50 lines
1.5 KiB
MySQL
|
-- Table: api.vods_vtuber_links
|
||
|
|
||
|
-- DROP TABLE IF EXISTS api.vods_vtuber_links;
|
||
|
|
||
|
CREATE TABLE IF NOT EXISTS api.vods_vtuber_links
|
||
|
(
|
||
|
id integer NOT NULL,
|
||
|
vod_id integer,
|
||
|
vtuber_id integer,
|
||
|
vod_order double precision,
|
||
|
CONSTRAINT vods_vtuber_links_pkey PRIMARY KEY (id),
|
||
|
CONSTRAINT vods_vtuber_links_unique UNIQUE (vod_id, vtuber_id),
|
||
|
CONSTRAINT vods_vtuber_links_fk FOREIGN KEY (vod_id)
|
||
|
REFERENCES api.vods (id) MATCH SIMPLE
|
||
|
ON UPDATE NO ACTION
|
||
|
ON DELETE CASCADE,
|
||
|
CONSTRAINT vods_vtuber_links_inv_fk FOREIGN KEY (vtuber_id)
|
||
|
REFERENCES api.vtubers (id) MATCH SIMPLE
|
||
|
ON UPDATE NO ACTION
|
||
|
ON DELETE CASCADE
|
||
|
)
|
||
|
|
||
|
TABLESPACE pg_default;
|
||
|
|
||
|
ALTER TABLE IF EXISTS api.vods_vtuber_links
|
||
|
OWNER to postgres;
|
||
|
-- Index: vods_vtuber_links_fk
|
||
|
|
||
|
-- DROP INDEX IF EXISTS api.vods_vtuber_links_fk;
|
||
|
|
||
|
CREATE INDEX IF NOT EXISTS vods_vtuber_links_fk
|
||
|
ON api.vods_vtuber_links USING btree
|
||
|
(vod_id ASC NULLS LAST)
|
||
|
TABLESPACE pg_default;
|
||
|
-- Index: vods_vtuber_links_inv_fk
|
||
|
|
||
|
-- DROP INDEX IF EXISTS api.vods_vtuber_links_inv_fk;
|
||
|
|
||
|
CREATE INDEX IF NOT EXISTS vods_vtuber_links_inv_fk
|
||
|
ON api.vods_vtuber_links USING btree
|
||
|
(vtuber_id ASC NULLS LAST)
|
||
|
TABLESPACE pg_default;
|
||
|
-- Index: vods_vtuber_links_order_inv_fk
|
||
|
|
||
|
-- DROP INDEX IF EXISTS api.vods_vtuber_links_order_inv_fk;
|
||
|
|
||
|
CREATE INDEX IF NOT EXISTS vods_vtuber_links_order_inv_fk
|
||
|
ON api.vods_vtuber_links USING btree
|
||
|
(vod_order ASC NULLS LAST)
|
||
|
TABLESPACE pg_default;
|