DROP TABLE IF EXISTS "ts_cluster_node" ; 
DROP SEQUENCE IF EXISTS ts_cluster_node_id_seq;
CREATE SEQUENCE ts_cluster_node_id_seq;
CREATE TABLE "ts_cluster_node" ("id" int8 NOT NULL DEFAULT nextval('ts_cluster_node_id_seq'::regclass), "ip" varchar (100) DEFAULT NULL, "data" varchar (500) DEFAULT NULL, "port" int4 DEFAULT NULL, "type" varchar (20) DEFAULT NULL, "last_heartbeat_time" timestamp NULL DEFAULT NULL, CONSTRAINT ts_cluster_node_px PRIMARY KEY ("id"));
COMMENT ON COLUMN  "ts_cluster_node"."port" is '端口号';
COMMENT ON COLUMN  "ts_cluster_node"."ip" is 'ip';
COMMENT ON COLUMN  "ts_cluster_node"."data" is '扩展数据';
COMMENT ON COLUMN  "ts_cluster_node"."id" is '主键ID';
COMMENT ON COLUMN  "ts_cluster_node"."type" is '类型';
COMMENT ON COLUMN  "ts_cluster_node"."last_heartbeat_time" is '创建时间';
CREATE UNIQUE INDEX ts_cluster_node_idx_ipPort ON "ts_cluster_node" USING btree ("ip","port");

DROP TABLE IF EXISTS "ts_dataset" ; 
DROP SEQUENCE IF EXISTS ts_dataset_id_seq;
CREATE SEQUENCE ts_dataset_id_seq;
CREATE TABLE "ts_dataset" ("id" int8 NOT NULL DEFAULT nextval('ts_dataset_id_seq'::regclass), "dataset_guid" varchar (512) DEFAULT '0', "type" varchar (20) DEFAULT NULL, "partition_info" varchar (2000) DEFAULT NULL, "create_operator" varchar (128) DEFAULT NULL, "update_operator" varchar (128) DEFAULT NULL, "delete_operator" varchar (128) DEFAULT NULL, "gmt_create" timestamp NULL DEFAULT NULL, "gmt_update" timestamp NULL DEFAULT NULL, "gmt_delete" timestamp NULL DEFAULT NULL, "is_delete" bool DEFAULT NULL, CONSTRAINT ts_dataset_px PRIMARY KEY ("id"));
COMMENT ON COLUMN  "ts_dataset"."dataset_guid" is '数据集id';
COMMENT ON COLUMN  "ts_dataset"."gmt_create" is '创建时间';
COMMENT ON COLUMN  "ts_dataset"."create_operator" is '创建人';
COMMENT ON COLUMN  "ts_dataset"."gmt_delete" is '删除时间';
COMMENT ON COLUMN  "ts_dataset"."id" is '主键ID';
COMMENT ON COLUMN  "ts_dataset"."gmt_update" is '修改时间';
COMMENT ON COLUMN  "ts_dataset"."type" is '类型 VDS，PDS';
COMMENT ON COLUMN  "ts_dataset"."is_delete" is '是否已删除';
COMMENT ON COLUMN  "ts_dataset"."partition_info" is '分区信息';
COMMENT ON COLUMN  "ts_dataset"."delete_operator" is '删除人';
COMMENT ON COLUMN  "ts_dataset"."update_operator" is '修改人';
COMMENT ON TABLE  "ts_dataset" is '调度使用的数据集信息，主要是分区信息';
CREATE INDEX ts_dataset_idx_dataset_guid ON "ts_dataset" USING btree ("dataset_guid");

DROP TABLE IF EXISTS "ts_dataset_partition_instance" ; 
DROP SEQUENCE IF EXISTS ts_dataset_partition_instance_id_seq;
CREATE SEQUENCE ts_dataset_partition_instance_id_seq;
CREATE TABLE "ts_dataset_partition_instance" ("id" int8 NOT NULL DEFAULT nextval('ts_dataset_partition_instance_id_seq'::regclass), "task_id" int8 DEFAULT '0', "guid" varchar (100) DEFAULT NULL, "task_instance_id" int8 DEFAULT '0', "partition_value" varchar (255) DEFAULT NULL, "partition_create_time" timestamp DEFAULT NULL, "create_operator" varchar (128) DEFAULT NULL, "update_operator" varchar (128) DEFAULT NULL, "gmt_create" timestamp NULL DEFAULT NULL, "gmt_update" timestamp NULL DEFAULT NULL, CONSTRAINT ts_dataset_partition_instance_px PRIMARY KEY ("id"));
COMMENT ON COLUMN  "ts_dataset_partition_instance"."partition_create_time" is '分区的创建时间';
COMMENT ON COLUMN  "ts_dataset_partition_instance"."guid" is '数据集id';
COMMENT ON COLUMN  "ts_dataset_partition_instance"."gmt_create" is '创建时间';
COMMENT ON COLUMN  "ts_dataset_partition_instance"."create_operator" is '创建人';
COMMENT ON COLUMN  "ts_dataset_partition_instance"."task_id" is '任务id';
COMMENT ON COLUMN  "ts_dataset_partition_instance"."task_instance_id" is '任务实例';
COMMENT ON COLUMN  "ts_dataset_partition_instance"."id" is '主键ID';
COMMENT ON COLUMN  "ts_dataset_partition_instance"."gmt_update" is '修改时间';
COMMENT ON COLUMN  "ts_dataset_partition_instance"."partition_value" is '分区值';
COMMENT ON COLUMN  "ts_dataset_partition_instance"."update_operator" is '修改人';
COMMENT ON TABLE  "ts_dataset_partition_instance" is '数据集分区实例\n';
CREATE INDEX ts_dataset_partition_instance_idx_taskId_partition ON "ts_dataset_partition_instance" USING btree ("task_id","partition_value");

DROP TABLE IF EXISTS "ts_datasource_config" ; 
CREATE TABLE "ts_datasource_config" ("id" int8 NOT NULL, "name" varchar (255) DEFAULT NULL, "type" varchar (31) DEFAULT NULL, "connection_url" varchar (511) DEFAULT NULL, "username" varchar (255) DEFAULT NULL, "password" varchar (255) DEFAULT NULL, "properties" varchar (1024) DEFAULT NULL, "create_operator" varchar (128) DEFAULT NULL, "update_operator" varchar (128) DEFAULT NULL, "gmt_create" timestamp NULL DEFAULT NULL, "gmt_update" timestamp NULL DEFAULT NULL, CONSTRAINT ts_datasource_config_px PRIMARY KEY ("id"));
COMMENT ON COLUMN  "ts_datasource_config"."gmt_create" is '创建时间';
COMMENT ON COLUMN  "ts_datasource_config"."create_operator" is '创建人';
COMMENT ON COLUMN  "ts_datasource_config"."id" is '主键ID';
COMMENT ON COLUMN  "ts_datasource_config"."gmt_update" is '修改时间';
COMMENT ON COLUMN  "ts_datasource_config"."update_operator" is '修改人';

