diff --git a/Rdmp.Core/Curation/Data/CatalogueOverview.cs b/Rdmp.Core/Curation/Data/CatalogueOverview.cs deleted file mode 100644 index 1e96300538..0000000000 --- a/Rdmp.Core/Curation/Data/CatalogueOverview.cs +++ /dev/null @@ -1,113 +0,0 @@ -using Rdmp.Core.MapsDirectlyToDatabaseTable.Attributes; -using Rdmp.Core.MapsDirectlyToDatabaseTable; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Rdmp.Core.ReusableLibraryCode.Annotations; -using Rdmp.Core.Repositories; -using System.Data.Common; -using Rdmp.Core.Curation.Data.Defaults; -using Microsoft.IdentityModel.Tokens; -using Microsoft.IdentityModel.Protocols.OpenIdConnect; - -namespace Rdmp.Core.Curation.Data; - -public class CatalogueOverview : DatabaseEntity, ICatalogueOverview -{ - - private int _catalogue_ID; - private DateTime? _lastDataLoad; - private DateTime? _lastExtractionTime; - private int _numberOfRecords; - private int _numberOfPeople; - private DateTime? _startDate; - private DateTime? _endDate; - private int _dateColumn; - - - [Unique] - [NotNull] - [DoNotImportDescriptions] - public int Catalogue_ID - { - get => _catalogue_ID; - protected set => SetField(ref _catalogue_ID, value); - } - - [DoNotImportDescriptions] - public DateTime? LastDataLoad - { - get => _lastDataLoad; - set => SetField(ref _lastDataLoad, value); - } - - [DoNotImportDescriptions] - public DateTime? LastExtractionTime - { - get => _lastExtractionTime; - set => SetField(ref _lastExtractionTime, value); - } - - [DoNotImportDescriptions] - public int NumberOfRecords - { - get => _numberOfRecords; - set => SetField(ref _numberOfRecords, value); - } - - [DoNotImportDescriptions] - public int DateColumn_ID - { - get => _dateColumn; - set => SetField(ref _dateColumn, value); - } - - [DoNotImportDescriptions] - public int NumberOfPeople - { - get => _numberOfPeople; - set => SetField(ref _numberOfPeople, value); - } - - [DoNotImportDescriptions] - public DateTime? StartDate - { - get => _startDate; - set => SetField(ref _startDate, value); - } - - [DoNotImportDescriptions] - public DateTime? EndDate - { - get => _endDate; - set => SetField(ref _endDate, value); - } - - public CatalogueOverview() { } - - internal CatalogueOverview(ICatalogueRepository repository, DbDataReader r) - : base(repository, r) - { - Catalogue_ID = int.Parse(r["Catalogue_ID"].ToString()); - LastDataLoad = !string.IsNullOrEmpty(r["LastDataLoad"].ToString()) ? DateTime.Parse(r["LastDataLoad"].ToString()) : null; - LastExtractionTime = !string.IsNullOrEmpty(r["LastExtractionTime"].ToString())? DateTime.Parse(r["LastExtractionTime"].ToString()) : null; - NumberOfRecords = int.Parse(r["NumberOfRecords"].ToString()); - NumberOfPeople = int.Parse(r["NumberOfPeople"].ToString()); - DateColumn_ID = int.Parse(r["DateColumn_ID"].ToString()); - StartDate = !string.IsNullOrEmpty(r["StartDate"].ToString())? DateTime.Parse(r["StartDate"].ToString()) : null; - EndDate = !string.IsNullOrEmpty(r["EndDate"].ToString())? DateTime.Parse(r["EndDate"].ToString()) : null; - } - - public CatalogueOverview(ICatalogueRepository repository, int catalogueID, int numberOfRecords, int numberOfPeople, int dateColumnID) - { - repository.InsertAndHydrate(this, new Dictionary - { - {"Catalogue_ID", catalogueID }, - { "NumberOfRecords", numberOfRecords}, - {"NumberOfPeople", numberOfPeople }, - {"DateColumn_ID", dateColumnID } - }); - } -} \ No newline at end of file diff --git a/Rdmp.Core/Curation/Data/CatalogueOverviewDataPoint.cs b/Rdmp.Core/Curation/Data/CatalogueOverviewDataPoint.cs deleted file mode 100644 index 85cb2cdd36..0000000000 --- a/Rdmp.Core/Curation/Data/CatalogueOverviewDataPoint.cs +++ /dev/null @@ -1,41 +0,0 @@ -using Rdmp.Core.Repositories; -using System; -using System.Collections.Generic; -using System.Data.Common; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Rdmp.Core.Curation.Data; - -public class CatalogueOverviewDataPoint : DatabaseEntity, ICatalogueOverviewDataPoint -{ - - private int _catalogueOverview_ID; - private DateTime _date; - private int _count; - public int CatalogueOverview_ID { get => _catalogueOverview_ID; protected set => SetField(ref _catalogueOverview_ID, value); } - - public DateTime Date { get => _date; set => SetField(ref _date, value); } - public int Count { get => _count; set => SetField(ref _count, value); } - - public CatalogueOverviewDataPoint() { } - - public CatalogueOverviewDataPoint(ICatalogueRepository repository, DbDataReader r) - : base(repository, r) - { - _catalogueOverview_ID = int.Parse(r["CatalogueOverview_ID"].ToString()); - Date = DateTime.Parse(r["Date"].ToString()); - Count = int.Parse(r["Count"].ToString()); - } - - public CatalogueOverviewDataPoint(ICatalogueRepository repository, int catalogueOverview_ID, DateTime date, int count) - { - repository.InsertAndHydrate(this, new Dictionary - { - {"CatalogueOverview_ID", catalogueOverview_ID}, - { "Date", date}, - {"Count", count} - }); - } -} diff --git a/Rdmp.Core/Curation/Data/ICatalogueOverview.cs b/Rdmp.Core/Curation/Data/ICatalogueOverview.cs deleted file mode 100644 index 5f0b183d54..0000000000 --- a/Rdmp.Core/Curation/Data/ICatalogueOverview.cs +++ /dev/null @@ -1,23 +0,0 @@ -using Rdmp.Core.MapsDirectlyToDatabaseTable.Attributes; -using Rdmp.Core.MapsDirectlyToDatabaseTable; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Rdmp.Core.ReusableLibraryCode.Annotations; - -namespace Rdmp.Core.Curation.Data; - -public interface ICatalogueOverview -{ - int Catalogue_ID { get; } - DateTime? LastDataLoad { get; set; } - DateTime? LastExtractionTime { get; set; } - int NumberOfRecords { get; set; } - int NumberOfPeople { get; set; } - DateTime? StartDate { get; set; } - DateTime? EndDate { get; set; } - - int DateColumn_ID { get; set; } -} diff --git a/Rdmp.Core/Curation/Data/ICatalogueOverviewDataPoint.cs b/Rdmp.Core/Curation/Data/ICatalogueOverviewDataPoint.cs deleted file mode 100644 index 20766cf11e..0000000000 --- a/Rdmp.Core/Curation/Data/ICatalogueOverviewDataPoint.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Rdmp.Core.Curation.Data; - -public interface ICatalogueOverviewDataPoint -{ - int CatalogueOverview_ID { get; } - DateTime Date { get; set; } - int Count { get;set; } - -} diff --git a/Rdmp.Core/Databases/CatalogueDatabase/runAfterCreateDatabase/CreateCatalogue.sql b/Rdmp.Core/Databases/CatalogueDatabase/runAfterCreateDatabase/CreateCatalogue.sql index e21decccf6..677babc18a 100644 --- a/Rdmp.Core/Databases/CatalogueDatabase/runAfterCreateDatabase/CreateCatalogue.sql +++ b/Rdmp.Core/Databases/CatalogueDatabase/runAfterCreateDatabase/CreateCatalogue.sql @@ -1400,44 +1400,6 @@ CONSTRAINT [PK_RegexRedactionKey] PRIMARY KEY CLUSTERED END GO -if not exists (select 1 from sys.tables where name = 'CatalogueOverview') -BEGIN -CREATE TABLE [dbo].[CatalogueOverview]( - [ID] [int] IDENTITY(1,1) NOT NULL, - [Catalogue_ID] [int] NOT NULL, - [LastDataLoad] [datetime] NULL, - [LastExtractionTime] [datetime] NULL, - [NumberOfRecords] [int] NOT NULL, - [NumberOfPeople] [int] NOT NULL, - [DateColumn_ID] [int] NOT NULL, - [StartDate] [datetime] NULL, - [EndDate] [datetime] NULL, - CONSTRAINT FK_Catalogue_Overview_Catalogue FOREIGN KEY (Catalogue_ID) REFERENCES Catalogue(ID) ON DELETE CASCADE, -CONSTRAINT PK_CatalogueOverview PRIMARY KEY CLUSTERED -( - [ID] ASC -)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] -) ON [PRIMARY] -END -GO - -if not exists (select 1 from sys.tables where name = 'CatalogueOverviewDataPoint') -BEGIN -CREATE TABLE [dbo].[CatalogueOverviewDataPoint]( - [ID] [int] IDENTITY(1,1) NOT NULL, - [CatalogueOverview_ID] [int] NOT NULL, - [Date] [datetime] NOT NULL, - [Count] int NOT NULL, - CONSTRAINT FK_Catalogue_Overview_DataPoint_Catalogue_Overview FOREIGN KEY (CatalogueOverview_ID) REFERENCES CatalogueOverview(ID) ON DELETE CASCADE, - CONSTRAINT PK_CatalogueOverviewDataPoin2t PRIMARY KEY CLUSTERED -( - [ID] ASC -)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] -) ON [PRIMARY] -END -GO - - EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Table ID' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Catalogue', @level2type=N'COLUMN',@level2name=N'ID' GO EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'‘SMR01’ for example' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'Catalogue', @level2type=N'COLUMN',@level2name=N'Acronym' diff --git a/Rdmp.Core/Databases/CatalogueDatabase/up/089_AddCatalogueOverview.sql b/Rdmp.Core/Databases/CatalogueDatabase/up/089_AddCatalogueOverview.sql deleted file mode 100644 index 19747cbffc..0000000000 --- a/Rdmp.Core/Databases/CatalogueDatabase/up/089_AddCatalogueOverview.sql +++ /dev/null @@ -1,40 +0,0 @@ ---Version: 8.4.1 ---Description: Add catalogue Overview - - -if not exists (select 1 from sys.tables where name = 'CatalogueOverview') -BEGIN -CREATE TABLE [dbo].[CatalogueOverview]( - [ID] [int] IDENTITY(1,1) NOT NULL, - [Catalogue_ID] [int] NOT NULL, - [LastDataLoad] [datetime] NULL, - [LastExtractionTime] [datetime] NULL, - [NumberOfRecords] [int] NOT NULL, - [NumberOfPeople] [int] NOT NULL, - [DateColumn_ID] [int] NOT NULL, - [StartDate] [datetime] NULL, - [EndDate] [datetime] NULL, - CONSTRAINT FK_Catalogue_Overview_Catalogue FOREIGN KEY (Catalogue_ID) REFERENCES Catalogue(ID) ON DELETE CASCADE, -CONSTRAINT PK_CatalogueOverview PRIMARY KEY CLUSTERED -( - [ID] ASC -)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] -) ON [PRIMARY] -END -GO - -if not exists (select 1 from sys.tables where name = 'CatalogueOverviewDataPoint') -BEGIN -CREATE TABLE [dbo].[CatalogueOverviewDataPoint]( - [ID] [int] IDENTITY(1,1) NOT NULL, - [CatalogueOverview_ID] [int] NOT NULL, - [Date] [datetime] NOT NULL, - [Count] int NOT NULL, - CONSTRAINT FK_Catalogue_Overview_DataPoint_Catalogue_Overview FOREIGN KEY (CatalogueOverview_ID) REFERENCES CatalogueOverview(ID) ON DELETE CASCADE, - CONSTRAINT PK_CatalogueOverviewDataPoin2t PRIMARY KEY CLUSTERED -( - [ID] ASC -)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] -) ON [PRIMARY] -END -GO diff --git a/Rdmp.Core/Rdmp.Core.csproj b/Rdmp.Core/Rdmp.Core.csproj index 5966779050..44696b6cff 100644 --- a/Rdmp.Core/Rdmp.Core.csproj +++ b/Rdmp.Core/Rdmp.Core.csproj @@ -257,7 +257,6 @@ -