-- TABLE project
CREATE TABLE IF NOT EXISTS public.project (
    id integer NOT NULL CONSTRAINT project_id_pk PRIMARY KEY,
    project_name character varying,
    soil_texture character varying,
    irrigation character varying,
    created_at character varying,
    updated_at character varying,
    created_by character varying,
    updated_by character varying,
    geom public.geometry
);

CREATE SEQUENCE IF NOT EXISTS public.project_id_seq
    START WITH 1
    INCREMENT BY 1
    MINVALUE 1
    MAXVALUE 10000000000
    CACHE 1;

ALTER TABLE ONLY public.project ALTER COLUMN id SET DEFAULT nextval('public.project_id_seq'::regclass);

GRANT ALL PRIVILEGES ON project TO PUBLIC;

-- TABLE project_elements

CREATE TABLE IF NOT EXISTS public.project_elements (
    id integer NOT NULL CONSTRAINT project_elements_id_pk PRIMARY KEY,
    id_project integer,
    geom_type character varying,
    details character varying,
    created_at character varying,
    updated_at character varying,
    created_by character varying,
    updated_by character varying,
    geom public.geometry
);

CREATE SEQUENCE IF NOT EXISTS public.project_elements_id_seq
    START WITH 1
    INCREMENT BY 1
    MINVALUE 1
    MAXVALUE 10000000000
    CACHE 1;

ALTER TABLE ONLY public.project_elements ALTER COLUMN id SET DEFAULT nextval('public.project_elements_id_seq'::regclass);

GRANT ALL PRIVILEGES ON project_elements TO PUBLIC;
