-- 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, 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, connected_bus jsonb NOT NULL DEFAULT '{}'::jsonb, label jsonb NOT NULL DEFAULT '{}'::jsonb, context jsonb NOT NULL DEFAULT '{}'::jsonb, page_id integer NOT NULL, 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 ) TABLESPACE pg_default; ALTER TABLE IF EXISTS public.component OWNER to postgres; COMMENT ON TABLE public.component IS '存储电网元件的基本信息';