
--Migration_RCCP_20220914_091255.txt
CREATE TABLE [dbo].[QueuePredictions] (
    [Id] [bigint] NOT NULL IDENTITY,
    [AreaId] [bigint] NOT NULL,
    [BranchId] [bigint] NOT NULL,
    [CompanyId] [bigint] NOT NULL,
    [CreatedDateTime] [datetime] NOT NULL,
    [ArrivalRate] [float],
    [ServiceRate] [float],
    [NumberOfCashiers] [float],
    [SalesConversion] [float],
    [ShoppingDuration] [float],
    [PredictionMethod] [nvarchar](max),
    [PredictionQueueTime] [float],
    [PredictionQueueLength] [float],
    [PredictionQueueAndServeTime] [float],
    CONSTRAINT [PK_dbo.QueuePredictions] PRIMARY KEY ([Id])
)
ALTER TABLE [dbo].[PredictiveAnalyzationValues] ADD [AreaId] [bigint] NOT NULL DEFAULT 0
ALTER TABLE [dbo].[PredictiveAnalyzationValues] ADD [BranchId] [bigint] NOT NULL DEFAULT 0
ALTER TABLE [dbo].[PredictiveAnalyzationValues] ADD [CompanyId] [bigint] NOT NULL DEFAULT 0
ALTER TABLE [dbo].[PredictiveAnalyzationValues] ADD [CreatedDateTime] [datetime]
ALTER TABLE [dbo].[PredictiveAnalyzationValues] ADD [TimeGranularity] [nvarchar](max)
ALTER TABLE [dbo].[PredictiveAnalyzationValues] ADD [PredictionDateTime] [datetime]
DECLARE @var0 nvarchar(128)
SELECT @var0 = name
FROM sys.default_constraints
WHERE parent_object_id = object_id(N'dbo.PredictiveAnalyzationValues')
AND col_name(parent_object_id, parent_column_id) = 'Type';
IF @var0 IS NOT NULL
    EXECUTE('ALTER TABLE [dbo].[PredictiveAnalyzationValues] DROP CONSTRAINT [' + @var0 + ']')
ALTER TABLE [dbo].[PredictiveAnalyzationValues] DROP COLUMN [Type]
DECLARE @var1 nvarchar(128)
SELECT @var1 = name
FROM sys.default_constraints
WHERE parent_object_id = object_id(N'dbo.PredictiveAnalyzationValues')
AND col_name(parent_object_id, parent_column_id) = 'TypeId';
IF @var1 IS NOT NULL
    EXECUTE('ALTER TABLE [dbo].[PredictiveAnalyzationValues] DROP CONSTRAINT [' + @var1 + ']')
ALTER TABLE [dbo].[PredictiveAnalyzationValues] DROP COLUMN [TypeId]
DECLARE @var2 nvarchar(128)
SELECT @var2 = name
FROM sys.default_constraints
WHERE parent_object_id = object_id(N'dbo.PredictiveAnalyzationValues')
AND col_name(parent_object_id, parent_column_id) = 'Resolution';
IF @var2 IS NOT NULL
    EXECUTE('ALTER TABLE [dbo].[PredictiveAnalyzationValues] DROP CONSTRAINT [' + @var2 + ']')
ALTER TABLE [dbo].[PredictiveAnalyzationValues] DROP COLUMN [Resolution]
DECLARE @var3 nvarchar(128)
SELECT @var3 = name
FROM sys.default_constraints
WHERE parent_object_id = object_id(N'dbo.PredictiveAnalyzationValues')
AND col_name(parent_object_id, parent_column_id) = 'PredictionDate';
IF @var3 IS NOT NULL
    EXECUTE('ALTER TABLE [dbo].[PredictiveAnalyzationValues] DROP CONSTRAINT [' + @var3 + ']')
ALTER TABLE [dbo].[PredictiveAnalyzationValues] DROP COLUMN [PredictionDate]
DECLARE @var4 nvarchar(128)
SELECT @var4 = name
FROM sys.default_constraints
WHERE parent_object_id = object_id(N'dbo.PredictiveAnalyzationValues')
AND col_name(parent_object_id, parent_column_id) = 'ValueDateTime';
IF @var4 IS NOT NULL
    EXECUTE('ALTER TABLE [dbo].[PredictiveAnalyzationValues] DROP CONSTRAINT [' + @var4 + ']')
ALTER TABLE [dbo].[PredictiveAnalyzationValues] DROP COLUMN [ValueDateTime]
