Commit 24de05c0 authored by 吴文龙's avatar 吴文龙

up

parent 2bd8fe55
/*
Navicat Premium Data Transfer
Source Server : 47.99.83.75(v3生产)
Source Server Type : PostgreSQL
Source Server Version : 120009
Source Host : 47.99.83.75:30433
Source Catalog : hsiotdb
Source Schema : public
Target Server Type : PostgreSQL
Target Server Version : 120009
File Encoding : 65001
Date: 28/11/2022 22:08:25
*/
-- ----------------------------
-- Table structure for tcode_base
-- ----------------------------
DROP TABLE IF EXISTS "tcode_base";
CREATE TABLE "tcode_base" (
"id" uuid NOT NULL,
"item" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"code" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"val" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"def" varchar(255) COLLATE "pg_catalog"."default",
"descript" varchar(255) COLLATE "pg_catalog"."default",
"sort" varchar(255) COLLATE "pg_catalog"."default",
"halt" varchar(255) COLLATE "pg_catalog"."default",
"created_user" uuid,
"updated_user" uuid,
"tenant_id" uuid NOT NULL,
"created_time" int8 DEFAULT 0,
"updated_time" int8 DEFAULT 0
)
;
COMMENT ON COLUMN "tcode_base"."item" IS '项目';
COMMENT ON COLUMN "tcode_base"."code" IS '代码';
COMMENT ON COLUMN "tcode_base"."val" IS '参数值';
COMMENT ON COLUMN "tcode_base"."def" IS '默认值';
COMMENT ON COLUMN "tcode_base"."descript" IS '描述';
COMMENT ON COLUMN "tcode_base"."halt" IS '是否停用(T-是;F-否)';
-- ----------------------------
-- Table structure for tcode_device
-- ----------------------------
DROP TABLE IF EXISTS "tcode_device";
CREATE TABLE "tcode_device" (
"id" uuid NOT NULL,
"gid" uuid,
"did" uuid NOT NULL,
"dname" varchar(255) COLLATE "pg_catalog"."default",
"knumb" int8,
"kcnt" int8,
"sort" varchar(255) COLLATE "pg_catalog"."default",
"halt" varchar(50) COLLATE "pg_catalog"."default",
"htime" timestamp(6),
"created_time" int8 DEFAULT 0,
"updated_time" int8 DEFAULT 0,
"created_user" uuid,
"updated_user" uuid,
"tenant_id" uuid NOT NULL,
"mcode" varchar(255) COLLATE "pg_catalog"."default" NOT NULL
)
;
COMMENT ON COLUMN "tcode_device"."id" IS '主键';
COMMENT ON COLUMN "tcode_device"."gid" IS '网关ID';
COMMENT ON COLUMN "tcode_device"."did" IS '设备ID';
COMMENT ON COLUMN "tcode_device"."dname" IS '设备名称';
COMMENT ON COLUMN "tcode_device"."knumb" IS '设备属性数量';
COMMENT ON COLUMN "tcode_device"."kcnt" IS '属性采集总量';
COMMENT ON COLUMN "tcode_device"."sort" IS '排序';
COMMENT ON COLUMN "tcode_device"."halt" IS '停用:默认F,T为停用';
COMMENT ON COLUMN "tcode_device"."htime" IS '心跳时间';
COMMENT ON COLUMN "tcode_device"."mcode" IS '物模型代码';
-- ----------------------------
-- Table structure for tcode_group
-- ----------------------------
DROP TABLE IF EXISTS "tcode_group";
CREATE TABLE "tcode_group" (
"tid" uuid NOT NULL,
"code" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"descript" varchar(255) COLLATE "pg_catalog"."default",
"arr" time(6),
"dep" time(6),
"tdays" int4 DEFAULT 0
)
;
COMMENT ON COLUMN "tcode_group"."tid" IS '租户ID';
COMMENT ON COLUMN "tcode_group"."code" IS '代码';
COMMENT ON COLUMN "tcode_group"."descript" IS '班组描述';
COMMENT ON COLUMN "tcode_group"."arr" IS '开始时间';
COMMENT ON COLUMN "tcode_group"."dep" IS '结束时间';
COMMENT ON COLUMN "tcode_group"."tdays" IS '是否跨日';
-- ----------------------------
-- Records of tcode_group
-- ----------------------------
-- ----------------------------
-- Table structure for tcode_group_days
-- ----------------------------
DROP TABLE IF EXISTS "tcode_group_days";
CREATE TABLE "tcode_group_days" (
"tid" uuid NOT NULL,
"arr" time(6),
"dep" time(6),
"tdays" int4 DEFAULT 0
)
;
COMMENT ON COLUMN "tcode_group_days"."tid" IS '租户ID';
COMMENT ON COLUMN "tcode_group_days"."arr" IS '每日开始时间';
COMMENT ON COLUMN "tcode_group_days"."dep" IS '每日结束时间';
COMMENT ON COLUMN "tcode_group_days"."tdays" IS '是否跨日';
-- ----------------------------
-- Records of tcode_group_days
-- ----------------------------
-- ----------------------------
-- Table structure for tcode_group_electric
-- ----------------------------
DROP TABLE IF EXISTS "tcode_group_electric";
CREATE TABLE "tcode_group_electric" (
"tid" uuid NOT NULL,
"code" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"arr" time(6),
"dep" time(6),
"tdays" int4
)
;
COMMENT ON COLUMN "tcode_group_electric"."tid" IS '租户ID';
COMMENT ON COLUMN "tcode_group_electric"."code" IS '峰电peak,谷电valley';
COMMENT ON COLUMN "tcode_group_electric"."arr" IS '开始时间';
COMMENT ON COLUMN "tcode_group_electric"."dep" IS '结束时间';
COMMENT ON COLUMN "tcode_group_electric"."tdays" IS '是否跨日,1为跨日';
-- ----------------------------
-- Records of tcode_group_electric
-- ----------------------------
-- ----------------------------
-- Table structure for tcode_model
-- ----------------------------
DROP TABLE IF EXISTS "tcode_model";
CREATE TABLE "tcode_model" (
"id" uuid NOT NULL,
"gid" uuid,
"code" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"name" varchar(255) COLLATE "pg_catalog"."default",
"created_user" uuid,
"updated_user" uuid,
"driver_version" varchar(255) COLLATE "pg_catalog"."default",
"tenant_id" uuid NOT NULL,
"updated_time" int8,
"created_time" int8
)
;
-- ----------------------------
-- Records of tcode_model
-- ----------------------------
-- ----------------------------
-- Table structure for tcode_model_detail
-- ----------------------------
DROP TABLE IF EXISTS "tcode_model_detail";
CREATE TABLE "tcode_model_detail" (
"id" uuid NOT NULL,
"gid" uuid,
"code" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"key" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"base_id" uuid,
"unit_id" uuid,
"kup" varchar(255) COLLATE "pg_catalog"."default",
"kdwn" varchar(255) COLLATE "pg_catalog"."default",
"ksetup" varchar(255) COLLATE "pg_catalog"."default",
"sort" varchar(255) COLLATE "pg_catalog"."default" DEFAULT '1000'::character varying,
"halt" char(1) COLLATE "pg_catalog"."default" DEFAULT 'F'::bpchar,
"ex_s1" varchar(255) COLLATE "pg_catalog"."default",
"ex_s2" varchar(255) COLLATE "pg_catalog"."default",
"ex_s3" varchar(255) COLLATE "pg_catalog"."default",
"ex_s4" varchar(255) COLLATE "pg_catalog"."default",
"ex_s5" varchar(255) COLLATE "pg_catalog"."default",
"created_user" uuid,
"updated_user" uuid,
"standard" varchar(255) COLLATE "pg_catalog"."default",
"hour" bool,
"day" bool,
"change" bool,
"tenant_id" uuid NOT NULL,
"val" varchar(255) COLLATE "pg_catalog"."default",
"created_time" int8,
"updated_time" int8,
"kup_time" int8,
"ksetup_time" int8,
"kdwn_time" int8
)
;
COMMENT ON COLUMN "tcode_model_detail"."id" IS '属性ID';
COMMENT ON COLUMN "tcode_model_detail"."gid" IS '网关ID';
COMMENT ON COLUMN "tcode_model_detail"."code" IS '模型代码';
COMMENT ON COLUMN "tcode_model_detail"."key" IS '属性key';
COMMENT ON COLUMN "tcode_model_detail"."base_id" IS '分组ID(base)';
COMMENT ON COLUMN "tcode_model_detail"."unit_id" IS '单位ID';
COMMENT ON COLUMN "tcode_model_detail"."kup" IS '上限值';
COMMENT ON COLUMN "tcode_model_detail"."kdwn" IS '下限值';
COMMENT ON COLUMN "tcode_model_detail"."ksetup" IS '设定值';
COMMENT ON COLUMN "tcode_model_detail"."sort" IS '排序';
COMMENT ON COLUMN "tcode_model_detail"."halt" IS '是否停用';
COMMENT ON COLUMN "tcode_model_detail"."ex_s1" IS '扩展字段1';
COMMENT ON COLUMN "tcode_model_detail"."ex_s2" IS '扩展字段2';
COMMENT ON COLUMN "tcode_model_detail"."ex_s3" IS '扩展字段3';
COMMENT ON COLUMN "tcode_model_detail"."ex_s4" IS '扩展字段4';
COMMENT ON COLUMN "tcode_model_detail"."ex_s5" IS '扩展字段5';
COMMENT ON COLUMN "tcode_model_detail"."standard" IS '标准值';
COMMENT ON COLUMN "tcode_model_detail"."hour" IS '每小时存储';
COMMENT ON COLUMN "tcode_model_detail"."day" IS '每天存储';
COMMENT ON COLUMN "tcode_model_detail"."change" IS '属性值变化存储';
COMMENT ON COLUMN "tcode_model_detail"."val" IS '属性名';
COMMENT ON COLUMN "tcode_model_detail"."kup_time" IS '上限值时间';
COMMENT ON COLUMN "tcode_model_detail"."ksetup_time" IS '设定值更新时间';
COMMENT ON COLUMN "tcode_model_detail"."kdwn_time" IS '下限值设定时间';
-- ----------------------------
-- Records of tcode_model_detail
-- ----------------------------
-- ----------------------------
-- Table structure for tcode_model_detail_ex
-- ----------------------------
DROP TABLE IF EXISTS "tcode_model_detail_ex";
CREATE TABLE "tcode_model_detail_ex" (
"tid" uuid NOT NULL,
"gid" uuid,
"code" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"key" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"grpcode" varchar(255) COLLATE "pg_catalog"."default",
"unit_id" varchar(255) COLLATE "pg_catalog"."default",
"kup" varchar(255) COLLATE "pg_catalog"."default",
"kup_time" timestamp(6),
"kdwn" varchar(255) COLLATE "pg_catalog"."default",
"kdwn_time" timestamp(6),
"ksetup" varchar(255) COLLATE "pg_catalog"."default",
"ksetup_time" timestamp(6),
"sort" varchar(255) COLLATE "pg_catalog"."default" DEFAULT '1000'::character varying,
"halt" char(1) COLLATE "pg_catalog"."default" DEFAULT 'F'::bpchar,
"ex_s1" varchar(255) COLLATE "pg_catalog"."default",
"ex_s2" varchar(255) COLLATE "pg_catalog"."default",
"ex_s3" varchar(255) COLLATE "pg_catalog"."default",
"ex_s4" varchar(255) COLLATE "pg_catalog"."default",
"ex_s5" varchar(255) COLLATE "pg_catalog"."default",
"ctime" timestamp(6) DEFAULT CURRENT_TIMESTAMP,
"mtime" timestamp(6) DEFAULT CURRENT_TIMESTAMP,
"name" varchar(255) COLLATE "pg_catalog"."default"
)
;
COMMENT ON COLUMN "tcode_model_detail_ex"."tid" IS '租户ID';
COMMENT ON COLUMN "tcode_model_detail_ex"."gid" IS '网关ID';
COMMENT ON COLUMN "tcode_model_detail_ex"."code" IS '模型代码';
COMMENT ON COLUMN "tcode_model_detail_ex"."key" IS '属性名称';
COMMENT ON COLUMN "tcode_model_detail_ex"."grpcode" IS '分组ID';
COMMENT ON COLUMN "tcode_model_detail_ex"."unit_id" IS '单位ID';
COMMENT ON COLUMN "tcode_model_detail_ex"."kup" IS '上限值';
COMMENT ON COLUMN "tcode_model_detail_ex"."kup_time" IS '上限值时间';
COMMENT ON COLUMN "tcode_model_detail_ex"."kdwn" IS '下限值';
COMMENT ON COLUMN "tcode_model_detail_ex"."kdwn_time" IS '下限值时间';
COMMENT ON COLUMN "tcode_model_detail_ex"."ksetup" IS '设定值';
COMMENT ON COLUMN "tcode_model_detail_ex"."ksetup_time" IS '设定值更新时间';
COMMENT ON COLUMN "tcode_model_detail_ex"."sort" IS '排序';
COMMENT ON COLUMN "tcode_model_detail_ex"."halt" IS '是否停用';
COMMENT ON COLUMN "tcode_model_detail_ex"."ex_s1" IS '扩展字段1';
COMMENT ON COLUMN "tcode_model_detail_ex"."ex_s2" IS '扩展字段2';
COMMENT ON COLUMN "tcode_model_detail_ex"."ex_s3" IS '扩展字段3';
COMMENT ON COLUMN "tcode_model_detail_ex"."ex_s4" IS '扩展字段4';
COMMENT ON COLUMN "tcode_model_detail_ex"."ex_s5" IS '扩展字段5';
COMMENT ON COLUMN "tcode_model_detail_ex"."ctime" IS '创建时间';
COMMENT ON COLUMN "tcode_model_detail_ex"."mtime" IS '修改时间';
COMMENT ON COLUMN "tcode_model_detail_ex"."name" IS '显示名称';
-- ----------------------------
-- Records of tcode_model_detail_ex
-- ----------------------------
-- ----------------------------
-- Table structure for tcode_model_ex
-- ----------------------------
DROP TABLE IF EXISTS "tcode_model_ex";
CREATE TABLE "tcode_model_ex" (
"tid" uuid NOT NULL,
"gid" uuid,
"code" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"name" varchar(255) COLLATE "pg_catalog"."default",
"ctime" timestamp(6) DEFAULT CURRENT_TIMESTAMP,
"mtime" timestamp(6) DEFAULT CURRENT_TIMESTAMP
)
;
-- ----------------------------
-- Records of tcode_model_ex
-- ----------------------------
BEGIN;
INSERT INTO "tcode_model_ex" ("tid", "gid", "code", "name", "ctime", "mtime") VALUES ('22eed190-39af-11ed-8d4e-1d9073a615c6', '0cf05930-3af5-11ed-b760-ad5b8cdcc58d', 'all', '所有模型', '2022-09-26 10:01:34.953943', '2022-09-26 10:01:34.953943');
COMMIT;
-- ----------------------------
-- Table structure for tcode_unit
-- ----------------------------
DROP TABLE IF EXISTS "tcode_unit";
CREATE TABLE "tcode_unit" (
"id" uuid NOT NULL,
"descript" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"created_user" uuid,
"updated_user" uuid,
"tenant_id" uuid NOT NULL,
"created_time" int8 DEFAULT 0,
"updated_time" int8 DEFAULT 0
)
;
-- ----------------------------
-- Records of tcode_unit
-- ----------------------------
-- ----------------------------
-- Table structure for trep_day_sta_detail
-- ----------------------------
DROP TABLE IF EXISTS "trep_day_sta_detail";
CREATE TABLE "trep_day_sta_detail" (
"tid" uuid NOT NULL,
"did" uuid NOT NULL,
"bdate" date NOT NULL,
"key" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"val" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"cron" int8 DEFAULT 20,
"len" int8,
"time" int8,
"ctime" timestamp(6),
"mtime" timestamp(6),
"created_time" int8,
"updated_time" int8
)
;
COMMENT ON COLUMN "trep_day_sta_detail"."tid" IS '租户ID';
COMMENT ON COLUMN "trep_day_sta_detail"."did" IS '设备ID';
COMMENT ON COLUMN "trep_day_sta_detail"."bdate" IS '营业日期';
COMMENT ON COLUMN "trep_day_sta_detail"."key" IS '属性名称';
COMMENT ON COLUMN "trep_day_sta_detail"."val" IS '属性值';
COMMENT ON COLUMN "trep_day_sta_detail"."cron" IS '更新频率';
COMMENT ON COLUMN "trep_day_sta_detail"."len" IS '计数器';
COMMENT ON COLUMN "trep_day_sta_detail"."time" IS '累计时间单位秒';
COMMENT ON COLUMN "trep_day_sta_detail"."ctime" IS '创建时间';
COMMENT ON COLUMN "trep_day_sta_detail"."mtime" IS '修改时间';
COMMENT ON COLUMN "trep_day_sta_detail"."created_time" IS '创建时间long类型';
COMMENT ON COLUMN "trep_day_sta_detail"."updated_time" IS '修改时间long类型';
-- ----------------------------
-- Records of trep_day_sta_detail
-- ----------------------------
-- ----------------------------
-- Table structure for trep_dkey_detail
-- ----------------------------
DROP TABLE IF EXISTS "trep_dkey_detail";
CREATE TABLE "trep_dkey_detail" (
"tid" uuid NOT NULL,
"did" uuid NOT NULL,
"key" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"bdate" date NOT NULL,
"val" varchar(255) COLLATE "pg_catalog"."default",
"ctime" timestamp(6),
"mtime" timestamp(6),
"val_arr" varchar(255) COLLATE "pg_catalog"."default",
"val_dep" varchar(255) COLLATE "pg_catalog"."default",
"peak" varchar(255) COLLATE "pg_catalog"."default",
"valley" varchar(255) COLLATE "pg_catalog"."default"
)
;
COMMENT ON COLUMN "trep_dkey_detail"."tid" IS '租户ID';
COMMENT ON COLUMN "trep_dkey_detail"."did" IS '设备ID';
COMMENT ON COLUMN "trep_dkey_detail"."key" IS '属性';
COMMENT ON COLUMN "trep_dkey_detail"."bdate" IS '营业日期';
COMMENT ON COLUMN "trep_dkey_detail"."val" IS '最新遥测值-废弃';
COMMENT ON COLUMN "trep_dkey_detail"."ctime" IS '创建时间';
COMMENT ON COLUMN "trep_dkey_detail"."mtime" IS '修改时间';
COMMENT ON COLUMN "trep_dkey_detail"."val_arr" IS '遥测值开始';
COMMENT ON COLUMN "trep_dkey_detail"."val_dep" IS '遥测值结束';
COMMENT ON COLUMN "trep_dkey_detail"."peak" IS '峰电-电能属性有效';
COMMENT ON COLUMN "trep_dkey_detail"."valley" IS '谷电-电能属性有效';
-- ----------------------------
-- Records of trep_dkey_detail
-- ----------------------------
-- ----------------------------
-- Table structure for trep_dkey_detail_bak221115
-- ----------------------------
DROP TABLE IF EXISTS "trep_dkey_detail_bak221115";
CREATE TABLE "trep_dkey_detail_bak221115" (
"tid" uuid,
"did" uuid,
"key" varchar(255) COLLATE "pg_catalog"."default",
"bdate" date,
"val" varchar(255) COLLATE "pg_catalog"."default",
"ctime" timestamp(6),
"mtime" timestamp(6),
"val_arr" varchar(255) COLLATE "pg_catalog"."default",
"val_dep" varchar(255) COLLATE "pg_catalog"."default",
"peak" varchar(255) COLLATE "pg_catalog"."default",
"valley" varchar(255) COLLATE "pg_catalog"."default"
)
;
-- ----------------------------
-- Records of trep_dkey_detail_bak221115
-- ----------------------------
-- ----------------------------
-- Table structure for trep_dkey_detail_copy1
-- ----------------------------
DROP TABLE IF EXISTS "trep_dkey_detail_copy1";
CREATE TABLE "trep_dkey_detail_copy1" (
"tid" uuid NOT NULL,
"did" uuid NOT NULL,
"key" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"bdate" date NOT NULL,
"val" varchar(255) COLLATE "pg_catalog"."default",
"ctime" timestamp(6),
"mtime" timestamp(6),
"val_arr" varchar(255) COLLATE "pg_catalog"."default",
"val_dep" varchar(255) COLLATE "pg_catalog"."default",
"peak" varchar(255) COLLATE "pg_catalog"."default",
"valley" varchar(255) COLLATE "pg_catalog"."default"
)
;
COMMENT ON COLUMN "trep_dkey_detail_copy1"."tid" IS '租户ID';
COMMENT ON COLUMN "trep_dkey_detail_copy1"."did" IS '设备ID';
COMMENT ON COLUMN "trep_dkey_detail_copy1"."key" IS '属性';
COMMENT ON COLUMN "trep_dkey_detail_copy1"."bdate" IS '营业日期';
COMMENT ON COLUMN "trep_dkey_detail_copy1"."val" IS '最新遥测值-废弃';
COMMENT ON COLUMN "trep_dkey_detail_copy1"."ctime" IS '创建时间';
COMMENT ON COLUMN "trep_dkey_detail_copy1"."mtime" IS '修改时间';
COMMENT ON COLUMN "trep_dkey_detail_copy1"."val_arr" IS '遥测值开始';
COMMENT ON COLUMN "trep_dkey_detail_copy1"."val_dep" IS '遥测值结束';
COMMENT ON COLUMN "trep_dkey_detail_copy1"."peak" IS '峰电-电能属性有效';
COMMENT ON COLUMN "trep_dkey_detail_copy1"."valley" IS '谷电-电能属性有效';
-- ----------------------------
-- Records of trep_dkey_detail_copy1
-- ----------------------------
-- ----------------------------
-- Table structure for trep_group_detail
-- ----------------------------
DROP TABLE IF EXISTS "trep_group_detail";
CREATE TABLE "trep_group_detail" (
"tid" uuid NOT NULL,
"did" uuid NOT NULL,
"key" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"bdate" date NOT NULL,
"grpcode" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"val_arr" varchar(255) COLLATE "pg_catalog"."default",
"val_dep" varchar(255) COLLATE "pg_catalog"."default",
"ctime" timestamp(6) DEFAULT now(),
"mtime" timestamp(6) DEFAULT now()
)
;
COMMENT ON COLUMN "trep_group_detail"."tid" IS '租户ID';
COMMENT ON COLUMN "trep_group_detail"."did" IS '设备ID';
COMMENT ON COLUMN "trep_group_detail"."key" IS '属性';
COMMENT ON COLUMN "trep_group_detail"."bdate" IS '营业日期';
COMMENT ON COLUMN "trep_group_detail"."grpcode" IS '班组code';
COMMENT ON COLUMN "trep_group_detail"."val_arr" IS '遥测值开始';
COMMENT ON COLUMN "trep_group_detail"."val_dep" IS '遥测值结束';
COMMENT ON COLUMN "trep_group_detail"."ctime" IS '创建时间';
COMMENT ON COLUMN "trep_group_detail"."mtime" IS '修改时间';
-- ----------------------------
-- Records of trep_group_detail
-- ----------------------------
-- ----------------------------
-- Table structure for trep_hkey_detail
-- ----------------------------
DROP TABLE IF EXISTS "trep_hkey_detail";
CREATE TABLE "trep_hkey_detail" (
"tid" uuid NOT NULL,
"did" uuid NOT NULL,
"key" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"bdate" date NOT NULL,
"hours" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"val" varchar(255) COLLATE "pg_catalog"."default",
"ctime" timestamp(6),
"mtime" timestamp(6),
"val_arr" varchar(255) COLLATE "pg_catalog"."default",
"val_dep" varchar(255) COLLATE "pg_catalog"."default",
"peak" varchar(255) COLLATE "pg_catalog"."default",
"valley" varchar(255) COLLATE "pg_catalog"."default"
)
;
COMMENT ON COLUMN "trep_hkey_detail"."peak" IS '峰电';
COMMENT ON COLUMN "trep_hkey_detail"."valley" IS '谷电';
-- ----------------------------
-- Records of trep_hkey_detail
-- ----------------------------
-- ----------------------------
-- Table structure for trep_hours_sta_detail
-- ----------------------------
DROP TABLE IF EXISTS "trep_hours_sta_detail";
CREATE TABLE "trep_hours_sta_detail" (
"tid" uuid NOT NULL,
"did" uuid NOT NULL,
"key" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"bdate" date NOT NULL,
"hours" int4 NOT NULL,
"cron" int8 DEFAULT 20,
"len" int8 DEFAULT 1,
"ctime" timestamp(6),
"mtime" timestamp(6),
"val" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
"time" int8,
"created_time" int8,
"updated_time" int8
)
;
COMMENT ON COLUMN "trep_hours_sta_detail"."tid" IS '租户ID';
COMMENT ON COLUMN "trep_hours_sta_detail"."did" IS '设备ID';
COMMENT ON COLUMN "trep_hours_sta_detail"."key" IS '属性';
COMMENT ON COLUMN "trep_hours_sta_detail"."bdate" IS '营业日期';
COMMENT ON COLUMN "trep_hours_sta_detail"."hours" IS '小时';
COMMENT ON COLUMN "trep_hours_sta_detail"."cron" IS '统计周期,耗时算法:20s执行周期cron*len为当前状态持续时长';
COMMENT ON COLUMN "trep_hours_sta_detail"."len" IS '计数器默认1';
COMMENT ON COLUMN "trep_hours_sta_detail"."ctime" IS '开始时间';
COMMENT ON COLUMN "trep_hours_sta_detail"."mtime" IS '结束时间';
COMMENT ON COLUMN "trep_hours_sta_detail"."val" IS '状态值';
COMMENT ON COLUMN "trep_hours_sta_detail"."time" IS '时长s';
COMMENT ON COLUMN "trep_hours_sta_detail"."created_time" IS '开始时间long类型';
COMMENT ON COLUMN "trep_hours_sta_detail"."updated_time" IS '结束时间long类型';
-- ----------------------------
-- Records of trep_hours_sta_detail
-- ----------------------------
-- ----------------------------
-- Table structure for trep_hsta_detail
-- ----------------------------
DROP TABLE IF EXISTS "trep_hsta_detail";
CREATE TABLE "trep_hsta_detail" (
"aid" int8 NOT NULL DEFAULT nextval('trep_sta_hdetail_aid_seq'::regclass),
"tid" uuid,
"did" uuid,
"key" varchar(255) COLLATE "pg_catalog"."default",
"val" varchar(255) COLLATE "pg_catalog"."default",
"arr" timestamp(6) DEFAULT now(),
"dep" timestamp(6) DEFAULT now()
)
;
COMMENT ON COLUMN "trep_hsta_detail"."aid" IS '自增长id';
COMMENT ON COLUMN "trep_hsta_detail"."tid" IS '租户id';
COMMENT ON COLUMN "trep_hsta_detail"."did" IS '设备id';
COMMENT ON COLUMN "trep_hsta_detail"."key" IS '属性';
COMMENT ON COLUMN "trep_hsta_detail"."val" IS '属性值';
COMMENT ON COLUMN "trep_hsta_detail"."arr" IS '开始时间';
COMMENT ON COLUMN "trep_hsta_detail"."dep" IS '结束时间';
-- ----------------------------
-- Records of trep_hsta_detail
-- ----------------------------
-- ----------------------------
-- Indexes structure for table tcode_base
-- ----------------------------
CREATE UNIQUE INDEX "tcode_base_item_code_val_tenant_id_idx" ON "tcode_base" USING btree (
"item" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST,
"code" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST,
"val" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST,
"tenant_id" "pg_catalog"."uuid_ops" ASC NULLS LAST
);
-- ----------------------------
-- Primary Key structure for table tcode_base
-- ----------------------------
ALTER TABLE "tcode_base" ADD CONSTRAINT "tcode_base_pkey" PRIMARY KEY ("id");
-- ----------------------------
-- Indexes structure for table tcode_device
-- ----------------------------
CREATE UNIQUE INDEX "tcode_device_index" ON "tcode_device" USING btree (
"id" "pg_catalog"."uuid_ops" ASC NULLS LAST,
"did" "pg_catalog"."uuid_ops" ASC NULLS LAST
);
-- ----------------------------
-- Uniques structure for table tcode_device
-- ----------------------------
ALTER TABLE "tcode_device" ADD CONSTRAINT "tcode_device_mcode_tenant_id_did_key" UNIQUE ("mcode", "tenant_id", "did");
-- ----------------------------
-- Primary Key structure for table tcode_device
-- ----------------------------
ALTER TABLE "tcode_device" ADD CONSTRAINT "tcode_device_pkey" PRIMARY KEY ("id");
-- ----------------------------
-- Primary Key structure for table tcode_group
-- ----------------------------
ALTER TABLE "tcode_group" ADD CONSTRAINT "tcode_group_pkey" PRIMARY KEY ("tid", "code");
-- ----------------------------
-- Primary Key structure for table tcode_group_days
-- ----------------------------
ALTER TABLE "tcode_group_days" ADD CONSTRAINT "tcode_group_days_pkey" PRIMARY KEY ("tid");
-- ----------------------------
-- Primary Key structure for table tcode_group_electric
-- ----------------------------
ALTER TABLE "tcode_group_electric" ADD CONSTRAINT "tcode_group_electric_pkey" PRIMARY KEY ("tid", "code");
-- ----------------------------
-- Indexes structure for table tcode_model
-- ----------------------------
CREATE UNIQUE INDEX "tcode_model_index" ON "tcode_model" USING btree (
"id" "pg_catalog"."uuid_ops" ASC NULLS LAST,
"code" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
-- ----------------------------
-- Uniques structure for table tcode_model
-- ----------------------------
ALTER TABLE "tcode_model" ADD CONSTRAINT "tcode_model_tenant_id_code_key" UNIQUE ("tenant_id", "code");
-- ----------------------------
-- Primary Key structure for table tcode_model
-- ----------------------------
ALTER TABLE "tcode_model" ADD CONSTRAINT "tcode_model_pkey" PRIMARY KEY ("id");
-- ----------------------------
-- Uniques structure for table tcode_model_detail
-- ----------------------------
ALTER TABLE "tcode_model_detail" ADD CONSTRAINT "tcode_model_detail_code_key_tenant_id_key" UNIQUE ("code", "key", "tenant_id");
-- ----------------------------
-- Primary Key structure for table tcode_model_detail
-- ----------------------------
ALTER TABLE "tcode_model_detail" ADD CONSTRAINT "tcode_model_detail_pkey" PRIMARY KEY ("id");
-- ----------------------------
-- Indexes structure for table tcode_model_ex
-- ----------------------------
CREATE UNIQUE INDEX "tcode_model_ex_index" ON "tcode_model_ex" USING btree (
"tid" "pg_catalog"."uuid_ops" ASC NULLS LAST,
"code" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
-- ----------------------------
-- Indexes structure for table tcode_unit
-- ----------------------------
CREATE INDEX "tcode_unit_descript_tenant_id_idx" ON "tcode_unit" USING btree (
"descript" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST,
"tenant_id" "pg_catalog"."uuid_ops" ASC NULLS LAST
);
-- ----------------------------
-- Primary Key structure for table tcode_unit
-- ----------------------------
ALTER TABLE "tcode_unit" ADD CONSTRAINT "tcode_unit_pkey" PRIMARY KEY ("id");
-- ----------------------------
-- Primary Key structure for table trep_day_sta_detail
-- ----------------------------
ALTER TABLE "trep_day_sta_detail" ADD CONSTRAINT "trep_day_sta_detail_pkey" PRIMARY KEY ("tid", "did", "bdate", "key", "val");
-- ----------------------------
-- Indexes structure for table trep_dkey_detail
-- ----------------------------
CREATE UNIQUE INDEX "trep_dkey_detail_index" ON "trep_dkey_detail" USING btree (
"tid" "pg_catalog"."uuid_ops" ASC NULLS LAST,
"did" "pg_catalog"."uuid_ops" ASC NULLS LAST,
"key" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST,
"bdate" "pg_catalog"."date_ops" ASC NULLS LAST
);
-- ----------------------------
-- Primary Key structure for table trep_dkey_detail
-- ----------------------------
ALTER TABLE "trep_dkey_detail" ADD CONSTRAINT "trep_dkey_detail_pkey" PRIMARY KEY ("tid", "did", "key", "bdate");
-- ----------------------------
-- Indexes structure for table trep_dkey_detail_copy1
-- ----------------------------
CREATE UNIQUE INDEX "trep_dkey_detail_index_copy1" ON "trep_dkey_detail_copy1" USING btree (
"tid" "pg_catalog"."uuid_ops" ASC NULLS LAST,
"did" "pg_catalog"."uuid_ops" ASC NULLS LAST,
"key" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST,
"bdate" "pg_catalog"."date_ops" ASC NULLS LAST
);
-- ----------------------------
-- Primary Key structure for table trep_dkey_detail_copy1
-- ----------------------------
ALTER TABLE "trep_dkey_detail_copy1" ADD CONSTRAINT "trep_dkey_detail_copy1_pkey" PRIMARY KEY ("tid", "did", "key", "bdate");
-- ----------------------------
-- Indexes structure for table trep_group_detail
-- ----------------------------
CREATE UNIQUE INDEX "trep_group_detail_index" ON "trep_group_detail" USING btree (
"tid" "pg_catalog"."uuid_ops" ASC NULLS LAST,
"did" "pg_catalog"."uuid_ops" ASC NULLS LAST,
"key" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST,
"bdate" "pg_catalog"."date_ops" ASC NULLS LAST,
"grpcode" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
-- ----------------------------
-- Primary Key structure for table trep_group_detail
-- ----------------------------
ALTER TABLE "trep_group_detail" ADD CONSTRAINT "trep_group_detail_pkey" PRIMARY KEY ("tid", "did", "key", "bdate", "grpcode");
-- ----------------------------
-- Primary Key structure for table trep_group_sta_detail
-- ----------------------------
ALTER TABLE "trep_group_sta_detail" ADD CONSTRAINT "trep_group_sta_detail_pkey" PRIMARY KEY ("tid", "did", "bdate", "grpcode", "key", "val");
-- ----------------------------
-- Indexes structure for table trep_hkey_detail
-- ----------------------------
CREATE UNIQUE INDEX "trep_hkey_detail_index1" ON "trep_hkey_detail" USING btree (
"tid" "pg_catalog"."uuid_ops" ASC NULLS LAST,
"did" "pg_catalog"."uuid_ops" ASC NULLS LAST,
"key" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST,
"bdate" "pg_catalog"."date_ops" ASC NULLS LAST,
"hours" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST,
"val" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
-- ----------------------------
-- Primary Key structure for table trep_hkey_detail
-- ----------------------------
ALTER TABLE "trep_hkey_detail" ADD CONSTRAINT "trep_hkey_detail_pkey" PRIMARY KEY ("tid", "did", "key", "bdate", "hours");
-- ----------------------------
-- Primary Key structure for table trep_hours_sta_detail
-- ----------------------------
ALTER TABLE "trep_hours_sta_detail" ADD CONSTRAINT "trep_hours_sta_detail_pkey" PRIMARY KEY ("tid", "did", "key", "bdate", "hours", "val");
-- ----------------------------
-- Primary Key structure for table trep_hsta_detail
-- ----------------------------
ALTER TABLE "trep_hsta_detail" ADD CONSTRAINT "trep_sta_hdetail_pkey" PRIMARY KEY ("aid");
-- ----------------------------
-- Indexes structure for table trep_sta_detail
-- ----------------------------
CREATE UNIQUE INDEX "trep_sta_detail_index1" ON "trep_sta_detail" USING btree (
"tid" "pg_catalog"."uuid_ops" ASC NULLS LAST,
"did" "pg_catalog"."uuid_ops" ASC NULLS LAST,
"key" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
-- ----------------------------
-- Primary Key structure for table trep_sta_detail
-- ----------------------------
ALTER TABLE "trep_sta_detail" ADD CONSTRAINT "trep_sta_detail_pkey" PRIMARY KEY ("tid", "did", "key");
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment