
--Migration_RCCP_20241113_180928.txt
CREATE TABLE [dbo].[CompaniesSearchConfigurations] (
    [Id] [bigint] NOT NULL IDENTITY,
    [CompanyId] [bigint] NOT NULL,
    [CountryId] [bigint] NOT NULL,
    [Region] [varchar](255),
    [LastUpdatedDatetime] [datetime],
    [Radius] [bigint],
    [HasMan] [bigint],
    [HasWoman] [bigint],
    [IncludedTargetList] [varchar](255),
    CONSTRAINT [PK_dbo.CompaniesSearchConfigurations] PRIMARY KEY ([Id])
)
DECLARE @var0 nvarchar(128)
SELECT @var0 = name
FROM sys.default_constraints
WHERE parent_object_id = object_id(N'dbo.BranchCatchmentCompetitors')
AND col_name(parent_object_id, parent_column_id) = 'DistanceM';
IF @var0 IS NOT NULL
    EXECUTE('ALTER TABLE [dbo].[BranchCatchmentCompetitors] DROP CONSTRAINT [' + @var0 + ']')
ALTER TABLE [dbo].[BranchCatchmentCompetitors] ALTER COLUMN [DistanceM] [float] NULL
DECLARE @var1 nvarchar(128)
SELECT @var1 = name
FROM sys.default_constraints
WHERE parent_object_id = object_id(N'dbo.BranchCatchmentCompetitors')
AND col_name(parent_object_id, parent_column_id) = 'Latitude';
IF @var1 IS NOT NULL
    EXECUTE('ALTER TABLE [dbo].[BranchCatchmentCompetitors] DROP CONSTRAINT [' + @var1 + ']')
ALTER TABLE [dbo].[BranchCatchmentCompetitors] ALTER COLUMN [Latitude] [float] NULL
DECLARE @var2 nvarchar(128)
SELECT @var2 = name
FROM sys.default_constraints
WHERE parent_object_id = object_id(N'dbo.BranchCatchmentCompetitors')
AND col_name(parent_object_id, parent_column_id) = 'Longitude';
IF @var2 IS NOT NULL
    EXECUTE('ALTER TABLE [dbo].[BranchCatchmentCompetitors] DROP CONSTRAINT [' + @var2 + ']')
ALTER TABLE [dbo].[BranchCatchmentCompetitors] ALTER COLUMN [Longitude] [float] NULL
DECLARE @var3 nvarchar(128)
SELECT @var3 = name
FROM sys.default_constraints
WHERE parent_object_id = object_id(N'dbo.BranchCatchmentDatas')
AND col_name(parent_object_id, parent_column_id) = 'AveragePropertyPrice';
IF @var3 IS NOT NULL
    EXECUTE('ALTER TABLE [dbo].[BranchCatchmentDatas] DROP CONSTRAINT [' + @var3 + ']')
ALTER TABLE [dbo].[BranchCatchmentDatas] ALTER COLUMN [AveragePropertyPrice] [float] NULL
DECLARE @var4 nvarchar(128)
SELECT @var4 = name
FROM sys.default_constraints
WHERE parent_object_id = object_id(N'dbo.BranchCatchmentDatas')
AND col_name(parent_object_id, parent_column_id) = 'Area';
IF @var4 IS NOT NULL
    EXECUTE('ALTER TABLE [dbo].[BranchCatchmentDatas] DROP CONSTRAINT [' + @var4 + ']')
ALTER TABLE [dbo].[BranchCatchmentDatas] ALTER COLUMN [Area] [float] NULL
DECLARE @var5 nvarchar(128)
SELECT @var5 = name
FROM sys.default_constraints
WHERE parent_object_id = object_id(N'dbo.BranchCatchmentDatas')
AND col_name(parent_object_id, parent_column_id) = 'LiveableArea';
IF @var5 IS NOT NULL
    EXECUTE('ALTER TABLE [dbo].[BranchCatchmentDatas] DROP CONSTRAINT [' + @var5 + ']')
ALTER TABLE [dbo].[BranchCatchmentDatas] ALTER COLUMN [LiveableArea] [float] NULL
DECLARE @var6 nvarchar(128)
SELECT @var6 = name
FROM sys.default_constraints
WHERE parent_object_id = object_id(N'dbo.BranchCatchmentDatas')
AND col_name(parent_object_id, parent_column_id) = 'TotalPopulation';
IF @var6 IS NOT NULL
    EXECUTE('ALTER TABLE [dbo].[BranchCatchmentDatas] DROP CONSTRAINT [' + @var6 + ']')
ALTER TABLE [dbo].[BranchCatchmentDatas] ALTER COLUMN [TotalPopulation] [bigint] NULL
DECLARE @var7 nvarchar(128)
SELECT @var7 = name
FROM sys.default_constraints
WHERE parent_object_id = object_id(N'dbo.BranchCatchmentDatas')
AND col_name(parent_object_id, parent_column_id) = 'TargetPopulation';
IF @var7 IS NOT NULL
    EXECUTE('ALTER TABLE [dbo].[BranchCatchmentDatas] DROP CONSTRAINT [' + @var7 + ']')
