-- Table: public.empresas

-- DROP TABLE IF EXISTS public.empresas;

-- SEQUENCE: public.empresas_id_seq

-- DROP SEQUENCE IF EXISTS public.empresas_id_seq;

CREATE SEQUENCE IF NOT EXISTS public.empresas_id_seq
    INCREMENT 1
    START 1
    MINVALUE 1
    MAXVALUE 2147483647
    CACHE 1;


CREATE TABLE IF NOT EXISTS public.empresas
(
    id integer NOT NULL DEFAULT nextval('empresas_id_seq'::regclass),
    nom_empresa character varying(200) COLLATE pg_catalog."default" NOT NULL,
    direccion_empresa character varying(300) COLLATE pg_catalog."default" NOT NULL,
    usuario_registro bigint,
    fecha_registro timestamp without time zone,
    usuario_modifica bigint,
    fecha_modifica timestamp without time zone,
    CONSTRAINT empresas_pkey PRIMARY KEY (id),
    CONSTRAINT fk_usuario_modifica FOREIGN KEY (usuario_modifica)
        REFERENCES public.usuarios (id) MATCH SIMPLE
        ON UPDATE NO ACTION
        ON DELETE NO ACTION
        NOT VALID,
    CONSTRAINT fk_usuario_registro FOREIGN KEY (usuario_registro)
        REFERENCES public.usuarios (id) MATCH SIMPLE
        ON UPDATE NO ACTION
        ON DELETE NO ACTION
        NOT VALID
)

TABLESPACE pg_default;

ALTER SEQUENCE public.empresas_id_seq
    OWNED BY public.empresas.id;
