87 lines
2.3 KiB
PL/PgSQL
87 lines
2.3 KiB
PL/PgSQL
-- This script was generated by a beta version of the ERD tool in pgAdmin 4.
|
|
-- Please log an issue at https://redmine.postgresql.org/projects/pgadmin4/issues/new if you find any bugs, including reproduction steps.
|
|
BEGIN;
|
|
|
|
CREATE SEQUENCE sq_dbrole;
|
|
CREATE SEQUENCE sq_dbtableaccess;
|
|
CREATE SEQUENCE sq_dbuser;
|
|
CREATE SEQUENCE sq_dbuserrole;
|
|
CREATE SEQUENCE sq_dbentity;
|
|
CREATE SEQUENCE sq_dbform;
|
|
CREATE SEQUENCE sq_dbformfields;
|
|
|
|
CREATE TABLE IF NOT EXISTS public.dbrole
|
|
(
|
|
id integer NOT NULL DEFAULT nextval('sq_dbrole'),
|
|
name character varying(255),
|
|
description text,
|
|
PRIMARY KEY (id)
|
|
);
|
|
|
|
CREATE TABLE IF NOT EXISTS public.dbtableaccess
|
|
(
|
|
id integer NOT NULL DEFAULT nextval('sq_dbtableaccess'),
|
|
tableaccess character varying(255),
|
|
dbrole_id integer,
|
|
userrolerestrictions character varying(255),
|
|
PRIMARY KEY (id)
|
|
);
|
|
|
|
CREATE TABLE IF NOT EXISTS public.dbuser
|
|
(
|
|
id integer NOT NULL DEFAULT nextval('sq_dbuser'),
|
|
login character varying(255) UNIQUE,
|
|
password character varying(255),
|
|
PRIMARY KEY (id)
|
|
);
|
|
|
|
CREATE TABLE IF NOT EXISTS public.dbuserrole
|
|
(
|
|
id integer NOT NULL DEFAULT nextval('sq_dbuserrole'),
|
|
dbuser_id integer,
|
|
dbentity_id integer,
|
|
dbrole_id integer,
|
|
startdate timestamp without time zone,
|
|
enddate timestamp without time zone,
|
|
PRIMARY KEY (id)
|
|
);
|
|
|
|
CREATE TABLE IF NOT EXISTS public.dbentity
|
|
(
|
|
id integer NOT NULL DEFAULT nextval('sq_dbentity'),
|
|
type character varying(255),
|
|
parent_id bigint,
|
|
description text,
|
|
PRIMARY KEY (id)
|
|
);
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS public.dbform
|
|
(
|
|
id integer NOT NULL DEFAULT nextval('sq_dbform'),
|
|
tablename character varying(255),
|
|
formname character varying(255),
|
|
title character varying(255),
|
|
header character varying(2000),
|
|
PRIMARY KEY (id)
|
|
);
|
|
|
|
CREATE TABLE IF NOT EXISTS public.dbformfields
|
|
(
|
|
id integer NOT NULL DEFAULT nextval('sq_dbformfields'),
|
|
form_id integer,
|
|
columnname character varying(255),
|
|
columnorder integer,
|
|
fieldtype character varying(255),
|
|
label character varying(255),
|
|
placeholder character varying(255),
|
|
defaultvalue character varying(255),
|
|
linkcolumns character varying(255),
|
|
linkrestriction character varying(255),
|
|
linkorder character varying(255),
|
|
required bool,
|
|
description text,
|
|
PRIMARY KEY (id)
|
|
);
|
|
|
|
END; |