DROP TABLE IF EXISTS "ts_reflection_dependency" ; 
DROP SEQUENCE IF EXISTS ts_reflection_dependency_id_seq;
CREATE SEQUENCE ts_reflection_dependency_id_seq;
CREATE TABLE "ts_reflection_dependency" ("id" int8 NOT NULL DEFAULT nextval('ts_reflection_dependency_id_seq'::regclass), "tenant_id" varchar (255) DEFAULT NULL, "task_id" int8 DEFAULT '0', "reflection_id" varchar (100) DEFAULT '', "dataset_guid" varchar (512) DEFAULT '', "create_operator" varchar (128) DEFAULT NULL, "update_operator" varchar (128) DEFAULT NULL, "gmt_create" timestamp NULL DEFAULT NULL, "gmt_update" timestamp NULL DEFAULT NULL, CONSTRAINT ts_reflection_dependency_px PRIMARY KEY ("id"));
COMMENT ON COLUMN  "ts_reflection_dependency"."dataset_guid" is '物理数据集 guid';
COMMENT ON COLUMN  "ts_reflection_dependency"."gmt_create" is '创建时间';
COMMENT ON COLUMN  "ts_reflection_dependency"."create_operator" is '创建人';
COMMENT ON COLUMN  "ts_reflection_dependency"."task_id" is '反射任务id';
COMMENT ON COLUMN  "ts_reflection_dependency"."id" is '主键ID';
COMMENT ON COLUMN  "ts_reflection_dependency"."gmt_update" is '修改时间';
COMMENT ON COLUMN  "ts_reflection_dependency"."tenant_id" is '租户id';
COMMENT ON COLUMN  "ts_reflection_dependency"."reflection_id" is 'rp_id';
COMMENT ON COLUMN  "ts_reflection_dependency"."update_operator" is '修改人';
COMMENT ON TABLE  "ts_reflection_dependency" is 'RP任务依赖';
CREATE INDEX ts_reflection_dependency_idx_reflectionId ON "ts_reflection_dependency" USING btree ("reflection_id");
CREATE INDEX ts_reflection_dependency_idx_datasetGuid ON "ts_reflection_dependency" USING btree ("dataset_guid");

DROP TABLE IF EXISTS "ts_reflection_task" ; 
DROP SEQUENCE IF EXISTS ts_reflection_task_id_seq;
CREATE SEQUENCE ts_reflection_task_id_seq;
CREATE TABLE "ts_reflection_task" ("id" int8 NOT NULL DEFAULT nextval('ts_reflection_task_id_seq'::regclass), "task_id" int8 DEFAULT '0', "reflection_id" varchar (100) DEFAULT '0', "dataset_guid" varchar (512) DEFAULT '0', "data" text, "create_operator" varchar (128) DEFAULT NULL, "update_operator" varchar (128) DEFAULT NULL, "delete_operator" varchar (128) DEFAULT NULL, "gmt_create" timestamp NULL DEFAULT NULL, "gmt_update" timestamp NULL DEFAULT NULL, "gmt_delete" timestamp NULL DEFAULT NULL, "is_delete" bool DEFAULT NULL, CONSTRAINT ts_reflection_task_px PRIMARY KEY ("id"));
COMMENT ON COLUMN  "ts_reflection_task"."dataset_guid" is '数据集 guid';
COMMENT ON COLUMN  "ts_reflection_task"."gmt_create" is '创建时间';
COMMENT ON COLUMN  "ts_reflection_task"."create_operator" is '创建人';
COMMENT ON COLUMN  "ts_reflection_task"."data" is '扩展数据';
COMMENT ON COLUMN  "ts_reflection_task"."task_id" is '反射任务id';
COMMENT ON COLUMN  "ts_reflection_task"."gmt_delete" is '删除时间';
COMMENT ON COLUMN  "ts_reflection_task"."id" is '主键ID';
COMMENT ON COLUMN  "ts_reflection_task"."gmt_update" is '修改时间';
COMMENT ON COLUMN  "ts_reflection_task"."is_delete" is '是否已删除';
COMMENT ON COLUMN  "ts_reflection_task"."reflection_id" is '反射id';
COMMENT ON COLUMN  "ts_reflection_task"."delete_operator" is '删除人';
COMMENT ON COLUMN  "ts_reflection_task"."update_operator" is '修改人';
COMMENT ON TABLE  "ts_reflection_task" is '反射任务';
CREATE INDEX ts_reflection_task_idx_taskId ON "ts_reflection_task" USING btree ("task_id");
CREATE INDEX ts_reflection_task_idx_reflectionId ON "ts_reflection_task" USING btree ("reflection_id");
CREATE INDEX ts_reflection_task_idx_guid ON "ts_reflection_task" USING btree ("dataset_guid");

DROP TABLE IF EXISTS "ts_resource_file" ; 
DROP SEQUENCE IF EXISTS ts_resource_file_id_seq;
CREATE SEQUENCE ts_resource_file_id_seq;
CREATE TABLE "ts_resource_file" ("id" int8 NOT NULL DEFAULT nextval('ts_resource_file_id_seq'::regclass), "tenant_id" varchar (255) DEFAULT NULL, "code" varchar (512) DEFAULT NULL, "name" varchar (512) DEFAULT NULL, "description" varchar (512) DEFAULT NULL, "versions" int4 NOT NULL, "content_type" varchar (100) DEFAULT NULL, "file_size" int4 DEFAULT '0', "create_operator" varchar (128) DEFAULT NULL, "update_operator" varchar (128) DEFAULT NULL, "gmt_create" timestamp NULL DEFAULT NULL, "gmt_update" timestamp NULL DEFAULT NULL, CONSTRAINT ts_resource_file_px PRIMARY KEY ("id"));
COMMENT ON COLUMN  "ts_resource_file"."file_size" is '描述';
COMMENT ON COLUMN  "ts_resource_file"."gmt_create" is '创建时间';
COMMENT ON COLUMN  "ts_resource_file"."content_type" is '描述';
COMMENT ON COLUMN  "ts_resource_file"."create_operator" is '创建人';
COMMENT ON COLUMN  "ts_resource_file"."id" is '主键ID';
COMMENT ON COLUMN  "ts_resource_file"."name" is 'jar名称';
COMMENT ON COLUMN  "ts_resource_file"."description" is '描述';
COMMENT ON COLUMN  "ts_resource_file"."gmt_update" is '修改时间';
COMMENT ON COLUMN  "ts_resource_file"."code" is '资源编发，租户下唯一';
COMMENT ON COLUMN  "ts_resource_file"."tenant_id" is '租户id';
COMMENT ON COLUMN  "ts_resource_file"."versions" is '版本id';
COMMENT ON COLUMN  "ts_resource_file"."update_operator" is '修改人';
CREATE UNIQUE INDEX ts_resource_file_uk_tennantId_code ON "ts_resource_file" USING btree ("tenant_id","code");

