Add create_table_public.document_authors.sql

This commit is contained in:
pashko 2025-02-14 16:41:56 +08:00
parent 760303a9b9
commit a5ed859cb6

View File

@ -0,0 +1,24 @@
-- Table: public.document_authors
-- DROP TABLE IF EXISTS public.document_authors;
CREATE TABLE IF NOT EXISTS public.document_authors
(
doc_id integer NOT NULL,
author_id integer NOT NULL,
CONSTRAINT document_authors_pkey PRIMARY KEY (doc_id, author_id),
CONSTRAINT document_authors_author_id_fkey FOREIGN KEY (author_id)
REFERENCES public.authors (author_id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION,
CONSTRAINT document_authors_doc_id_fkey FOREIGN KEY (doc_id)
REFERENCES public.documents (doc_id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
)
TABLESPACE pg_default;
ALTER TABLE IF EXISTS public.document_authors
OWNER to dbuser01;