
--Migration_RCCP_20230613_123237.txt
CREATE TABLE [dbo].[ActualStaffSchedules] (
    [Id] [bigint] NOT NULL IDENTITY,
    [StaffId] [bigint] NOT NULL,
    [StartDateTime] [datetime] NOT NULL,
    [EndDateTime] [datetime] NOT NULL,
    [Type] [int],
    [Day] [int],
    [IsOffDay] [bit],
    [CompanyId] [bigint] NOT NULL,
    [SiteId] [bigint] NOT NULL,
    [TotalWage] [float] NOT NULL,
    CONSTRAINT [PK_dbo.ActualStaffSchedules] PRIMARY KEY ([Id])
)
CREATE TABLE [dbo].[ModifySchedules] (
    [Id] [bigint] NOT NULL IDENTITY,
    [StaffId] [bigint] NOT NULL,
    [StartDateTime] [datetime] NOT NULL,
    [EndDateTime] [datetime] NOT NULL,
    [BreakStartTime] [datetime],
    [BreakEndTime] [datetime],
    [Type] [int],
    [IsOffDay] [bit],
    [TotalWage] [float] NOT NULL,
    CONSTRAINT [PK_dbo.ModifySchedules] PRIMARY KEY ([Id])
)
CREATE TABLE [dbo].[ShiftPreferences] (
    [Id] [bigint] NOT NULL IDENTITY,
    [CompanyId] [bigint] NOT NULL,
    [GranularityType] [int] NOT NULL,
    [GranularityId] [nvarchar](max),
    [Name] [nvarchar](max),
    [StartTime] [datetime] NOT NULL,
    [EndTime] [datetime] NOT NULL,
    [ShiftId] [nvarchar](max),
    CONSTRAINT [PK_dbo.ShiftPreferences] PRIMARY KEY ([Id])
)
CREATE TABLE [dbo].[ShiftWages] (
    [Id] [bigint] NOT NULL IDENTITY,
    [CompanyId] [bigint] NOT NULL,
    [GranularityType] [int] NOT NULL,
    [GranularityId] [nvarchar](max),
    [SolutionId] [int] NOT NULL,
    [Wage] [float] NOT NULL,
    [WageType] [int] NOT NULL,
    [ShiftId] [nvarchar](max),
    CONSTRAINT [PK_dbo.ShiftWages] PRIMARY KEY ([Id])
)
CREATE TABLE [dbo].[Staffs] (
    [Id] [bigint] NOT NULL IDENTITY,
    [FirstName] [nvarchar](max),
    [LastName] [nvarchar](max),
    [CompanyId] [bigint] NOT NULL,
    [UserName] [nvarchar](max),
    [ShiftPreferenceId] [bigint] NOT NULL,
    [MaxWorkingHour] [int] NOT NULL,
    [MinWorkingHour] [int] NOT NULL,
    [EmployeeId] [nvarchar](max),
    [Wage] [float],
    [SiteId] [bigint],
    CONSTRAINT [PK_dbo.Staffs] PRIMARY KEY ([Id])
)
CREATE TABLE [dbo].[StaffRelationLinks] (
    [Id] [bigint] NOT NULL IDENTITY,
    [GranularityType] [int] NOT NULL,
    [GranularityId] [nvarchar](max),
    [StaffEmployeeId] [nvarchar](max),
    [CompanyId] [bigint] NOT NULL,
    CONSTRAINT [PK_dbo.StaffRelationLinks] PRIMARY KEY ([Id])
)
CREATE TABLE [dbo].[SuggestedSchedules] (
    [Id] [bigint] NOT NULL IDENTITY,
    [StaffId] [bigint] NOT NULL,
    [StartDateTime] [datetime] NOT NULL,
    [EndDateTime] [datetime] NOT NULL,
    [BreakStartTime] [datetime],
    [BreakEndTime] [datetime],
    [Type] [int],
    [IsOffDay] [bit],
    [TotalWage] [float] NOT NULL,
    CONSTRAINT [PK_dbo.SuggestedSchedules] PRIMARY KEY ([Id])
)