DROP TABLE IF EXISTS "ts_resource_file_fragment" ; 
DROP SEQUENCE IF EXISTS ts_resource_file_fragment_id_seq;
CREATE SEQUENCE ts_resource_file_fragment_id_seq;
CREATE TABLE "ts_resource_file_fragment" ("id" int8 NOT NULL DEFAULT nextval('ts_resource_file_fragment_id_seq'::regclass), "resource_file_id" int8 DEFAULT NULL, "fragment_index" int4 DEFAULT NULL, "content" bytea, CONSTRAINT ts_resource_file_fragment_px PRIMARY KEY ("id"));
COMMENT ON COLUMN  "ts_resource_file_fragment"."id" is '主键ID';
COMMENT ON COLUMN  "ts_resource_file_fragment"."fragment_index" is '碎片序号';
COMMENT ON COLUMN  "ts_resource_file_fragment"."resource_file_id" is '资源id';
COMMENT ON COLUMN  "ts_resource_file_fragment"."content" is '内容';
CREATE INDEX ts_resource_file_fragment_idx_fileId ON "ts_resource_file_fragment" USING btree ("resource_file_id");

DROP TABLE IF EXISTS "ts_resource_group" ; 
DROP SEQUENCE IF EXISTS ts_resource_group_id_seq;
CREATE SEQUENCE ts_resource_group_id_seq;
CREATE TABLE "ts_resource_group" ("id" int8 NOT NULL DEFAULT nextval('ts_resource_group_id_seq'::regclass), "tenant_id" varchar (255) DEFAULT NULL, "name" varchar (255) DEFAULT NULL, "description" varchar (512) DEFAULT NULL, "match_priority" int4 DEFAULT '0', "rule_config" varchar (2000) DEFAULT NULL, "schedule_config" varchar (2000) DEFAULT NULL, "create_operator" varchar (128) DEFAULT NULL, "update_operator" varchar (128) DEFAULT NULL, "delete_operator" varchar (128) DEFAULT NULL, "gmt_create" timestamp NULL DEFAULT NULL, "gmt_update" timestamp NULL DEFAULT NULL, "gmt_delete" timestamp NULL DEFAULT NULL, "is_delete" bool DEFAULT NULL, CONSTRAINT ts_resource_group_px PRIMARY KEY ("id"));
COMMENT ON COLUMN  "ts_resource_group"."rule_config" is '资源组规则配置';
COMMENT ON COLUMN  "ts_resource_group"."gmt_delete" is '删除时间';
COMMENT ON COLUMN  "ts_resource_group"."id" is '主键ID';
COMMENT ON COLUMN  "ts_resource_group"."match_priority" is '规则匹配优先级';
COMMENT ON COLUMN  "ts_resource_group"."schedule_config" is '资源组规则配置';
COMMENT ON COLUMN  "ts_resource_group"."gmt_create" is '创建时间';
COMMENT ON COLUMN  "ts_resource_group"."create_operator" is '创建人';
COMMENT ON COLUMN  "ts_resource_group"."name" is '资源组名称';
COMMENT ON COLUMN  "ts_resource_group"."description" is '资源组描述';
COMMENT ON COLUMN  "ts_resource_group"."gmt_update" is '修改时间';
COMMENT ON COLUMN  "ts_resource_group"."is_delete" is '是否已删除';
COMMENT ON COLUMN  "ts_resource_group"."tenant_id" is '租户id';
COMMENT ON COLUMN  "ts_resource_group"."delete_operator" is '删除人';
COMMENT ON COLUMN  "ts_resource_group"."update_operator" is '修改人';
COMMENT ON TABLE  "ts_resource_group" is '资源组定义表';
CREATE INDEX ts_resource_group_idx_tenant ON "ts_resource_group" USING btree ("tenant_id");

DROP TABLE IF EXISTS "ts_task" ; 
DROP SEQUENCE IF EXISTS ts_task_id_seq;
CREATE SEQUENCE ts_task_id_seq;
CREATE TABLE "ts_task" ("id" int8 NOT NULL DEFAULT nextval('ts_task_id_seq'::regclass), "process_id" int8 NOT NULL DEFAULT '0', "guid" varchar (512) DEFAULT NULL, "tenant_id" varchar (255) DEFAULT NULL, "workspace_id" varchar (255) DEFAULT NULL, "type" varchar (20) DEFAULT '0', "plugin_config" varchar (2000) DEFAULT NULL, "strategy_config" varchar (1000) DEFAULT NULL, "create_operator" varchar (128) DEFAULT NULL, "update_operator" varchar (128) DEFAULT NULL, "delete_operator" varchar (128) DEFAULT NULL, "gmt_create" timestamp NULL DEFAULT NULL, "gmt_update" timestamp NULL DEFAULT NULL, "gmt_delete" timestamp NULL DEFAULT NULL, "is_delete" bool DEFAULT NULL, "data" text, CONSTRAINT ts_task_px PRIMARY KEY ("id"));
COMMENT ON COLUMN  "ts_task"."process_id" is '工作流id';
COMMENT ON COLUMN  "ts_task"."plugin_config" is '插件配置';
COMMENT ON COLUMN  "ts_task"."guid" is '数据集id';
COMMENT ON COLUMN  "ts_task"."gmt_delete" is '删除时间';
COMMENT ON COLUMN  "ts_task"."id" is '主键ID';
COMMENT ON COLUMN  "ts_task"."type" is '任务类型';
COMMENT ON COLUMN  "ts_task"."gmt_create" is '创建时间';
COMMENT ON COLUMN  "ts_task"."create_operator" is '创建人';
COMMENT ON COLUMN  "ts_task"."workspace_id" is '工作空间id';
COMMENT ON COLUMN  "ts_task"."data" is '扩展数据';
COMMENT ON COLUMN  "ts_task"."gmt_update" is '修改时间';
COMMENT ON COLUMN  "ts_task"."is_delete" is '是否已删除';
COMMENT ON COLUMN  "ts_task"."tenant_id" is '租户id';
COMMENT ON COLUMN  "ts_task"."strategy_config" is '任务策略配置信息';
COMMENT ON COLUMN  "ts_task"."delete_operator" is '删除人';
COMMENT ON COLUMN  "ts_task"."update_operator" is '修改人';
COMMENT ON TABLE  "ts_task" is '任务定义表';
CREATE UNIQUE INDEX ts_task_uk_tennantId_guid ON "ts_task" USING btree ("tenant_id","guid");
CREATE INDEX ts_task_idx_guid ON "ts_task" USING btree ("guid");
CREATE INDEX ts_task_idx_tenantId_workspaceId ON "ts_task" USING btree ("tenant_id","workspace_id");
CREATE INDEX ts_task_idx_processId ON "ts_task" USING btree ("process_id");

