-- ----------------------------
-- Sequence structure for jobcluster_id_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."jobcluster_id_seq";
CREATE SEQUENCE "public"."jobcluster_id_seq" 
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

-- ----------------------------
-- Sequence structure for jobdetails_id_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."jobdetails_id_seq";
CREATE SEQUENCE "public"."jobdetails_id_seq" 
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

-- ----------------------------
-- Sequence structure for jobtriggers_id_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "public"."jobtriggers_id_seq";
CREATE SEQUENCE "public"."jobtriggers_id_seq" 
INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

-- ----------------------------
-- Table structure for jobcluster
-- ----------------------------
DROP TABLE IF EXISTS "public"."jobcluster";
CREATE TABLE "public"."jobcluster" (
  "id" int8 NOT NULL DEFAULT nextval('jobcluster_id_seq'::regclass),
  "clusterid" varchar(64) COLLATE "pg_catalog"."default" NOT NULL,
  "description" varchar(128) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "status" int4 NOT NULL,
  "updatedtime" timestamp(6)
)
;
COMMENT ON COLUMN "public"."jobcluster"."id" IS 'Id';
COMMENT ON COLUMN "public"."jobcluster"."clusterid" IS '作业集群Id';
COMMENT ON COLUMN "public"."jobcluster"."description" IS '描述信息';
COMMENT ON COLUMN "public"."jobcluster"."status" IS '状态';
COMMENT ON COLUMN "public"."jobcluster"."updatedtime" IS '更新时间';
COMMENT ON TABLE "public"."jobcluster" IS '系统作业集群表';

-- ----------------------------
-- Table structure for jobdetails
-- ----------------------------
DROP TABLE IF EXISTS "public"."jobdetails";
CREATE TABLE "public"."jobdetails" (
  "id" int8 NOT NULL DEFAULT nextval('jobdetails_id_seq'::regclass),
  "jobid" varchar(64) COLLATE "pg_catalog"."default" NOT NULL,
  "groupname" varchar(128) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "jobtype" varchar(128) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "assemblyname" varchar(128) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "description" varchar(128) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "concurrent" bool NOT NULL,
  "includeannotations" bool NOT NULL,
  "properties" text COLLATE "pg_catalog"."default",
  "updatedtime" timestamp(6),
  "createtype" int4 NOT NULL,
  "scriptcode" text COLLATE "pg_catalog"."default",
  "tenantid" varchar(50) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying
)
;
COMMENT ON COLUMN "public"."jobdetails"."id" IS 'Id';
COMMENT ON COLUMN "public"."jobdetails"."jobid" IS '作业Id';
COMMENT ON COLUMN "public"."jobdetails"."groupname" IS '组名称';
COMMENT ON COLUMN "public"."jobdetails"."jobtype" IS '作业类型';
COMMENT ON COLUMN "public"."jobdetails"."assemblyname" IS '程序集';
COMMENT ON COLUMN "public"."jobdetails"."description" IS '描述信息';
COMMENT ON COLUMN "public"."jobdetails"."concurrent" IS '是否并行执行';
COMMENT ON COLUMN "public"."jobdetails"."includeannotations" IS '是否扫描特性触发器';
COMMENT ON COLUMN "public"."jobdetails"."properties" IS '额外数据';
COMMENT ON COLUMN "public"."jobdetails"."updatedtime" IS '更新时间';
COMMENT ON COLUMN "public"."jobdetails"."createtype" IS '作业创建类型';
COMMENT ON COLUMN "public"."jobdetails"."scriptcode" IS '脚本代码';
COMMENT ON COLUMN "public"."jobdetails"."tenantid" IS '租户ID';
COMMENT ON TABLE "public"."jobdetails" IS '作业信息表';

