From dd3c6ebca592231917656c25c7ecdbf7084befd5 Mon Sep 17 00:00:00 2001 From: zhuxu Date: Thu, 22 May 2025 15:38:34 +0800 Subject: [PATCH] add and update --- model/{ddl_bay.sql => ddl_0_bay.sql} | 0 model/ddl_0_component_type.sql | 9 +++++++++ model/ddl_0_measurement.sql | 10 ++++++++++ model/ddl_2_component.sql | 6 +----- model/ddl_3_topologic.sql | 6 +----- 5 files changed, 21 insertions(+), 10 deletions(-) rename model/{ddl_bay.sql => ddl_0_bay.sql} (100%) create mode 100644 model/ddl_0_component_type.sql create mode 100644 model/ddl_0_measurement.sql diff --git a/model/ddl_bay.sql b/model/ddl_0_bay.sql similarity index 100% rename from model/ddl_bay.sql rename to model/ddl_0_bay.sql diff --git a/model/ddl_0_component_type.sql b/model/ddl_0_component_type.sql new file mode 100644 index 0000000..f5fbcb0 --- /dev/null +++ b/model/ddl_0_component_type.sql @@ -0,0 +1,9 @@ +-- standard component type + +DROP TABLE IF EXISTS COMPONENT_TYPE; + +CREATE TABLE COMPONENT_TYPE ( + ID SERIAL PRIMARY KEY, + TYPE VARCHAR(64) NOT NULL DEFAULT '', + NAME VARCHAR(64) NOT NULL DEFAULT '' +); \ No newline at end of file diff --git a/model/ddl_0_measurement.sql b/model/ddl_0_measurement.sql new file mode 100644 index 0000000..8b4de21 --- /dev/null +++ b/model/ddl_0_measurement.sql @@ -0,0 +1,10 @@ +-- measurement of bay + +DROP TABLE IF EXISTS MEASUREMENT; + +CREATE TABLE MEASUREMENT ( + ID SERIAL PRIMARY KEY, + TAG VARCHAR(64) NOT NULL DEFAULT '', + NAME VARCHAR(64) NOT NULL DEFAULT '', + BAY_ID INTEGER NOT NULL DEFAULT -1 +); \ No newline at end of file diff --git a/model/ddl_2_component.sql b/model/ddl_2_component.sql index 7c90e9c..e97a710 100644 --- a/model/ddl_2_component.sql +++ b/model/ddl_2_component.sql @@ -29,11 +29,7 @@ CREATE TABLE IF NOT EXISTS public.component context jsonb NOT NULL DEFAULT '{}'::jsonb, op integer NOT NULL DEFAULT '-1'::integer, ts timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP, - CONSTRAINT component_id_PrimaryKey PRIMARY KEY (id), - CONSTRAINT component_ForeignKey_page_id FOREIGN KEY (page_id) - REFERENCES public.page (id) MATCH SIMPLE - ON UPDATE NO ACTION - ON DELETE NO ACTION + CONSTRAINT component_id_PrimaryKey PRIMARY KEY (id) ) TABLESPACE pg_default; diff --git a/model/ddl_3_topologic.sql b/model/ddl_3_topologic.sql index 7eb4338..036ff5e 100644 --- a/model/ddl_3_topologic.sql +++ b/model/ddl_3_topologic.sql @@ -16,11 +16,7 @@ CREATE TABLE IF NOT EXISTS public.topologic description character varying(512) COLLATE pg_catalog."default", op integer NOT NULL DEFAULT '-1'::integer, ts timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP, - CONSTRAINT topologic_id_PrimaryKey PRIMARY KEY (id), - CONSTRAINT topologic_ForeignKey_page_id FOREIGN KEY (page_id) - REFERENCES public.page (id) MATCH SIMPLE - ON UPDATE NO ACTION - ON DELETE NO ACTION + CONSTRAINT topologic_id_PrimaryKey PRIMARY KEY (id) ) TABLESPACE pg_default;