DROP TABLE IF EXISTS "ts_task_common_queue" ; 
CREATE TABLE "ts_task_common_queue" ("id" varchar (50) NOT NULL, "name" varchar (50) DEFAULT NULL, "trigger_time" int8 NOT NULL DEFAULT '20', "message" text NOT NULL, "flag" int NOT NULL, "fetch_id" varchar (64) DEFAULT NULL, "fetch_time" timestamp DEFAULT NULL, "gmt_create" timestamp NOT NULL, CONSTRAINT ts_task_common_queue_px PRIMARY KEY ("id"));
COMMENT ON COLUMN  "ts_task_common_queue"."gmt_create" is '创建时间';
COMMENT ON COLUMN  "ts_task_common_queue"."flag" is '处理标记';
COMMENT ON COLUMN  "ts_task_common_queue"."message" is '消息体';
COMMENT ON COLUMN  "ts_task_common_queue"."id" is '主键ID';
COMMENT ON COLUMN  "ts_task_common_queue"."name" is '队列名称';
COMMENT ON COLUMN  "ts_task_common_queue"."fetch_time" is '拉取时间';
COMMENT ON COLUMN  "ts_task_common_queue"."trigger_time" is '触发时间';
COMMENT ON COLUMN  "ts_task_common_queue"."fetch_id" is '拉取编号';
COMMENT ON TABLE  "ts_task_common_queue" is '通用队列';
CREATE INDEX ts_task_common_queue_idx_fetchId ON "ts_task_common_queue" USING btree ("fetch_id");
CREATE INDEX ts_task_common_queue_idx_fetchTime ON "ts_task_common_queue" USING btree ("fetch_time");
CREATE INDEX ts_task_common_queue_idx_queue_trigger_time ON "ts_task_common_queue" USING btree ("name","trigger_time");

DROP TABLE IF EXISTS "ts_task_execution_context" ; 
CREATE TABLE "ts_task_execution_context" ("id" varchar (40) NOT NULL, "task_id" int8 NOT NULL DEFAULT '0', "parallel_no" varchar (40) DEFAULT NULL, "process_instance_ids" varchar (1000) DEFAULT NULL, "task_type" varchar (20) DEFAULT '0', "server_ip" varchar (20) DEFAULT '0', "trigger_time" timestamp DEFAULT NULL, "last_check_time" timestamp DEFAULT NULL, "params" text, "options" varchar (1000) DEFAULT '0', "task_instance_id" int8 DEFAULT '0', "process_task_type" varchar (64) DEFAULT NULL, "operator" varchar (64) DEFAULT NULL, CONSTRAINT ts_task_execution_context_px PRIMARY KEY ("id"));
COMMENT ON COLUMN  "ts_task_execution_context"."last_check_time" is '最后校验时间';
COMMENT ON COLUMN  "ts_task_execution_context"."id" is '主键ID';
COMMENT ON COLUMN  "ts_task_execution_context"."process_instance_ids" is '进程ids';
COMMENT ON COLUMN  "ts_task_execution_context"."server_ip" is '服务器ip';
COMMENT ON COLUMN  "ts_task_execution_context"."process_task_type" is '工作流类型';
COMMENT ON COLUMN  "ts_task_execution_context"."options" is '执行选项';
COMMENT ON COLUMN  "ts_task_execution_context"."task_id" is '任务id';
COMMENT ON COLUMN  "ts_task_execution_context"."task_instance_id" is '任务实例id';
COMMENT ON COLUMN  "ts_task_execution_context"."operator" is '操作人';
COMMENT ON COLUMN  "ts_task_execution_context"."parallel_no" is '并发编号';
COMMENT ON COLUMN  "ts_task_execution_context"."trigger_time" is '触发时间';
COMMENT ON COLUMN  "ts_task_execution_context"."task_type" is '任务类型';
COMMENT ON COLUMN  "ts_task_execution_context"."params" is '执行参数';
CREATE UNIQUE INDEX ts_task_execution_context_uk_task_parallel ON "ts_task_execution_context" USING btree ("task_id","parallel_no");

DROP TABLE IF EXISTS "ts_task_instance" ; 
DROP SEQUENCE IF EXISTS ts_task_instance_id_seq;
CREATE SEQUENCE ts_task_instance_id_seq;
CREATE TABLE "ts_task_instance" ("id" int8 NOT NULL DEFAULT nextval('ts_task_instance_id_seq'::regclass), "tenant_id" varchar (100) DEFAULT NULL, "workspace_id" varchar (255) DEFAULT NULL, "ctx_id" varchar (255) DEFAULT NULL, "process_id" int8 NOT NULL DEFAULT '0', "task_id" int8 NOT NULL DEFAULT '0', "status" int DEFAULT '0', "post_task_ids" varchar (1000) DEFAULT NULL, "process_instance_ids" varchar (1000) DEFAULT NULL, "retry_cnt" int4 DEFAULT '0', "param" text, "result" text, "start_time" timestamp NULL DEFAULT CURRENT_TIMESTAMP, "end_time" timestamp NULL DEFAULT NULL, "create_operator" varchar (128) DEFAULT NULL, "update_operator" varchar (128) DEFAULT NULL, "gmt_create" timestamp NULL DEFAULT NULL, "gmt_update" timestamp NULL DEFAULT NULL, CONSTRAINT ts_task_instance_px PRIMARY KEY ("id"));
COMMENT ON COLUMN  "ts_task_instance"."process_id" is '工作流id';
COMMENT ON COLUMN  "ts_task_instance"."end_time" is '结束时间';
COMMENT ON COLUMN  "ts_task_instance"."retry_cnt" is '重试次数';
COMMENT ON COLUMN  "ts_task_instance"."id" is '主键ID';
COMMENT ON COLUMN  "ts_task_instance"."process_instance_ids" is '进程ids';
COMMENT ON COLUMN  "ts_task_instance"."start_time" is '开始时间';
COMMENT ON COLUMN  "ts_task_instance"."post_task_ids" is '进程ids';
COMMENT ON COLUMN  "ts_task_instance"."param" is '执行参数';
COMMENT ON COLUMN  "ts_task_instance"."status" is '任务状态  1-未执行 2-执行中 3执行成功 4-执行失败 5-暂停 6-停止 7-丢弃';
COMMENT ON COLUMN  "ts_task_instance"."gmt_create" is '创建时间';
COMMENT ON COLUMN  "ts_task_instance"."create_operator" is '创建人';
COMMENT ON COLUMN  "ts_task_instance"."workspace_id" is '工作空间id';
COMMENT ON COLUMN  "ts_task_instance"."task_id" is '任务id';
COMMENT ON COLUMN  "ts_task_instance"."gmt_update" is '修改时间';
COMMENT ON COLUMN  "ts_task_instance"."tenant_id" is '租户id';
COMMENT ON COLUMN  "ts_task_instance"."ctx_id" is '执行上下文id';
COMMENT ON COLUMN  "ts_task_instance"."result" is '结果';
COMMENT ON COLUMN  "ts_task_instance"."update_operator" is '修改人';
COMMENT ON TABLE  "ts_task_instance" is '任务实例表';
CREATE INDEX ts_task_instance_idx_taskId ON "ts_task_instance" USING btree ("task_id");
CREATE INDEX ts_task_instance_idx_tenantId ON "ts_task_instance" USING btree ("tenant_id");
CREATE INDEX ts_task_instance_idx_startTime ON "ts_task_instance" USING btree ("start_time");
CREATE INDEX ts_task_instance_idx_gmtCreate ON "ts_task_instance" USING btree ("gmt_create");
CREATE INDEX ts_task_instance_idx_processInstanceId ON "ts_task_instance" USING btree ("process_instance_ids");
CREATE INDEX ts_task_instance_idx_processId ON "ts_task_instance" USING btree ("process_id");

