sozsoft-platform/configs/seeds/host/sql/object/Hr_T_JobApplication.sql

38 lines
1.8 KiB
MySQL
Raw Normal View History

2026-10-04 08:14:38 +00:00
IF OBJECT_ID(N'[dbo].[Hr_T_JobApplication]', 'U') IS NULL
BEGIN
CREATE TABLE [dbo].[Hr_T_JobApplication]
(
[Id] uniqueidentifier NOT NULL DEFAULT NEWID(),
[TenantId] uniqueidentifier NULL,
[CandidateId] uniqueidentifier NOT NULL,
[JobPostingId] uniqueidentifier NOT NULL,
[CandidateName] nvarchar(256) NULL,
[PostingTitle] nvarchar(256) NULL,
[ApplicationDate] date NOT NULL,
[SourceId] uniqueidentifier NULL,
[OwnerUserId] uniqueidentifier NULL,
[Stage] nvarchar(32) NOT NULL DEFAULT 'Applied',
[RejectionReasonId] uniqueidentifier NULL,
[RejectionNote] nvarchar(1024) NULL,
[AverageScore] decimal(5,2) NULL,
[SortOrder] int NOT NULL DEFAULT 0,
[Notes] nvarchar(MAX) NULL,
[IsActive] bit NOT NULL DEFAULT 1,
[CreationTime] datetime2 NOT NULL DEFAULT GETUTCDATE(),
[CreatorId] uniqueidentifier NULL,
[LastModificationTime] datetime2 NULL,
[LastModifierId] uniqueidentifier NULL,
[IsDeleted] bit NOT NULL DEFAULT 0,
[DeletionTime] datetime2 NULL,
[DeleterId] uniqueidentifier NULL,
CONSTRAINT [PK_Hr_T_JobApplication] PRIMARY KEY NONCLUSTERED
(
[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
IF NOT EXISTS (SELECT 1 FROM sys.indexes WHERE name = N'UX_Hr_T_JobApplication_CandidatePosting' AND object_id = OBJECT_ID(N'[dbo].[Hr_T_JobApplication]'))
CREATE UNIQUE NONCLUSTERED INDEX [UX_Hr_T_JobApplication_CandidatePosting] ON [dbo].[Hr_T_JobApplication] ([TenantId], [CandidateId], [JobPostingId]) WHERE [IsDeleted] = 0
GO