CREATE TABLE [dbo].[JobCluster](
	[Id] [bigint] IDENTITY(1,1) NOT NULL,
	[ClusterId] [varchar](64) NOT NULL,
	[Description] [varchar](128) NULL,
	[Status] [int] NOT NULL,
	[UpdatedTime] [datetime] NULL,
 CONSTRAINT [PK_JobCluster_Id] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[JobDetails]    Script Date: 2023/7/18 17:50:21 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[JobDetails](
	[Id] [bigint] IDENTITY(1,1) NOT NULL,
	[JobId] [varchar](64) NOT NULL,
	[GroupName] [varchar](128) NULL,
	[JobType] [varchar](128) NULL,
	[AssemblyName] [varchar](128) NULL,
	[Description] [varchar](128) NULL,
	[Concurrent] [bit] NOT NULL,
	[IncludeAnnotations] [bit] NOT NULL,
	[Properties] [nvarchar](max) NULL,
	[UpdatedTime] [datetime] NULL,
	[CreateType] [int] NOT NULL,
	[ScriptCode] [nvarchar](max) NULL,
	[TenantId] [varchar](50) NULL,
 CONSTRAINT [PK_JobDetails_Id] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
/****** Object:  Table [dbo].[JobTriggers]    Script Date: 2023/7/18 17:50:21 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[JobTriggers](
	[Id] [bigint] IDENTITY(1,1) NOT NULL,
	[TriggerId] [varchar](64) NOT NULL,
	[JobId] [varchar](64) NOT NULL,
	[TriggerType] [varchar](128) NULL,
	[AssemblyName] [varchar](128) NULL,
	[Args] [varchar](128) NULL,
	[Description] [varchar](128) NULL,
	[Status] [int] NOT NULL,
	[StartTime] [datetime] NULL,
	[EndTime] [datetime] NULL,
	[LastRunTime] [datetime] NULL,
	[NextRunTime] [datetime] NULL,
	[NumberOfRuns] [bigint] NOT NULL,
	[MaxNumberOfRuns] [bigint] NOT NULL,
	[NumberOfErrors] [bigint] NOT NULL,
	[MaxNumberOfErrors] [bigint] NOT NULL,
	[NumRetries] [int] NOT NULL,
	[RetryTimeout] [int] NOT NULL,
	[StartNow] [bit] NOT NULL,
	[RunOnStart] [bit] NOT NULL,
	[ResetOnlyOnce] [bit] NOT NULL,
	[UpdatedTime] [datetime] NULL,
 CONSTRAINT [PK_JobTriggers_Id] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Id' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'JobCluster', @level2type=N'COLUMN',@level2name=N'Id'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'作业集群Id' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'JobCluster', @level2type=N'COLUMN',@level2name=N'ClusterId'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'描述信息' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'JobCluster', @level2type=N'COLUMN',@level2name=N'Description'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'状态' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'JobCluster', @level2type=N'COLUMN',@level2name=N'Status'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'更新时间' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'JobCluster', @level2type=N'COLUMN',@level2name=N'UpdatedTime'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'系统作业集群表' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'JobCluster'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Id' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'JobDetails', @level2type=N'COLUMN',@level2name=N'Id'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'作业Id' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'JobDetails', @level2type=N'COLUMN',@level2name=N'JobId'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'组名称' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'JobDetails', @level2type=N'COLUMN',@level2name=N'GroupName'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'作业类型' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'JobDetails', @level2type=N'COLUMN',@level2name=N'JobType'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'程序集' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'JobDetails', @level2type=N'COLUMN',@level2name=N'AssemblyName'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'描述信息' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'JobDetails', @level2type=N'COLUMN',@level2name=N'Description'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'是否并行执行' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'JobDetails', @level2type=N'COLUMN',@level2name=N'Concurrent'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'是否扫描特性触发器' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'JobDetails', @level2type=N'COLUMN',@level2name=N'IncludeAnnotations'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'额外数据' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'JobDetails', @level2type=N'COLUMN',@level2name=N'Properties'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'更新时间' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'JobDetails', @level2type=N'COLUMN',@level2name=N'UpdatedTime'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'作业创建类型' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'JobDetails', @level2type=N'COLUMN',@level2name=N'CreateType'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'脚本代码' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'JobDetails', @level2type=N'COLUMN',@level2name=N'ScriptCode'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'租户ID' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'JobDetails', @level2type=N'COLUMN',@level2name=N'TenantId'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'作业信息表' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'JobDetails'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Id' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'JobTriggers', @level2type=N'COLUMN',@level2name=N'Id'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'触发器Id' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'JobTriggers', @level2type=N'COLUMN',@level2name=N'TriggerId'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'作业Id' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'JobTriggers', @level2type=N'COLUMN',@level2name=N'JobId'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'触发器类型' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'JobTriggers', @level2type=N'COLUMN',@level2name=N'TriggerType'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'程序集' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'JobTriggers', @level2type=N'COLUMN',@level2name=N'AssemblyName'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'参数' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'JobTriggers', @level2type=N'COLUMN',@level2name=N'Args'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'描述信息' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'JobTriggers', @level2type=N'COLUMN',@level2name=N'Description'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'状态' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'JobTriggers', @level2type=N'COLUMN',@level2name=N'Status'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'起始时间' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'JobTriggers', @level2type=N'COLUMN',@level2name=N'StartTime'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'结束时间' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'JobTriggers', @level2type=N'COLUMN',@level2name=N'EndTime'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'最近运行时间' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'JobTriggers', @level2type=N'COLUMN',@level2name=N'LastRunTime'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'下一次运行时间' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'JobTriggers', @level2type=N'COLUMN',@level2name=N'NextRunTime'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'触发次数' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'JobTriggers', @level2type=N'COLUMN',@level2name=N'NumberOfRuns'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'最大触发次数' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'JobTriggers', @level2type=N'COLUMN',@level2name=N'MaxNumberOfRuns'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'出错次数' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'JobTriggers', @level2type=N'COLUMN',@level2name=N'NumberOfErrors'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'最大出错次数' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'JobTriggers', @level2type=N'COLUMN',@level2name=N'MaxNumberOfErrors'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'重试次数' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'JobTriggers', @level2type=N'COLUMN',@level2name=N'NumRetries'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'重试间隔时间(ms)' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'JobTriggers', @level2type=N'COLUMN',@level2name=N'RetryTimeout'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'是否立即启动' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'JobTriggers', @level2type=N'COLUMN',@level2name=N'StartNow'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'是否启动时执行一次' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'JobTriggers', @level2type=N'COLUMN',@level2name=N'RunOnStart'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'是否在启动时重置最大触发次数等于一次的作业' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'JobTriggers', @level2type=N'COLUMN',@level2name=N'ResetOnlyOnce'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'更新时间' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'JobTriggers', @level2type=N'COLUMN',@level2name=N'UpdatedTime'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'作业触发器表' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'JobTriggers'
GO