DROP TABLE IF EXISTS "ts_task_lock" ; 
CREATE TABLE "ts_task_lock" ("lock_name" varchar (50) NOT NULL, CONSTRAINT ts_task_lock_px PRIMARY KEY ("lock_name"));
COMMENT ON COLUMN  "ts_task_lock"."lock_name" is '锁名称';

DROP TABLE IF EXISTS "ts_task_period_instance" ; 
DROP SEQUENCE IF EXISTS ts_task_period_instance_id_seq;
CREATE SEQUENCE ts_task_period_instance_id_seq;
CREATE TABLE "ts_task_period_instance" ("id" int8 NOT NULL DEFAULT nextval('ts_task_period_instance_id_seq'::regclass), "task_id" int8 DEFAULT '0', "guid" varchar (512) DEFAULT NULL, "task_instance_id" int8 DEFAULT '0', "period" timestamp NOT NULL, "period_type" varchar (10) DEFAULT NULL, "create_operator" varchar (128) DEFAULT NULL, "gmt_create" timestamp NULL DEFAULT NULL, "param" text, CONSTRAINT ts_task_period_instance_px PRIMARY KEY ("id"));
COMMENT ON COLUMN  "ts_task_period_instance"."param" is '周期参数';
COMMENT ON COLUMN  "ts_task_period_instance"."period" is '分区值';
COMMENT ON COLUMN  "ts_task_period_instance"."guid" is '数据集id';
COMMENT ON COLUMN  "ts_task_period_instance"."gmt_create" is '创建时间';
COMMENT ON COLUMN  "ts_task_period_instance"."create_operator" is '创建人';
COMMENT ON COLUMN  "ts_task_period_instance"."task_id" is '任务id';
COMMENT ON COLUMN  "ts_task_period_instance"."task_instance_id" is '任务实例';
COMMENT ON COLUMN  "ts_task_period_instance"."id" is '主键ID';
COMMENT ON COLUMN  "ts_task_period_instance"."period_type" is '分区类型 HOUR , DAY, MONTH';
COMMENT ON TABLE  "ts_task_period_instance" is '数据集分区实例';
CREATE INDEX ts_task_period_instance_idx_period ON "ts_task_period_instance" USING btree ("task_id","period");

DROP TABLE IF EXISTS "ts_task_pre_execution" ; 
DROP SEQUENCE IF EXISTS ts_task_pre_execution_id_seq;
CREATE SEQUENCE ts_task_pre_execution_id_seq;
CREATE TABLE "ts_task_pre_execution" ("id" int8 NOT NULL DEFAULT nextval('ts_task_pre_execution_id_seq'::regclass), "task_id" int8 NOT NULL DEFAULT '0', "is_executing" int NOT NULL DEFAULT '0', "ctx_id" varchar (64) DEFAULT NULL, "process_id" int8 NOT NULL DEFAULT '0', "process_task_type" varchar (64) DEFAULT NULL, "params" text, "gmt_create" timestamp DEFAULT NULL, "post_task_ids" varchar (511) DEFAULT NULL, CONSTRAINT ts_task_pre_execution_px PRIMARY KEY ("id"));
COMMENT ON COLUMN  "ts_task_pre_execution"."process_id" is '工作流id';
COMMENT ON COLUMN  "ts_task_pre_execution"."process_task_type" is '工作流类型';
COMMENT ON COLUMN  "ts_task_pre_execution"."post_task_ids" is '下游任务';
COMMENT ON COLUMN  "ts_task_pre_execution"."gmt_create" is '创建时间';
COMMENT ON COLUMN  "ts_task_pre_execution"."task_id" is '任务id';
COMMENT ON COLUMN  "ts_task_pre_execution"."id" is '主键ID';
COMMENT ON COLUMN  "ts_task_pre_execution"."is_executing" is '是否执行中';
COMMENT ON COLUMN  "ts_task_pre_execution"."ctx_id" is '上下文id';
COMMENT ON COLUMN  "ts_task_pre_execution"."params" is '执行参数';
CREATE INDEX ts_task_pre_execution_idx_task_process ON "ts_task_pre_execution" USING btree ("task_id","process_id");
CREATE INDEX ts_task_pre_execution_idx_process ON "ts_task_pre_execution" USING btree ("process_id");

