
--Migration_RCCP_20230626_143308.txt
CREATE TABLE [dbo].[Datasets] (
    [Id] [bigint] NOT NULL IDENTITY,
    [Code] [nvarchar](max),
    [Name] [nvarchar](max),
    [CreatedDateTime] [datetime] NOT NULL,
    [IsDeleted] [bit] NOT NULL,
    CONSTRAINT [PK_dbo.Datasets] PRIMARY KEY ([Id])
)
CREATE TABLE [dbo].[DatasetComparisonPeriodLinks] (
    [Id] [bigint] NOT NULL IDENTITY,
    [DatasetId] [bigint] NOT NULL,
    [ComparisonPeriodId] [bigint] NOT NULL,
    [IsDefault] [bit] NOT NULL,
    CONSTRAINT [PK_dbo.DatasetComparisonPeriodLinks] PRIMARY KEY ([Id])
)
CREATE TABLE [dbo].[DatasetCurrentPeriodLinks] (
    [Id] [bigint] NOT NULL IDENTITY,
    [DatasetId] [bigint] NOT NULL,
    [CurrentPeriodId] [bigint] NOT NULL,
    [IsDefault] [bit] NOT NULL,
    CONSTRAINT [PK_dbo.DatasetCurrentPeriodLinks] PRIMARY KEY ([Id])
)
CREATE TABLE [dbo].[DatasetEnums] (
    [Id] [bigint] NOT NULL IDENTITY,
    [Type] [nvarchar](max),
    [Code] [nvarchar](max),
    [Name] [nvarchar](max),
    CONSTRAINT [PK_dbo.DatasetEnums] PRIMARY KEY ([Id])
)
CREATE TABLE [dbo].[DatasetGranularityEntityLinks] (
    [Id] [bigint] NOT NULL IDENTITY,
    [DatasetId] [bigint] NOT NULL,
    [GranularityEntityId] [bigint] NOT NULL,
    [IsDefault] [bit] NOT NULL,
    CONSTRAINT [PK_dbo.DatasetGranularityEntityLinks] PRIMARY KEY ([Id])
)
CREATE TABLE [dbo].[DatasetMetricLinks] (
    [Id] [bigint] NOT NULL IDENTITY,
    [DatasetId] [bigint] NOT NULL,
    [MetricId] [bigint] NOT NULL,
    [IsDefault] [bit] NOT NULL,
    CONSTRAINT [PK_dbo.DatasetMetricLinks] PRIMARY KEY ([Id])
)
CREATE TABLE [dbo].[DatasetTimeResolutionLinks] (
    [Id] [bigint] NOT NULL IDENTITY,
    [DatasetId] [bigint] NOT NULL,
    [TimeResolutionId] [bigint] NOT NULL,
    [IsDefault] [bit] NOT NULL,
    CONSTRAINT [PK_dbo.DatasetTimeResolutionLinks] PRIMARY KEY ([Id])
)