-- ----------------------------
-- Table structure for jobtriggers
-- ----------------------------
DROP TABLE IF EXISTS "public"."jobtriggers";
CREATE TABLE "public"."jobtriggers" (
  "id" int8 NOT NULL DEFAULT nextval('jobtriggers_id_seq'::regclass),
  "triggerid" varchar(64) COLLATE "pg_catalog"."default" NOT NULL,
  "jobid" varchar(64) COLLATE "pg_catalog"."default" NOT NULL,
  "triggertype" varchar(128) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "assemblyname" varchar(128) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "args" varchar(128) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "description" varchar(128) COLLATE "pg_catalog"."default" DEFAULT NULL::character varying,
  "status" int4 NOT NULL,
  "starttime" timestamp(6),
  "endtime" timestamp(6),
  "lastruntime" timestamp(6),
  "nextruntime" timestamp(6),
  "numberofruns" int8 NOT NULL,
  "maxnumberofruns" int8 NOT NULL,
  "numberoferrors" int8 NOT NULL,
  "maxnumberoferrors" int8 NOT NULL,
  "numretries" int4 NOT NULL,
  "retrytimeout" int4 NOT NULL,
  "startnow" bool NOT NULL,
  "runonstart" bool NOT NULL,
  "resetonlyonce" bool NOT NULL,
  "updatedtime" timestamp(6)
)
;
COMMENT ON COLUMN "public"."jobtriggers"."id" IS 'Id';
COMMENT ON COLUMN "public"."jobtriggers"."triggerid" IS '触发器Id';
COMMENT ON COLUMN "public"."jobtriggers"."jobid" IS '作业Id';
COMMENT ON COLUMN "public"."jobtriggers"."triggertype" IS '触发器类型';
COMMENT ON COLUMN "public"."jobtriggers"."assemblyname" IS '程序集';
COMMENT ON COLUMN "public"."jobtriggers"."args" IS '参数';
COMMENT ON COLUMN "public"."jobtriggers"."description" IS '描述信息';
COMMENT ON COLUMN "public"."jobtriggers"."status" IS '状态';
COMMENT ON COLUMN "public"."jobtriggers"."starttime" IS '起始时间';
COMMENT ON COLUMN "public"."jobtriggers"."endtime" IS '结束时间';
COMMENT ON COLUMN "public"."jobtriggers"."lastruntime" IS '最近运行时间';
COMMENT ON COLUMN "public"."jobtriggers"."nextruntime" IS '下一次运行时间';
COMMENT ON COLUMN "public"."jobtriggers"."numberofruns" IS '触发次数';
COMMENT ON COLUMN "public"."jobtriggers"."maxnumberofruns" IS '最大触发次数';
COMMENT ON COLUMN "public"."jobtriggers"."numberoferrors" IS '出错次数';
COMMENT ON COLUMN "public"."jobtriggers"."maxnumberoferrors" IS '最大出错次数';
COMMENT ON COLUMN "public"."jobtriggers"."numretries" IS '重试次数';
COMMENT ON COLUMN "public"."jobtriggers"."retrytimeout" IS '重试间隔时间(ms)';
COMMENT ON COLUMN "public"."jobtriggers"."startnow" IS '是否立即启动';
COMMENT ON COLUMN "public"."jobtriggers"."runonstart" IS '是否启动时执行一次';
COMMENT ON COLUMN "public"."jobtriggers"."resetonlyonce" IS '是否在启动时重置最大触发次数等于一次的作业';
COMMENT ON COLUMN "public"."jobtriggers"."updatedtime" IS '更新时间';
COMMENT ON TABLE "public"."jobtriggers" IS '作业触发器表';

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "public"."jobcluster_id_seq"
OWNED BY "public"."jobcluster"."id";
SELECT setval('"public"."jobcluster_id_seq"', 2, false);

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "public"."jobdetails_id_seq"
OWNED BY "public"."jobdetails"."id";
SELECT setval('"public"."jobdetails_id_seq"', 2, false);

-- ----------------------------
-- Alter sequences owned by
-- ----------------------------
ALTER SEQUENCE "public"."jobtriggers_id_seq"
OWNED BY "public"."jobtriggers"."id";
SELECT setval('"public"."jobtriggers_id_seq"', 2, false);

-- ----------------------------
-- Primary Key structure for table jobcluster
-- ----------------------------
ALTER TABLE "public"."jobcluster" ADD CONSTRAINT "jobcluster_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table jobdetails
-- ----------------------------
ALTER TABLE "public"."jobdetails" ADD CONSTRAINT "jobdetails_pkey" PRIMARY KEY ("id");

-- ----------------------------
-- Primary Key structure for table jobtriggers
-- ----------------------------
ALTER TABLE "public"."jobtriggers" ADD CONSTRAINT "jobtriggers_pkey" PRIMARY KEY ("id");