DROP TABLE IF EXISTS "ts_task_process" ; 
DROP SEQUENCE IF EXISTS ts_task_process_id_seq;
CREATE SEQUENCE ts_task_process_id_seq;
CREATE TABLE "ts_task_process" ("id" int8 NOT NULL DEFAULT nextval('ts_task_process_id_seq'::regclass), "tenant_id" varchar (255) DEFAULT NULL, "workspace_id" varchar (255) DEFAULT NULL, "name" varchar (512) DEFAULT NULL, "status" int DEFAULT '0', "data" text, "plugin_config" varchar (2000) DEFAULT NULL, "strategy_config" varchar (1000) DEFAULT NULL, "create_operator" varchar (128) DEFAULT NULL, "update_operator" varchar (128) DEFAULT NULL, "delete_operator" varchar (128) DEFAULT NULL, "gmt_create" timestamp NULL DEFAULT NULL, "gmt_update" timestamp NULL DEFAULT NULL, "gmt_delete" timestamp NULL DEFAULT NULL, "is_delete" bool DEFAULT NULL, CONSTRAINT ts_task_process_px PRIMARY KEY ("id"));
COMMENT ON COLUMN  "ts_task_process"."plugin_config" is '插件配置';
COMMENT ON COLUMN  "ts_task_process"."gmt_delete" is '删除时间';
COMMENT ON COLUMN  "ts_task_process"."id" is '主键ID';
COMMENT ON COLUMN  "ts_task_process"."status" is '工作流状态 0 未上线 1-已上线';
COMMENT ON COLUMN  "ts_task_process"."gmt_create" is '创建时间';
COMMENT ON COLUMN  "ts_task_process"."create_operator" is '创建人';
COMMENT ON COLUMN  "ts_task_process"."workspace_id" is '工作空间id';
COMMENT ON COLUMN  "ts_task_process"."data" is '工作流数据';
COMMENT ON COLUMN  "ts_task_process"."name" is '工作流名称';
COMMENT ON COLUMN  "ts_task_process"."gmt_update" is '修改时间';
COMMENT ON COLUMN  "ts_task_process"."is_delete" is '是否已删除';
COMMENT ON COLUMN  "ts_task_process"."tenant_id" is '租户id';
COMMENT ON COLUMN  "ts_task_process"."strategy_config" is '任务策略配置信息';
COMMENT ON COLUMN  "ts_task_process"."delete_operator" is '删除人';
COMMENT ON COLUMN  "ts_task_process"."update_operator" is '修改人';

DROP TABLE IF EXISTS "ts_task_process_instance" ; 
DROP SEQUENCE IF EXISTS ts_task_process_instance_id_seq;
CREATE SEQUENCE ts_task_process_instance_id_seq;
CREATE TABLE "ts_task_process_instance" ("id" int8 NOT NULL DEFAULT nextval('ts_task_process_instance_id_seq'::regclass), "process_id" int8 NOT NULL DEFAULT '0', "tenant_id" varchar (255) DEFAULT NULL, "remark" varchar (255) DEFAULT NULL, "start_task_id" int8 DEFAULT '0', "command_type" varchar (100) DEFAULT '', "trigger_type" int DEFAULT '0', "param" text, "status" int DEFAULT '0', "result" text, "start_time" timestamp NULL DEFAULT CURRENT_TIMESTAMP, "end_time" timestamp NULL DEFAULT NULL, "create_operator" varchar (128) DEFAULT NULL, "update_operator" varchar (128) DEFAULT NULL, "gmt_create" timestamp NULL DEFAULT NULL, "gmt_update" timestamp NULL DEFAULT NULL, CONSTRAINT ts_task_process_instance_px PRIMARY KEY ("id"));
COMMENT ON COLUMN  "ts_task_process_instance"."process_id" is '工作流id';
COMMENT ON COLUMN  "ts_task_process_instance"."trigger_type" is '触发类型 1 - 时间间隔调度 2 - CRON 3 - 事件触发 4 - 人工';
COMMENT ON COLUMN  "ts_task_process_instance"."end_time" is '结束时间';
COMMENT ON COLUMN  "ts_task_process_instance"."start_task_id" is '任务id';
COMMENT ON COLUMN  "ts_task_process_instance"."id" is '主键ID';
COMMENT ON COLUMN  "ts_task_process_instance"."command_type" is '命令类型';
COMMENT ON COLUMN  "ts_task_process_instance"."start_time" is '开始时间';
COMMENT ON COLUMN  "ts_task_process_instance"."param" is '执行参数';
COMMENT ON COLUMN  "ts_task_process_instance"."status" is '任务状态  1-未执行 2-执行中 3执行成功 4-执行失败 5-暂停 6-停止 7-丢弃';
COMMENT ON COLUMN  "ts_task_process_instance"."gmt_create" is '创建时间';
COMMENT ON COLUMN  "ts_task_process_instance"."create_operator" is '创建人';
COMMENT ON COLUMN  "ts_task_process_instance"."gmt_update" is '修改时间';
COMMENT ON COLUMN  "ts_task_process_instance"."tenant_id" is '租户id';
COMMENT ON COLUMN  "ts_task_process_instance"."remark" is '触发备注';
COMMENT ON COLUMN  "ts_task_process_instance"."result" is '结果';
COMMENT ON COLUMN  "ts_task_process_instance"."update_operator" is '修改人';
COMMENT ON TABLE  "ts_task_process_instance" is '任务工作流实例';
CREATE INDEX ts_task_process_instance_idx_startTaskId ON "ts_task_process_instance" USING btree ("start_task_id");
CREATE INDEX ts_task_process_instance_idx_gmtCreate ON "ts_task_process_instance" USING btree ("gmt_create");
CREATE INDEX ts_task_process_instance_idx_processId ON "ts_task_process_instance" USING btree ("process_id");

DROP TABLE IF EXISTS "ts_task_quartz_schedule" ; 
DROP SEQUENCE IF EXISTS ts_task_quartz_schedule_id_seq;
CREATE SEQUENCE ts_task_quartz_schedule_id_seq;
CREATE TABLE "ts_task_quartz_schedule" ("id" int8 NOT NULL DEFAULT nextval('ts_task_quartz_schedule_id_seq'::regclass), "process_id" int8 NOT NULL DEFAULT '0', "task_id" int8 DEFAULT '0', "type" int DEFAULT NULL, "switch_flag" bool DEFAULT true, "config" varchar (1000) DEFAULT '{}', "create_operator" varchar (128) DEFAULT NULL, "update_operator" varchar (128) DEFAULT NULL, "delete_operator" varchar (128) DEFAULT NULL, "gmt_create" timestamp NULL DEFAULT NULL, "gmt_update" timestamp NULL DEFAULT NULL, "gmt_delete" timestamp NULL DEFAULT NULL, "is_delete" bool DEFAULT NULL, CONSTRAINT ts_task_quartz_schedule_px PRIMARY KEY ("id"));
COMMENT ON COLUMN  "ts_task_quartz_schedule"."process_id" is '工作流id';
COMMENT ON COLUMN  "ts_task_quartz_schedule"."switch_flag" is '开关  默认打开 ';
COMMENT ON COLUMN  "ts_task_quartz_schedule"."gmt_create" is '创建时间';
COMMENT ON COLUMN  "ts_task_quartz_schedule"."create_operator" is '创建人';
COMMENT ON COLUMN  "ts_task_quartz_schedule"."gmt_delete" is '删除时间';
COMMENT ON COLUMN  "ts_task_quartz_schedule"."id" is '主键ID';
COMMENT ON COLUMN  "ts_task_quartz_schedule"."gmt_update" is '修改时间';
COMMENT ON COLUMN  "ts_task_quartz_schedule"."type" is '调度类型: 1 - 间隔调度 2 cron调度';
COMMENT ON COLUMN  "ts_task_quartz_schedule"."is_delete" is '是否已删除';
COMMENT ON COLUMN  "ts_task_quartz_schedule"."delete_operator" is '删除人';
COMMENT ON COLUMN  "ts_task_quartz_schedule"."config" is '配置';
COMMENT ON COLUMN  "ts_task_quartz_schedule"."update_operator" is '修改人';
COMMENT ON TABLE  "ts_task_quartz_schedule" is '任务定时配置';
CREATE INDEX ts_task_quartz_schedule_idx_taskId ON "ts_task_quartz_schedule" USING btree ("task_id");
CREATE INDEX ts_task_quartz_schedule_idx_processId ON "ts_task_quartz_schedule" USING btree ("process_id");