ALTER TABLE [dbo].[BranchCatchmentDatas] ALTER COLUMN [TargetPopulation] [bigint] NULL
DECLARE @var8 nvarchar(128)
SELECT @var8 = name
FROM sys.default_constraints
WHERE parent_object_id = object_id(N'dbo.BranchCatchmentDatas')
AND col_name(parent_object_id, parent_column_id) = 'WomenPopulation';
IF @var8 IS NOT NULL
    EXECUTE('ALTER TABLE [dbo].[BranchCatchmentDatas] DROP CONSTRAINT [' + @var8 + ']')
ALTER TABLE [dbo].[BranchCatchmentDatas] ALTER COLUMN [WomenPopulation] [bigint] NULL
DECLARE @var9 nvarchar(128)
SELECT @var9 = name
FROM sys.default_constraints
WHERE parent_object_id = object_id(N'dbo.BranchCatchmentDatas')
AND col_name(parent_object_id, parent_column_id) = 'MenPopulation';
IF @var9 IS NOT NULL
    EXECUTE('ALTER TABLE [dbo].[BranchCatchmentDatas] DROP CONSTRAINT [' + @var9 + ']')
ALTER TABLE [dbo].[BranchCatchmentDatas] ALTER COLUMN [MenPopulation] [bigint] NULL
DECLARE @var10 nvarchar(128)
SELECT @var10 = name
FROM sys.default_constraints
WHERE parent_object_id = object_id(N'dbo.BranchCatchmentDatas')
AND col_name(parent_object_id, parent_column_id) = 'ChildrenUnder_5_Population';
IF @var10 IS NOT NULL
    EXECUTE('ALTER TABLE [dbo].[BranchCatchmentDatas] DROP CONSTRAINT [' + @var10 + ']')
ALTER TABLE [dbo].[BranchCatchmentDatas] ALTER COLUMN [ChildrenUnder_5_Population] [bigint] NULL
DECLARE @var11 nvarchar(128)
SELECT @var11 = name
FROM sys.default_constraints
WHERE parent_object_id = object_id(N'dbo.BranchCatchmentDatas')
AND col_name(parent_object_id, parent_column_id) = 'Children_6_14_Population';
IF @var11 IS NOT NULL
    EXECUTE('ALTER TABLE [dbo].[BranchCatchmentDatas] DROP CONSTRAINT [' + @var11 + ']')
ALTER TABLE [dbo].[BranchCatchmentDatas] ALTER COLUMN [Children_6_14_Population] [bigint] NULL
DECLARE @var12 nvarchar(128)
SELECT @var12 = name
FROM sys.default_constraints
WHERE parent_object_id = object_id(N'dbo.BranchCatchmentDatas')
AND col_name(parent_object_id, parent_column_id) = 'Youth_15_24_Population';
IF @var12 IS NOT NULL
    EXECUTE('ALTER TABLE [dbo].[BranchCatchmentDatas] DROP CONSTRAINT [' + @var12 + ']')
ALTER TABLE [dbo].[BranchCatchmentDatas] ALTER COLUMN [Youth_15_24_Population] [bigint] NULL
DECLARE @var13 nvarchar(128)
SELECT @var13 = name
FROM sys.default_constraints
WHERE parent_object_id = object_id(N'dbo.BranchCatchmentDatas')
AND col_name(parent_object_id, parent_column_id) = 'Adult_25_59_Population';
IF @var13 IS NOT NULL
    EXECUTE('ALTER TABLE [dbo].[BranchCatchmentDatas] DROP CONSTRAINT [' + @var13 + ']')
ALTER TABLE [dbo].[BranchCatchmentDatas] ALTER COLUMN [Adult_25_59_Population] [bigint] NULL
DECLARE @var14 nvarchar(128)
SELECT @var14 = name
FROM sys.default_constraints
WHERE parent_object_id = object_id(N'dbo.BranchCatchmentDatas')
AND col_name(parent_object_id, parent_column_id) = 'ElderlyAbove_60_Population';
IF @var14 IS NOT NULL
    EXECUTE('ALTER TABLE [dbo].[BranchCatchmentDatas] DROP CONSTRAINT [' + @var14 + ']')
ALTER TABLE [dbo].[BranchCatchmentDatas] ALTER COLUMN [ElderlyAbove_60_Population] [bigint] NULL
DECLARE @var15 nvarchar(128)
SELECT @var15 = name
FROM sys.default_constraints
WHERE parent_object_id = object_id(N'dbo.BranchCatchmentDatas')
AND col_name(parent_object_id, parent_column_id) = 'Women_15_49_Population';
IF @var15 IS NOT NULL
    EXECUTE('ALTER TABLE [dbo].[BranchCatchmentDatas] DROP CONSTRAINT [' + @var15 + ']')
ALTER TABLE [dbo].[BranchCatchmentDatas] ALTER COLUMN [Women_15_49_Population] [bigint] NULL
