dbSchema/model/ddl_2_component.sql

44 lines
1.6 KiB
SQL

-- Table: public.component
-- DROP
DROP TABLE IF EXISTS public.component;
DROP SEQUENCE IF EXISTS public.component_id_seq;
-- CREATE
CREATE SEQUENCE IF NOT EXISTS public.component_id_seq;
CREATE TABLE IF NOT EXISTS public.component
(
id integer NOT NULL DEFAULT nextval('component_id_seq'::regclass),
global_uuid uuid NOT NULL DEFAULT gen_random_uuid(),
nspath character varying(32) COLLATE pg_catalog."default",
tag character varying(32) COLLATE pg_catalog."default" NOT NULL,
name character varying(64) COLLATE pg_catalog."default" NOT NULL,
model_name character varying(64) COLLATE pg_catalog."default" NOT NULL,
description character varying(512) COLLATE pg_catalog."default" NOT NULL DEFAULT ''::character varying,
grid character varying(64) COLLATE pg_catalog."default" NOT NULL,
zone character varying(64) COLLATE pg_catalog."default" NOT NULL,
station character varying(64) COLLATE pg_catalog."default" NOT NULL,
type integer NOT NULL,
in_service boolean DEFAULT false,
state integer NOT NULL DEFAULT 0,
status integer NOT NULL DEFAULT '-1'::integer, -- 编辑是否完成
connection jsonb NOT NULL DEFAULT '{}'::jsonb,
label jsonb NOT NULL DEFAULT '{}'::jsonb,
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)
)
TABLESPACE pg_default;
ALTER TABLE IF EXISTS public.component
OWNER to postgres;
COMMENT ON TABLE public.component
IS '存储电网元件的基本信息';