DROP TABLE IF EXISTS "ts_task_quartz_trigger" ; 
DROP SEQUENCE IF EXISTS ts_task_quartz_trigger_id_seq;
CREATE SEQUENCE ts_task_quartz_trigger_id_seq;
CREATE TABLE "ts_task_quartz_trigger" ("id" int8 NOT NULL DEFAULT nextval('ts_task_quartz_trigger_id_seq'::regclass), "task_id" int8 DEFAULT '0', "schedule_id" int8 DEFAULT '0', "type" int DEFAULT NULL, "memo" varchar (20) DEFAULT NULL, "priority" int4 DEFAULT NULL, "next_trigger_time" int8 DEFAULT '0', "prev_trigger_time" int8 DEFAULT '0', "status" int4 DEFAULT '0', "start_time" int8 DEFAULT '0', "end_time" int8 DEFAULT '0', "data" varchar (1000) DEFAULT '{}', "create_operator" varchar (128) DEFAULT NULL, "update_operator" varchar (128) DEFAULT NULL, "gmt_update" timestamp NULL DEFAULT NULL, "gmt_create" timestamp NULL DEFAULT NULL, CONSTRAINT ts_task_quartz_trigger_px PRIMARY KEY ("id"));
COMMENT ON COLUMN  "ts_task_quartz_trigger"."prev_trigger_time" is '下次触发时间';
COMMENT ON COLUMN  "ts_task_quartz_trigger"."end_time" is '开始触发时间';
COMMENT ON COLUMN  "ts_task_quartz_trigger"."memo" is '调度配置';
COMMENT ON COLUMN  "ts_task_quartz_trigger"."id" is '主键ID';
COMMENT ON COLUMN  "ts_task_quartz_trigger"."type" is '调度类型: 1 - 间隔调度 2 cron调度';
COMMENT ON COLUMN  "ts_task_quartz_trigger"."priority" is '优先级';
COMMENT ON COLUMN  "ts_task_quartz_trigger"."start_time" is '开始触发时间';
COMMENT ON COLUMN  "ts_task_quartz_trigger"."schedule_id" is '调度id';
COMMENT ON COLUMN  "ts_task_quartz_trigger"."status" is '触发状态  1 - WAITING 2- EXECUTING 3 - MISFIRED 4 - COMPLETE';
COMMENT ON COLUMN  "ts_task_quartz_trigger"."gmt_create" is '删除时间';
COMMENT ON COLUMN  "ts_task_quartz_trigger"."create_operator" is '创建人';
COMMENT ON COLUMN  "ts_task_quartz_trigger"."data" is '数据';
COMMENT ON COLUMN  "ts_task_quartz_trigger"."gmt_update" is '修改时间';
COMMENT ON COLUMN  "ts_task_quartz_trigger"."next_trigger_time" is '下次触发时间';
COMMENT ON COLUMN  "ts_task_quartz_trigger"."update_operator" is '修改人';
COMMENT ON TABLE  "ts_task_quartz_trigger" is '任务定时配置';
CREATE UNIQUE INDEX ts_task_quartz_trigger_uk_taskId ON "ts_task_quartz_trigger" USING btree ("task_id","schedule_id");
CREATE INDEX ts_task_quartz_trigger_idx_next_trigger_time ON "ts_task_quartz_trigger" USING btree ("next_trigger_time");
CREATE INDEX ts_task_quartz_trigger_idx_status_next_trigger_time ON "ts_task_quartz_trigger" USING btree ("status","next_trigger_time");

DROP TABLE IF EXISTS "ts_task_queue" ; 
DROP SEQUENCE IF EXISTS ts_task_queue_id_seq;
CREATE SEQUENCE ts_task_queue_id_seq;
CREATE TABLE "ts_task_queue" ("id" int8 NOT NULL DEFAULT nextval('ts_task_queue_id_seq'::regclass), "tenant_id" varchar (255) DEFAULT NULL, "last_pull_time" timestamp DEFAULT NULL, "wait_task_cnt" int4 DEFAULT '0', "total_task_cnt" int4 DEFAULT '0', "resource_group_id" int8 NOT NULL DEFAULT '0', "create_operator" varchar (128) DEFAULT NULL, "update_operator" varchar (128) DEFAULT NULL, "gmt_create" timestamp NULL DEFAULT NULL, "gmt_update" timestamp NULL DEFAULT NULL, CONSTRAINT ts_task_queue_px PRIMARY KEY ("id"));
COMMENT ON COLUMN  "ts_task_queue"."wait_task_cnt" is '任务数量';
COMMENT ON COLUMN  "ts_task_queue"."total_task_cnt" is '任务总数量';
COMMENT ON COLUMN  "ts_task_queue"."gmt_create" is '创建时间';
COMMENT ON COLUMN  "ts_task_queue"."create_operator" is '创建人';
COMMENT ON COLUMN  "ts_task_queue"."id" is '主键ID';
COMMENT ON COLUMN  "ts_task_queue"."gmt_update" is '修改时间';
COMMENT ON COLUMN  "ts_task_queue"."resource_group_id" is '资源组id';
COMMENT ON COLUMN  "ts_task_queue"."tenant_id" is '租户id';
COMMENT ON COLUMN  "ts_task_queue"."last_pull_time" is '最近拉取任务时间';
COMMENT ON COLUMN  "ts_task_queue"."update_operator" is '修改人';
COMMENT ON TABLE  "ts_task_queue" is '任务队列表';
CREATE UNIQUE INDEX ts_task_queue_uk ON "ts_task_queue" USING btree ("tenant_id","resource_group_id");

