-- Table: public.document_versions

-- DROP TABLE IF EXISTS public.document_versions;

CREATE TABLE IF NOT EXISTS public.document_versions
(
    version_id integer NOT NULL DEFAULT nextval('document_versions_version_id_seq'::regclass),
    doc_id integer,
    content text COLLATE pg_catalog."default" NOT NULL,
    version_number integer NOT NULL,
    updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    CONSTRAINT document_versions_pkey PRIMARY KEY (version_id),
    CONSTRAINT document_versions_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_versions
    OWNER to dbuser01;