DROP TABLE IF EXISTS "ts_task_queue_item" ; 
DROP SEQUENCE IF EXISTS ts_task_queue_item_id_seq;
CREATE SEQUENCE ts_task_queue_item_id_seq;
CREATE TABLE "ts_task_queue_item" ("id" int8 NOT NULL DEFAULT nextval('ts_task_queue_item_id_seq'::regclass), "tenant_id" varchar (255) DEFAULT NULL, "task_id" int8 NOT NULL DEFAULT '0', "priority" int4 DEFAULT '0', "process_instance_ids" varchar (700) DEFAULT NULL, "status" int DEFAULT '0', "task_instance_id" int8 NOT NULL DEFAULT '0', "data" text, "resource_group_id" int8 NOT NULL DEFAULT '0', "create_operator" varchar (128) DEFAULT NULL, "gmt_create" timestamp NULL DEFAULT NULL, CONSTRAINT ts_task_queue_item_px PRIMARY KEY ("id"));
COMMENT ON COLUMN  "ts_task_queue_item"."status" is '任务状态 0 - 未执行，1-执行中';
COMMENT ON COLUMN  "ts_task_queue_item"."gmt_create" is '创建时间';
COMMENT ON COLUMN  "ts_task_queue_item"."create_operator" is '创建人';
COMMENT ON COLUMN  "ts_task_queue_item"."data" is '任务内容';
COMMENT ON COLUMN  "ts_task_queue_item"."task_id" is '任务id';
COMMENT ON COLUMN  "ts_task_queue_item"."task_instance_id" is '任务实例id';
COMMENT ON COLUMN  "ts_task_queue_item"."id" is '主键ID';
COMMENT ON COLUMN  "ts_task_queue_item"."process_instance_ids" is '进程ids';
COMMENT ON COLUMN  "ts_task_queue_item"."resource_group_id" is '资源组id';
COMMENT ON COLUMN  "ts_task_queue_item"."tenant_id" is '租户id';
COMMENT ON COLUMN  "ts_task_queue_item"."priority" is '规则优先级';
COMMENT ON TABLE  "ts_task_queue_item" is '任务队列表';
CREATE UNIQUE INDEX ts_task_queue_item_idx_task ON "ts_task_queue_item" USING btree ("task_id","process_instance_ids");
CREATE INDEX ts_task_queue_item_idx_tenant ON "ts_task_queue_item" USING btree ("tenant_id","resource_group_id");

DROP TABLE IF EXISTS "ts_task_relation" ; 
DROP SEQUENCE IF EXISTS ts_task_relation_id_seq;
CREATE SEQUENCE ts_task_relation_id_seq;
CREATE TABLE "ts_task_relation" ("id" int8 NOT NULL DEFAULT nextval('ts_task_relation_id_seq'::regclass), "pre_id" int8 DEFAULT '0', "post_id" int8 DEFAULT '0', "type" int DEFAULT NULL, "create_operator" varchar (128) DEFAULT NULL, "update_operator" varchar (128) DEFAULT NULL, "gmt_create" timestamp NULL DEFAULT NULL, "gmt_update" timestamp NULL DEFAULT NULL, CONSTRAINT ts_task_relation_px PRIMARY KEY ("id"));
COMMENT ON COLUMN  "ts_task_relation"."gmt_create" is '创建时间';
COMMENT ON COLUMN  "ts_task_relation"."create_operator" is '创建人';
COMMENT ON COLUMN  "ts_task_relation"."id" is '主键ID';
COMMENT ON COLUMN  "ts_task_relation"."gmt_update" is '修改时间';
COMMENT ON COLUMN  "ts_task_relation"."type" is '类型 1-强依赖 ';
COMMENT ON COLUMN  "ts_task_relation"."update_operator" is '修改人';
COMMENT ON TABLE  "ts_task_relation" is '任务依赖关系';
CREATE UNIQUE INDEX ts_task_relation_uk_pre_post ON "ts_task_relation" USING btree ("pre_id","post_id");
CREATE INDEX ts_task_relation_idx_postId ON "ts_task_relation" USING btree ("post_id");

DROP TABLE IF EXISTS "ts_tenant" ; 
DROP SEQUENCE IF EXISTS ts_tenant_id_seq;
CREATE SEQUENCE ts_tenant_id_seq;
CREATE TABLE "ts_tenant" ("id" int8 NOT NULL DEFAULT nextval('ts_tenant_id_seq'::regclass), "name" varchar (100) DEFAULT NULL, "tenant_id" varchar (100) DEFAULT NULL, "global_config" varchar (2000) DEFAULT NULL, "strategy_config" varchar (1000) DEFAULT NULL, "create_operator" varchar (128) DEFAULT NULL, "update_operator" varchar (128) DEFAULT NULL, "delete_operator" varchar (128) DEFAULT NULL, "gmt_create" timestamp NULL DEFAULT NULL, "gmt_update" timestamp NULL DEFAULT NULL, "gmt_delete" timestamp NULL DEFAULT NULL, "is_delete" bool DEFAULT false, CONSTRAINT ts_tenant_px PRIMARY KEY ("id"));
COMMENT ON COLUMN  "ts_tenant"."global_config" is '全局配置';
COMMENT ON COLUMN  "ts_tenant"."gmt_create" is '创建时间';
COMMENT ON COLUMN  "ts_tenant"."create_operator" is '创建人';
COMMENT ON COLUMN  "ts_tenant"."gmt_delete" is '删除时间';
COMMENT ON COLUMN  "ts_tenant"."id" is '主键ID';
COMMENT ON COLUMN  "ts_tenant"."name" is '名称';
COMMENT ON COLUMN  "ts_tenant"."gmt_update" is '修改时间';
COMMENT ON COLUMN  "ts_tenant"."is_delete" is '是否已删除';
COMMENT ON COLUMN  "ts_tenant"."tenant_id" is '租户id';
COMMENT ON COLUMN  "ts_tenant"."strategy_config" is '任务策略配置信息';
COMMENT ON COLUMN  "ts_tenant"."delete_operator" is '删除人';
COMMENT ON COLUMN  "ts_tenant"."update_operator" is '修改人';
CREATE INDEX ts_tenant_uk_tenantID ON "ts_tenant" USING btree ("tenant_id");


INSERT INTO  ts_tenant (name,tenant_id,global_config,strategy_config,create_operator,update_operator,delete_operator,gmt_create,gmt_update,gmt_delete,is_delete) VALUES
	 ('big_release','big_release','{"bigmetaUrl":"http://bigmetaaddr"}',NULL,'anonymous','anonymous',NULL,'2025-02-24 19:34:38','2025-02-24 19:34:38',NULL,false);
