diff --git a/src/SFA.DAS.Payments.Audit.Database/Payments2/Tables/Payments2.Apprenticeship.sql b/src/SFA.DAS.Payments.Audit.Database/Payments2/Tables/Payments2.Apprenticeship.sql deleted file mode 100644 index ed6e01c42..000000000 --- a/src/SFA.DAS.Payments.Audit.Database/Payments2/Tables/Payments2.Apprenticeship.sql +++ /dev/null @@ -1,77 +0,0 @@ -CREATE TABLE [Payments2].[Apprenticeship] -( - [Id] BIGINT NOT NULL CONSTRAINT PK_Apprenticeship PRIMARY KEY CLUSTERED, - [AccountId] BIGINT NOT NULL, - [AgreementId] CHAR(6) NULL, - [AgreedOnDate] Date NOT null, - [Uln] BIGINT NOT NULL, - [Ukprn] BIGINT NOT NULL, - [EstimatedStartDate] Date NOT NULL, - [EstimatedEndDate] Date NOT NULL, - [Priority] INT NOT NULL, - [StandardCode] BIGINT NULL, - [ProgrammeType] INT NULL, - [FrameworkCode] INT NULL, - [PathwayCode] INT NULL, - [LegalEntityName] NVARCHAR (100) NULL, - [TransferSendingEmployerAccountId] BIGINT NULL, - [StopDate] Date NULL, - [Status] TINYINT NOT NULL, - [IsLevyPayer] BIT NOT NULL, - [CreationDate] DATETIMEOFFSET NOT NULL, - [ApprenticeshipEmployerType] TINYINT NOT NULL, -) - -GO - -CREATE NONCLUSTERED INDEX [IX_Apprenticeship_Ukprn] ON [Payments2].[Apprenticeship] -( - [Ukprn] ASC -) -INCLUDE -( - [Uln] -) - -GO - -CREATE INDEX [IX_Apprenticeship__AccountSearch] ON [Payments2].[Apprenticeship] -( - [Ukprn], - [AccountId], - [TransferSendingEmployerAccountId], - [IsLevyPayer] -) -GO - -CREATE NONCLUSTERED INDEX [IX_Apprenticeship_Uln] ON [Payments2].[Apprenticeship] -( - [Uln] ASC -) -GO - -CREATE NONCLUSTERED INDEX [IX_Apprenticeship__Search] ON [Payments2].[Apprenticeship] -( - [AccountId] -) -INCLUDE -( - [AgreedOnDate], - [AgreementId], - [ApprenticeshipEmployerType], - [EstimatedEndDate], - [EstimatedStartDate], - [FrameworkCode], - [IsLevyPayer], - [LegalEntityName], - [PathwayCode], - [Priority], - [ProgrammeType], - [StandardCode], - [Status], - [StopDate], - [TransferSendingEmployerAccountId], - [Ukprn], - [Uln] -) -WITH (ONLINE = ON) \ No newline at end of file diff --git a/src/SFA.DAS.Payments.Audit.Database/Payments2/Tables/Payments2.ApprenticeshipDuplicate.sql b/src/SFA.DAS.Payments.Audit.Database/Payments2/Tables/Payments2.ApprenticeshipDuplicate.sql deleted file mode 100644 index fcbeb52d8..000000000 --- a/src/SFA.DAS.Payments.Audit.Database/Payments2/Tables/Payments2.ApprenticeshipDuplicate.sql +++ /dev/null @@ -1,14 +0,0 @@ -CREATE TABLE [Payments2].[ApprenticeshipDuplicate] -( - [Id] BIGINT NOT NULL CONSTRAINT PK_ApprenticeshipDuplicate PRIMARY KEY CLUSTERED, - [ApprenticeshipId] BIGINT NOT NULL, - [Ukprn] BIGINT NOT NULL, - [Uln] BIGINT NOT NULL -) -GO - -CREATE INDEX [IX_Payments2_ApprenticeshipDuplicate__Uln] ON [Payments2].[ApprenticeshipDuplicate] -( - [Uln] -) -GO \ No newline at end of file diff --git a/src/SFA.DAS.Payments.Audit.Database/Payments2/Tables/Payments2.ApprenticeshipPause.sql b/src/SFA.DAS.Payments.Audit.Database/Payments2/Tables/Payments2.ApprenticeshipPause.sql deleted file mode 100644 index cf01a29fd..000000000 --- a/src/SFA.DAS.Payments.Audit.Database/Payments2/Tables/Payments2.ApprenticeshipPause.sql +++ /dev/null @@ -1,15 +0,0 @@ -CREATE TABLE [Payments2].[ApprenticeshipPause] ( - [Id] BIGINT NOT NULL CONSTRAINT PK_ApprenticeshipPause PRIMARY KEY CLUSTERED, - [ApprenticeshipId] BIGINT NOT NULL, - [PauseDate] DATE NOT NULL, - [ResumeDate] DATE NULL -); -GO - -CREATE INDEX [IX_ApprenticeshipPause__ApprenticeshipId] ON [Payments2].[ApprenticeshipPause] -( - [ApprenticeshipId] -) -GO - - diff --git a/src/SFA.DAS.Payments.Audit.Database/Payments2/Tables/Payments2.ApprenticeshipPriceEpisode.sql b/src/SFA.DAS.Payments.Audit.Database/Payments2/Tables/Payments2.ApprenticeshipPriceEpisode.sql deleted file mode 100644 index 5fe0635ca..000000000 --- a/src/SFA.DAS.Payments.Audit.Database/Payments2/Tables/Payments2.ApprenticeshipPriceEpisode.sql +++ /dev/null @@ -1,17 +0,0 @@ -CREATE TABLE [Payments2].[ApprenticeshipPriceEpisode] -( - Id BIGINT NOT NULL CONSTRAINT PK_ApprenticeshipPriceEpisode PRIMARY KEY CLUSTERED, - ApprenticeshipId BIGINT NOT NULL, - StartDate Date NOT NULL, - EndDate Date NULL, - Cost DECIMAL(15,5) NOT NULL, - Removed BIT NOT NULL, - CreationDate DATETIMEOFFSET NOT NULL, -) -GO - -CREATE INDEX [IX_ApprenticeshipPriceEpisode__ApprenticeshipId] ON [Payments2].[ApprenticeshipPriceEpisode] -( - [ApprenticeshipId] -) -GO diff --git a/src/SFA.DAS.Payments.Audit.Database/Payments2/Tables/Payments2.DataLockEvent.sql b/src/SFA.DAS.Payments.Audit.Database/Payments2/Tables/Payments2.DataLockEvent.sql deleted file mode 100644 index c4b958f39..000000000 --- a/src/SFA.DAS.Payments.Audit.Database/Payments2/Tables/Payments2.DataLockEvent.sql +++ /dev/null @@ -1,43 +0,0 @@ -CREATE TABLE [Payments2].[DataLockEvent] -( - Id BIGINT NOT NULL IDENTITY(1,1) CONSTRAINT PK_DataLockEvent PRIMARY KEY CLUSTERED, - EventId UNIQUEIDENTIFIER NOT NULL, - EarningEventId UNIQUEIDENTIFIER NOT NULL, - Ukprn BIGINT NOT NULL, - ContractType TINYINT NOT NULL, - CollectionPeriod TINYINT NOT NULL, - AcademicYear SMALLINT NOT NULL, - LearnerReferenceNumber NVARCHAR(50) NOT NULL, - LearnerUln BIGINT NOT NULL, - LearningAimReference NVARCHAR(8) NOT NULL, - LearningAimProgrammeType INT NOT NULL , - LearningAimStandardCode INT NOT NULL, - LearningAimFrameworkCode INT NOT NULL, - LearningAimPathwayCode INT NOT NULL, - LearningAimFundingLineType NVARCHAR(100) NULL, - LearningStartDate DATETIME2 NULL, - AgreementId NVARCHAR(255) NULL, - IlrSubmissionDateTime DATETIME2 NOT NULL, - IsPayable BIT NOT NULL, - DataLockSourceId TINYINT NOT NULL, - JobId BIGINT NOT NULL, - EventTime DATETIMEOFFSET NOT NULL, - CreationDate DATETIMEOFFSET NOT NULL, - DuplicateNumber INT NULL -) -GO - -CREATE NONCLUSTERED INDEX [IX_DataLockEvent__AuditDataFactory] ON [Payments2].[DataLockEvent] -( - [AcademicYear], - [CollectionPeriod], - [EventId] -) -WITH (ONLINE = ON) -GO - -CREATE NONCLUSTERED INDEX [IX_DataLockEvent_IdentifyDataLocksTool] ON [Payments2].[DataLockEvent] -( - [LearnerUln], - [AcademicYear] -) WITH (ONLINE = ON) diff --git a/src/SFA.DAS.Payments.Audit.Database/Payments2/Tables/Payments2.DataLockEventNonPayablePeriod.sql b/src/SFA.DAS.Payments.Audit.Database/Payments2/Tables/Payments2.DataLockEventNonPayablePeriod.sql deleted file mode 100644 index 973ee47b9..000000000 --- a/src/SFA.DAS.Payments.Audit.Database/Payments2/Tables/Payments2.DataLockEventNonPayablePeriod.sql +++ /dev/null @@ -1,40 +0,0 @@ -CREATE TABLE [Payments2].[DataLockEventNonPayablePeriod] -( - Id BIGINT NOT NULL IDENTITY(1,1) CONSTRAINT PK_DataLockEventNonPayablePeriod PRIMARY KEY CLUSTERED, - DataLockEventId UNIQUEIDENTIFIER NOT NULL, - DataLockEventNonPayablePeriodId UNIQUEIDENTIFIER NOT NULL, - PriceEpisodeIdentifier NVARCHAR(50) NULL, - TransactionType TINYINT NOT NULL, - DeliveryPeriod TINYINT NOT NULL, - Amount DECIMAL(15,5) NOT NULL, - SfaContributionPercentage DECIMAL(15,5) NULL, - CreationDate DATETIMEOFFSET NOT NULL, - LearningStartDate DATETIME2 NULL, - AcademicYear SMALLINT NULL, - CollectionPeriod TINYINT NULL, -) -GO - -CREATE NONCLUSTERED INDEX [IX_DataLockEventNonPayablePeriod__AuditDataFactory] ON [Payments2].[DataLockEventNonPayablePeriod] -( - [AcademicYear], - [CollectionPeriod], - [DataLockEventId] -) -WITH (ONLINE = ON) -GO - -CREATE NONCLUSTERED INDEX [IX_DataLockEventNonPayablePeriod_IdentifyDataLocksTool] ON [Payments2].[DataLockEventNonPayablePeriod] -( - [DataLockEventId] -) -INCLUDE -( - [Amount], - [DataLockEventNonPayablePeriodId], - [DeliveryPeriod], - [LearningStartDate], - [PriceEpisodeIdentifier], - [SfaContributionPercentage], - [TransactionType] -) WITH (ONLINE = ON) diff --git a/src/SFA.DAS.Payments.Audit.Database/Payments2/Tables/Payments2.DataLockEventNonPayablePeriodFailures.sql b/src/SFA.DAS.Payments.Audit.Database/Payments2/Tables/Payments2.DataLockEventNonPayablePeriodFailures.sql deleted file mode 100644 index 2bc2e8c84..000000000 --- a/src/SFA.DAS.Payments.Audit.Database/Payments2/Tables/Payments2.DataLockEventNonPayablePeriodFailures.sql +++ /dev/null @@ -1,30 +0,0 @@ -CREATE TABLE [Payments2].[DataLockEventNonPayablePeriodFailures] -( - Id BIGINT NOT NULL IDENTITY(1,1) CONSTRAINT PK_DataLockEventNonPayablePeriodFailures PRIMARY KEY CLUSTERED, - DataLockEventNonPayablePeriodId UNIQUEIDENTIFIER NOT NULL, - DataLockFailureId TINYINT NOT NULL, - CreationDate DATETIMEOFFSET NOT NULL, - ApprenticeshipId BIGINT NULL, - AcademicYear SMALLINT NULL, - CollectionPeriod TINYINT NULL, -) -GO - -CREATE NONCLUSTERED INDEX [IX_DataLockEventNonPayablePeriodFailures__AuditDataFactory] ON [Payments2].[DataLockEventNonPayablePeriodFailures] -( - [AcademicYear], - [CollectionPeriod], - [DataLockEventNonPayablePeriodId] -) -WITH (ONLINE = ON) -GO - -CREATE NONCLUSTERED INDEX [IX_DataLockEventNonPayablePeriodFailures_IdentifyDataLocksTool] ON [Payments2].[DataLockEventNonPayablePeriodFailures] -( - [DataLockEventNonPayablePeriodId] -) -INCLUDE -( - [ApprenticeshipId], - [DataLockFailureId] -) WITH (ONLINE = ON) diff --git a/src/SFA.DAS.Payments.Audit.Database/Payments2/Tables/Payments2.DataLockEventPayablePeriod.sql b/src/SFA.DAS.Payments.Audit.Database/Payments2/Tables/Payments2.DataLockEventPayablePeriod.sql deleted file mode 100644 index ba4bd9565..000000000 --- a/src/SFA.DAS.Payments.Audit.Database/Payments2/Tables/Payments2.DataLockEventPayablePeriod.sql +++ /dev/null @@ -1,27 +0,0 @@ -CREATE TABLE [Payments2].[DataLockEventPayablePeriod] -( - Id BIGINT NOT NULL IDENTITY(1,1) CONSTRAINT PK_DataLockEventPayablePeriod PRIMARY KEY CLUSTERED, - DataLockEventId UNIQUEIDENTIFIER NOT NULL, - PriceEpisodeIdentifier NVARCHAR(50) NULL, - TransactionType TINYINT NOT NULL, - DeliveryPeriod TINYINT NOT NULL, - Amount DECIMAL(15,5) NOT NULL, - SfaContributionPercentage DECIMAL(15,5) NULL, - CreationDate DATETIMEOFFSET NOT NULL, - LearningStartDate DATETIME2 NULL, - ApprenticeshipId BIGINT NULL, - ApprenticeshipPriceEpisodeId BIGINT NULL, - ApprenticeshipEmployerType TINYINT NULL, - AcademicYear SMALLINT NULL, - CollectionPeriod TINYINT NULL -) -GO - -CREATE NONCLUSTERED INDEX [IX_DataLockEventPayablePeriod__AuditDataFactory] ON [Payments2].[DataLockEventPayablePeriod] -( - [AcademicYear], - [CollectionPeriod], - [DataLockEventId] -) -WITH (ONLINE = ON) -GO diff --git a/src/SFA.DAS.Payments.Audit.Database/Payments2/Tables/Payments2.DataLockEventPriceEpisode.sql b/src/SFA.DAS.Payments.Audit.Database/Payments2/Tables/Payments2.DataLockEventPriceEpisode.sql deleted file mode 100644 index 14b773090..000000000 --- a/src/SFA.DAS.Payments.Audit.Database/Payments2/Tables/Payments2.DataLockEventPriceEpisode.sql +++ /dev/null @@ -1,51 +0,0 @@ -CREATE TABLE [Payments2].[DataLockEventPriceEpisode] -( - Id BIGINT NOT NULL IDENTITY(1,1) CONSTRAINT PK_DataLockEventPriceEpisode PRIMARY KEY CLUSTERED, - DataLockEventId UNIQUEIDENTIFIER NOT NULL, - PriceEpisodeIdentifier NVARCHAR(50) NOT NULL, - SfaContributionPercentage DECIMAL(15,5) NOT NULL, - TotalNegotiatedPrice1 DECIMAL(15,5) NOT NULL, - TotalNegotiatedPrice2 DECIMAL(15,5) NULL, - TotalNegotiatedPrice3 DECIMAL(15,5) NULL, - TotalNegotiatedPrice4 DECIMAL(15,5) NULL, - StartDate DATETIME2 NOT NULL, - EffectiveTotalNegotiatedPriceStartDate DATETIME2 NULL, - PlannedEndDate DATETIME2 NOT NULL, - ActualEndDate DATETIME2 NULL, - NumberOfInstalments INT NOT NULL, - InstalmentAmount DECIMAL(15,5) NOT NULL, - CompletionAmount DECIMAL(15,5) NOT NULL, - Completed BIT NOT NULL, - EmployerContribution DECIMAL(15,5) NULL, - CompletionHoldBackExemptionCode INT NULL, - CreationDate DATETIMEOFFSET NOT NULL, - AcademicYear SMALLINT NULL, - CollectionPeriod TINYINT NULL -) -GO - -CREATE NONCLUSTERED INDEX [IX_DataLockEventPriceEpisode__AuditDataFactory] ON [Payments2].[DataLockEventPriceEpisode] -( - [AcademicYear], - [CollectionPeriod], - [DataLockEventId] -) -WITH (ONLINE = ON) -GO - -CREATE NONCLUSTERED INDEX [IX_DataLockEventPriceEpisode_IdentifyDataLocksTool] ON [Payments2].[DataLockEventPriceEpisode] -( - [DataLockEventId], - [PriceEpisodeIdentifier] -) -INCLUDE -( - [ActualEndDate], - [EffectiveTotalNegotiatedPriceStartDate], - [PlannedEndDate], - [StartDate], - [TotalNegotiatedPrice1], - [TotalNegotiatedPrice2], - [TotalNegotiatedPrice3], - [TotalNegotiatedPrice4] -) WITH (ONLINE = ON) diff --git a/src/SFA.DAS.Payments.Audit.Database/Payments2/Tables/Payments2.EarningEvent.sql b/src/SFA.DAS.Payments.Audit.Database/Payments2/Tables/Payments2.EarningEvent.sql deleted file mode 100644 index 7e9cc428e..000000000 --- a/src/SFA.DAS.Payments.Audit.Database/Payments2/Tables/Payments2.EarningEvent.sql +++ /dev/null @@ -1,37 +0,0 @@ -CREATE TABLE [Payments2].[EarningEvent] -( - Id BIGINT NOT NULL IDENTITY(1,1) CONSTRAINT PK_EarningEvent PRIMARY KEY CLUSTERED, - EventId UNIQUEIDENTIFIER NOT NULL, - Ukprn BIGINT NOT NULL, - ContractType TINYINT NOT NULL, - CollectionPeriod TINYINT NOT NULL, - AcademicYear SMALLINT NOT NULL, - LearnerReferenceNumber NVARCHAR(50) NOT NULL, - LearnerUln BIGINT NOT NULL, - LearningAimReference NVARCHAR(8) NOT NULL, - LearningAimProgrammeType INT NOT NULL , - LearningAimStandardCode INT NOT NULL, - LearningAimFrameworkCode INT NOT NULL, - LearningAimPathwayCode INT NOT NULL, - LearningAimFundingLineType NVARCHAR(100) NULL, - LearningStartDate DATETIME2 NULL, - AgreementId NVARCHAR(255) NULL, - IlrSubmissionDateTime DATETIME2 NOT NULL, - JobId BIGINT NOT NULL, - EventTime DATETIMEOFFSET NOT NULL, - CreationDate DATETIMEOFFSET NOT NULL, - LearningAimSequenceNumber BIGINT NULL, - SfaContributionPercentage DECIMAL(15, 5) NULL, - IlrFileName NVARCHAR(400) NULL, - EventType NVARCHAR(4000) NULL, -) -GO - -CREATE NONCLUSTERED INDEX [IX_EarningEvent__AuditDataFactory] ON [Payments2].[EarningEvent] -( - [AcademicYear], - [CollectionPeriod], - [EventId] -) -WITH (ONLINE = ON) -GO diff --git a/src/SFA.DAS.Payments.Audit.Database/Payments2/Tables/Payments2.EarningEventPeriod.sql b/src/SFA.DAS.Payments.Audit.Database/Payments2/Tables/Payments2.EarningEventPeriod.sql deleted file mode 100644 index 77b3042d7..000000000 --- a/src/SFA.DAS.Payments.Audit.Database/Payments2/Tables/Payments2.EarningEventPeriod.sql +++ /dev/null @@ -1,24 +0,0 @@ -CREATE TABLE [Payments2].[EarningEventPeriod] -( - Id BIGINT NOT NULL IDENTITY(1,1) CONSTRAINT PK_EarningEventPeriod PRIMARY KEY CLUSTERED, - EarningEventId UNIQUEIDENTIFIER NOT NULL, - PriceEpisodeIdentifier NVARCHAR(50) NULL, - TransactionType TINYINT NOT NULL, - DeliveryPeriod TINYINT NOT NULL, - Amount DECIMAL(15,5) NOT NULL, - SfaContributionPercentage DECIMAL(15,5) NULL, - CreationDate DATETIMEOFFSET NOT NULL, - CensusDate DATETIME2 NULL, - AcademicYear SMALLINT NULL, - CollectionPeriod TINYINT NULL -) -GO - -CREATE NONCLUSTERED INDEX [IX_EarningEventPeriod__AuditDataFactory] ON [Payments2].[EarningEventPeriod] -( - [AcademicYear], - [CollectionPeriod], - [EarningEventId] -) -WITH (ONLINE = ON) -GO diff --git a/src/SFA.DAS.Payments.Audit.Database/Payments2/Tables/Payments2.EarningEventPriceEpisode.sql b/src/SFA.DAS.Payments.Audit.Database/Payments2/Tables/Payments2.EarningEventPriceEpisode.sql deleted file mode 100644 index f2105c0ed..000000000 --- a/src/SFA.DAS.Payments.Audit.Database/Payments2/Tables/Payments2.EarningEventPriceEpisode.sql +++ /dev/null @@ -1,64 +0,0 @@ -CREATE TABLE [Payments2].[EarningEventPriceEpisode] -( - Id BIGINT NOT NULL IDENTITY(1,1) CONSTRAINT PK_EarningEventPriceEpisode PRIMARY KEY CLUSTERED, - EarningEventId UNIQUEIDENTIFIER NOT NULL, - PriceEpisodeIdentifier NVARCHAR(50) NOT NULL, - SfaContributionPercentage DECIMAL(15,5) NOT NULL, - TotalNegotiatedPrice1 DECIMAL(15,5) NOT NULL, - TotalNegotiatedPrice2 DECIMAL(15,5) NULL, - TotalNegotiatedPrice3 DECIMAL(15,5) NULL, - TotalNegotiatedPrice4 DECIMAL(15,5) NULL, - StartDate DATETIME2 NOT NULL, - EffectiveTotalNegotiatedPriceStartDate DATETIME2 NULL, - PlannedEndDate DATETIME2 NOT NULL, - ActualEndDate DATETIME2 NULL, - NumberOfInstalments INT NOT NULL, - InstalmentAmount DECIMAL(15,5) NOT NULL, - CompletionAmount DECIMAL(15,5) NOT NULL, - Completed BIT NOT NULL, - EmployerContribution DECIMAL(15,5) NULL, - CompletionHoldBackExemptionCode INT NULL, - CreationDate DATETIMEOFFSET NOT NULL, - AgreedPrice DECIMAL(15, 5) NULL, - CourseStartDate DATETIME2 NULL, - AcademicYear SMALLINT NULL, - CollectionPeriod TINYINT NULL, -) -GO - -CREATE NONCLUSTERED INDEX [IX_EarningEventPriceEpisode__AuditDataFactory] ON [Payments2].[EarningEventPriceEpisode] -( - [AcademicYear], - [CollectionPeriod], - [EarningEventId] -) -WITH (ONLINE = ON) -GO - -CREATE NONCLUSTERED INDEX [IX_EarningEventPriceEpisode_IdentifyDataLocksTool] ON [Payments2].[EarningEventPriceEpisode] -( - [EarningEventId] -) -INCLUDE -( - [ActualEndDate], - [AgreedPrice], - [Completed], - [CompletionAmount], - [CompletionHoldBackExemptionCode], - [CourseStartDate], - [EffectiveTotalNegotiatedPriceStartDate], - [EmployerContribution], - [InstalmentAmount], - [NumberOfInstalments], - [PlannedEndDate], - [PriceEpisodeIdentifier], - [SfaContributionPercentage], - [StartDate], - [TotalNegotiatedPrice1], - [TotalNegotiatedPrice2], - [TotalNegotiatedPrice3], - [TotalNegotiatedPrice4] -) -WITH (ONLINE = ON) -GO diff --git a/src/SFA.DAS.Payments.Audit.Database/Payments2/Tables/Payments2.FundingSourceEvent.sql b/src/SFA.DAS.Payments.Audit.Database/Payments2/Tables/Payments2.FundingSourceEvent.sql deleted file mode 100644 index cbe23fa85..000000000 --- a/src/SFA.DAS.Payments.Audit.Database/Payments2/Tables/Payments2.FundingSourceEvent.sql +++ /dev/null @@ -1,56 +0,0 @@ -CREATE TABLE [Payments2].[FundingSourceEvent] -( - Id BIGINT NOT NULL IDENTITY(1,1) CONSTRAINT PK_FundingSourceEvent PRIMARY KEY CLUSTERED, - EventId UNIQUEIDENTIFIER NOT NULL, - EarningEventId UNIQUEIDENTIFIER NOT NULL, - RequiredPaymentEventId UNIQUEIDENTIFIER NOT NULL, - ClawbackSourcePaymentEventId UNIQUEIDENTIFIER NULL, - EventTime DATETIMEOFFSET NOT NULL, - JobId BIGINT NOT NULL, - DeliveryPeriod TINYINT NOT NULL, - CollectionPeriod TINYINT NOT NULL, - AcademicYear SMALLINT NOT NULL, - Ukprn BIGINT NOT NULL, - LearnerReferenceNumber NVARCHAR(50) NOT NULL, - LearnerUln BIGINT NOT NULL, - PriceEpisodeIdentifier NVARCHAR(50) NOT NULL, - Amount DECIMAL(15,5) NOT NULL, - LearningAimReference NVARCHAR(8) NOT NULL, - LearningAimProgrammeType INT NOT NULL , - LearningAimStandardCode INT NOT NULL, - LearningAimFrameworkCode INT NOT NULL, - LearningAimPathwayCode INT NOT NULL, - LearningAimFundingLineType NVARCHAR(100) NOT NULL, - ContractType TINYINT NOT NULL, - TransactionType TINYINT NOT NULL, - FundingSourceType TINYINT NOT NULL, - IlrSubmissionDateTime DATETIME2 NOT NULL, - SfaContributionPercentage DECIMAL(15,5) NOT NULL, - AgreementId NVARCHAR(255) NULL, - AccountId BIGINT NULL, - TransferSenderAccountId BIGINT NULL, - CreationDate DATETIMEOFFSET NOT NULL, - EarningsStartDate DATETIME NOT NULL, - EarningsPlannedEndDate DATETIME NULL, - EarningsActualEndDate DATETIME NULL, - EarningsCompletionStatus TINYINT NOT NULL, - EarningsCompletionAmount DECIMAL (15,5), - EarningsInstalmentAmount DECIMAL (15,5), - EarningsNumberOfInstalments SMALLINT NOT NULL, - LearningStartDate DATETIME2 NULL, - ApprenticeshipId BIGINT NULL, - ApprenticeshipPriceEpisodeId BIGINT NULL, - ApprenticeshipEmployerType TINYINT NULL, - NonPaymentReason TINYINT NULL, - DuplicateNumber INT NULL -) -GO - -CREATE NONCLUSTERED INDEX [IX_FundingSourceEvent__AuditDataFactory] ON [Payments2].[FundingSourceEvent] -( - [AcademicYear], - [CollectionPeriod], - [EventId] -) -WITH (ONLINE = ON) -GO diff --git a/src/SFA.DAS.Payments.Audit.Database/Payments2/Tables/Payments2.Job.sql b/src/SFA.DAS.Payments.Audit.Database/Payments2/Tables/Payments2.Job.sql deleted file mode 100644 index 580002c24..000000000 --- a/src/SFA.DAS.Payments.Audit.Database/Payments2/Tables/Payments2.Job.sql +++ /dev/null @@ -1,58 +0,0 @@ -Create TABLE [Payments2].[Job] -( - [JobId] BIGINT NOT NULL CONSTRAINT PK_Job PRIMARY KEY CLUSTERED, - [JobType] TINYINT NOT NULL, - [StartTime] DATETIMEOFFSET NOT NULL, - [EndTime] DATETIMEOFFSET NULL, - [Status] TINYINT NOT NULL, - [CreationDate] DATETIMEOFFSET NOT NULL, - [DCJobId] BIGINT NULL, - [Ukprn] BIGINT NULL, - [IlrSubmissionTime] DATETIME NULL, - [LearnerCount] INT NULL, - [AcademicYear] SMALLINT NOT NULL, - [CollectionPeriod] TINYINT NOT NULL, - [DataLocksCompletionTime] DATETIMEOFFSET NULL, - [DCJobSucceeded] BIT NULL, - [DCJobEndTime] DATETIMEOFFSET NULL -) -GO - -CREATE INDEX [IX_Job__Search] ON [Payments2].[Job] -( - [JobId], - [JobType], - [DCJobId], - [Ukprn], - [Status], - [StartTime], - [EndTime], - [DataLocksCompletionTime], - [DCJobSucceeded], - [DCJobEndTime] -) -WITH (ONLINE = ON) -GO - -CREATE INDEX [IX_Payments2_Job__IlrSubmissionTime] ON Payments2.Job -( - [IlrSubmissionTime] -) -WITH (ONLINE = ON) -GO - -CREATE NONCLUSTERED INDEX [IX_Payments2_Job_Search] ON [Payments2].[Job] -( - [DCJobId], - [AcademicYear], - [DCJobSucceeded], - [JobType], - [Status] -) -INCLUDE -( - [IlrSubmissionTime], - [Ukprn] -) -WITH (ONLINE = ON) -GO diff --git a/src/SFA.DAS.Payments.Audit.Database/Payments2/Tables/Payments2.LevyAccount.sql b/src/SFA.DAS.Payments.Audit.Database/Payments2/Tables/Payments2.LevyAccount.sql deleted file mode 100644 index 6e062531b..000000000 --- a/src/SFA.DAS.Payments.Audit.Database/Payments2/Tables/Payments2.LevyAccount.sql +++ /dev/null @@ -1,8 +0,0 @@ -CREATE TABLE [Payments2].[LevyAccount] -( - [AccountId] BIGINT NOT NULL CONSTRAINT PK_LevyAccount PRIMARY KEY CLUSTERED, - [AccountName] VARCHAR(255) NOT NULL, - [Balance] DECIMAL(18, 4) NOT NULL, - [IsLevyPayer] BIT NOT NULL, - [TransferAllowance] DECIMAL(18, 4) NOT NULL -) diff --git a/src/SFA.DAS.Payments.Audit.Database/Payments2/Tables/Payments2.LevyAccountAudit.sql b/src/SFA.DAS.Payments.Audit.Database/Payments2/Tables/Payments2.LevyAccountAudit.sql deleted file mode 100644 index 15d014131..000000000 --- a/src/SFA.DAS.Payments.Audit.Database/Payments2/Tables/Payments2.LevyAccountAudit.sql +++ /dev/null @@ -1,13 +0,0 @@ -CREATE TABLE [Payments2].[LevyAccountAudit] -( - [Id] BIGINT NOT NULL CONSTRAINT PK_LevyAccountAudit PRIMARY KEY CLUSTERED, - [AccountId] BIGINT NOT NULL, - [AcademicYear] SMALLINT NOT NULL, - [CollectionPeriod] TINYINT NOT NULL, - [SourceLevyAccountBalance] DECIMAL(18, 4) NOT NULL, - [AdjustedLevyAccountBalance] DECIMAL(18, 4) NOT NULL, - [SourceTransferAllowance] DECIMAL(18, 4) NOT NULL, - [AdjustedTransferAllowance] DECIMAL(18, 4) NOT NULL, - [IsLevyPayer] BIT NOT NULL, - [CreationDate] DATETIMEOFFSET NOT NULL -) diff --git a/src/SFA.DAS.Payments.Audit.Database/Payments2/Tables/Payments2.Payment.sql b/src/SFA.DAS.Payments.Audit.Database/Payments2/Tables/Payments2.Payment.sql deleted file mode 100644 index e4667ec42..000000000 --- a/src/SFA.DAS.Payments.Audit.Database/Payments2/Tables/Payments2.Payment.sql +++ /dev/null @@ -1,59 +0,0 @@ -CREATE TABLE [Payments2].[Payment] -( - Id BIGINT NOT NULL IDENTITY(1,1) CONSTRAINT PK_Payment PRIMARY KEY, - EventId UNIQUEIDENTIFIER NOT NULL, - EarningEventId UNIQUEIDENTIFIER NOT NULL, - FundingSourceEventId UNIQUEIDENTIFIER NOT NULL, - RequiredPaymentEventId UNIQUEIDENTIFIER NULL, - ClawbackSourcePaymentEventId UNIQUEIDENTIFIER NULL, - EventTime DATETIMEOFFSET NOT NULL, - JobId BIGINT NOT NULL, - DeliveryPeriod TINYINT NOT NULL, - CollectionPeriod TINYINT NOT NULL, - AcademicYear SMALLINT, - Ukprn BIGINT NOT NULL, - LearnerReferenceNumber NVARCHAR(50) NOT NULL, - LearnerUln BIGINT NOT NULL, - PriceEpisodeIdentifier NVARCHAR(50) NOT NULL, - Amount DECIMAL(15,5) NOT NULL, - LearningAimReference NVARCHAR(8) NOT NULL, - LearningAimProgrammeType INT NOT NULL , - LearningAimStandardCode INT NOT NULL, - LearningAimFrameworkCode INT NOT NULL, - LearningAimPathwayCode INT NOT NULL, - LearningAimFundingLineType NVARCHAR(100) NOT NULL, - ContractType TINYINT NOT NULL, - TransactionType TINYINT NOT NULL, - FundingSource TINYINT NOT NULL, - IlrSubmissionDateTime DATETIME2 NOT NULL, - SfaContributionPercentage DECIMAL(15,5) NOT NULL, - AgreementId NVARCHAR(255) NULL, - AccountId BIGINT NULL , - TransferSenderAccountId BIGINT NULL , - CreationDate DATETIMEOFFSET NOT NULL, - EarningsStartDate DATETIME NOT NULL, - EarningsPlannedEndDate DATETIME NULL, - EarningsActualEndDate DATETIME NULL, - EarningsCompletionStatus TINYINT NULL, - EarningsCompletionAmount DECIMAL (15,5) NULL, - EarningsInstalmentAmount DECIMAL (15,5) NULL, - EarningsNumberOfInstalments SMALLINT NULL, - LearningStartDate DATETIME2 NULL, - ApprenticeshipId BIGINT NULL, - ApprenticeshipPriceEpisodeId BIGINT NULL, - ApprenticeshipEmployerType TINYINT NULL, - ReportingAimFundingLineType NVARCHAR(120) NULL, - NonPaymentReason TINYINT NULL, - DuplicateNumber INT NULL, - LearningAimSequenceNumber BIGINT NULL -) -GO - -CREATE NONCLUSTERED INDEX [IX_Payment__AuditDataFactory] ON [Payments2].[Payment] -( - [AcademicYear], - [CollectionPeriod], - [EventId] -) -WITH (ONLINE = ON) -GO diff --git a/src/SFA.DAS.Payments.Audit.Database/Payments2/Tables/Payments2.ProviderAdjustmentPayments.sql b/src/SFA.DAS.Payments.Audit.Database/Payments2/Tables/Payments2.ProviderAdjustmentPayments.sql deleted file mode 100644 index 876cc1211..000000000 --- a/src/SFA.DAS.Payments.Audit.Database/Payments2/Tables/Payments2.ProviderAdjustmentPayments.sql +++ /dev/null @@ -1,22 +0,0 @@ -CREATE TABLE [Payments2].[ProviderAdjustmentPayments] -( - [Ukprn] [bigint] NOT NULL, - [SubmissionId] [uniqueidentifier] NOT NULL, - [SubmissionCollectionPeriod] [int] NOT NULL, - [SubmissionAcademicYear] [int] NOT NULL, - [PaymentType] [int] NOT NULL, - [PaymentTypeName] [nvarchar](250) NOT NULL, - [Amount] [decimal](15, 5) NOT NULL, - [CollectionPeriodName] [varchar](8) NOT NULL, - [CollectionPeriodMonth] [int] NOT NULL, - [CollectionPeriodYear] [int] NOT NULL, - PRIMARY KEY CLUSTERED - ( - [Ukprn] ASC, - [SubmissionId] ASC, - [SubmissionCollectionPeriod] ASC, - [SubmissionAcademicYear] ASC, - [PaymentType] ASC, - [CollectionPeriodName] ASC - ) -) diff --git a/src/SFA.DAS.Payments.Audit.Database/Payments2/Tables/Payments2.RequiredPaymentEvent.sql b/src/SFA.DAS.Payments.Audit.Database/Payments2/Tables/Payments2.RequiredPaymentEvent.sql deleted file mode 100644 index 50e4ba3c8..000000000 --- a/src/SFA.DAS.Payments.Audit.Database/Payments2/Tables/Payments2.RequiredPaymentEvent.sql +++ /dev/null @@ -1,55 +0,0 @@ -CREATE TABLE [Payments2].[RequiredPaymentEvent] -( - Id BIGINT NOT NULL IDENTITY(1,1) CONSTRAINT PK_RequiredPaymentEvent PRIMARY KEY CLUSTERED, - EventId UNIQUEIDENTIFIER NOT NULL, - EarningEventId UNIQUEIDENTIFIER NOT NULL, - ClawbackSourcePaymentEventId UNIQUEIDENTIFIER NULL, - PriceEpisodeIdentifier NVARCHAR(50) NOT NULL, - Ukprn BIGINT NOT NULL, - ContractType TINYINT NOT NULL, - TransactionType TINYINT NOT NULL, - SfaContributionPercentage DECIMAL(15,5) NOT NULL, - Amount DECIMAL(15,5) NOT NULL, - CollectionPeriod TINYINT NOT NULL, - AcademicYear SMALLINT NOT NULL, - DeliveryPeriod TINYINT NOT NULL, - LearnerReferenceNumber NVARCHAR(50) NOT NULL, - LearnerUln BIGINT NOT NULL, - LearningAimReference NVARCHAR(8) NOT NULL, - LearningAimProgrammeType INT NOT NULL , - LearningAimStandardCode INT NOT NULL, - LearningAimFrameworkCode INT NOT NULL, - LearningAimPathwayCode INT NOT NULL, - LearningAimFundingLineType NVARCHAR(100) NOT NULL, - AgreementId NVARCHAR(255) NULL, - IlrSubmissionDateTime DATETIME2 NOT NULL, - JobId BIGINT NOT NULL, - EventTime DATETIMEOFFSET NOT NULL, - AccountId BIGINT NULL , - TransferSenderAccountId BIGINT NULL , - CreationDate DATETIMEOFFSET NOT NULL, - EarningsStartDate DATETIME NOT NULL, - EarningsPlannedEndDate DATETIME NULL, - EarningsActualEndDate DATETIME NULL, - EarningsCompletionStatus TINYINT NOT NULL, - EarningsCompletionAmount DECIMAL (15,5), - EarningsInstalmentAmount DECIMAL (15,5), - EarningsNumberOfInstalments SMALLINT NOT NULL, - LearningStartDate DATETIME2 NULL, - ApprenticeshipId BIGINT NULL, - ApprenticeshipPriceEpisodeId BIGINT NULL, - ApprenticeshipEmployerType TINYINT NULL, - NonPaymentReason TINYINT NULL, - EventType NVARCHAR(4000) NULL, - DuplicateNumber INT NULL -) -GO - -CREATE NONCLUSTERED INDEX [IX_RequiredPaymentEvent__AuditDataFactory] ON [Payments2].[RequiredPaymentEvent] -( - [AcademicYear], - [CollectionPeriod], - [EventId] -) -WITH (ONLINE = ON) -GO diff --git a/src/SFA.DAS.Payments.Audit.Database/Payments2/Views/Payments2.DataMatchReport.sql b/src/SFA.DAS.Payments.Audit.Database/Payments2/Views/Payments2.DataMatchReport.sql deleted file mode 100644 index 1b3f29765..000000000 --- a/src/SFA.DAS.Payments.Audit.Database/Payments2/Views/Payments2.DataMatchReport.sql +++ /dev/null @@ -1,24 +0,0 @@ -CREATE VIEW [Payments2].[DataMatchReport] -AS - -SELECT (CASE WHEN Dle.Datalocksourceid = 1 THEN 'ILR' ELSE 'DAS_PE' END) AS Collectiontype - , Dle.Ukprn - , Dle.Learnerreferencenumber - , Dle.Learneruln - , Dlenppf.Datalockfailureid - , Ee.Learningaimsequencenumber - , Dle.Collectionperiod - , Dle.Academicyear - , Dle.Ilrsubmissiondatetime - , Dlenpp.Deliveryperiod - , Dle.Datalocksourceid - , Dle.Ispayable - , Dle.Learningaimreference - , Dle.Jobid -FROM Payments2.Datalockevent AS Dle WITH (NOLOCK) -INNER JOIN Payments2.Earningevent AS Ee WITH (NOLOCK) ON Dle.Earningeventid = Ee.Eventid -INNER JOIN Payments2.Datalockeventnonpayableperiod AS Dlenpp WITH (NOLOCK) ON Dle.Eventid = Dlenpp.Datalockeventid -INNER JOIN Payments2.Datalockeventnonpayableperiodfailures AS Dlenppf WITH (NOLOCK) ON Dlenpp.Datalockeventnonpayableperiodid = Dlenppf.Datalockeventnonpayableperiodid -INNER JOIN Payments2.Latestsuccessfuldatalockjobs Lsj WITH (NOLOCK) ON Dle.Jobid = Lsj.Dcjobid -WHERE Dle.Ispayable = 0 - AND Dle.Learningaimreference = 'ZPROG001' \ No newline at end of file diff --git a/src/SFA.DAS.Payments.Audit.Database/Payments2/Views/Payments2.LatestSuccessfulDataLockJobs.sql b/src/SFA.DAS.Payments.Audit.Database/Payments2/Views/Payments2.LatestSuccessfulDataLockJobs.sql deleted file mode 100644 index ebf34b6e4..000000000 --- a/src/SFA.DAS.Payments.Audit.Database/Payments2/Views/Payments2.LatestSuccessfulDataLockJobs.sql +++ /dev/null @@ -1,17 +0,0 @@ -CREATE VIEW [Payments2].[LatestSuccessfulDataLockJobs] AS - -WITH Validjobs AS - ( - SELECT max(Ilrsubmissiontime) [IlrSubmissionTime], Ukprn, AcademicYear - FROM Payments2.Job - WHERE Status IN (1, 2, 3) - AND Dcjobsucceeded = 1 - AND Jobtype = 1 - GROUP BY Ukprn, AcademicYear - ) -SELECT J.* -FROM Payments2.Job AS J -JOIN Validjobs AS Vj - ON J.Ilrsubmissiontime = Vj.Ilrsubmissiontime - AND J.Ukprn = Vj.Ukprn - AND J.AcademicYear = VJ.AcademicYear diff --git a/src/SFA.DAS.Payments.Audit.Database/Payments2/Views/Payments2.LatestSuccessfulJobs.sql b/src/SFA.DAS.Payments.Audit.Database/Payments2/Views/Payments2.LatestSuccessfulJobs.sql deleted file mode 100644 index fdcb830a5..000000000 --- a/src/SFA.DAS.Payments.Audit.Database/Payments2/Views/Payments2.LatestSuccessfulJobs.sql +++ /dev/null @@ -1,17 +0,0 @@ -CREATE VIEW [Payments2].[LatestSuccessfulJobs] -AS - -WITH validJobs AS ( - SELECT MAX(IlrSubmissionTime) AS IlrSubmissionTime, Ukprn, AcademicYear - FROM Payments2.Job - WHERE (Status IN (2, 3)) - AND (DCJobSucceeded = 1) - AND (JobType = 1) - GROUP BY Ukprn, AcademicYear) - SELECT j.* - FROM Payments2.Job AS j - INNER JOIN validJobs AS vj - ON j.IlrSubmissionTime = vj.IlrSubmissionTime - AND j.Ukprn = vj.Ukprn - AND j.AcademicYear = vj.AcademicYear - diff --git a/src/SFA.DAS.Payments.Audit.Database/SFA.DAS.Payments.Audit.Database.sqlproj b/src/SFA.DAS.Payments.Audit.Database/SFA.DAS.Payments.Audit.Database.sqlproj deleted file mode 100644 index ce1c4e4ee..000000000 --- a/src/SFA.DAS.Payments.Audit.Database/SFA.DAS.Payments.Audit.Database.sqlproj +++ /dev/null @@ -1,135 +0,0 @@ - - - - - Debug - AnyCPU - SFA.DAS.Payments.Audit.Database - 2.0 - 4.1 - {ec15fdba-cca7-4245-93b1-04506a09baba} - Microsoft.Data.Tools.Schema.Sql.SqlAzureV12DatabaseSchemaProvider - Database - - - SFA.DAS.Payments.Audit.Database - SFA.DAS.Payments.Audit.Database - 1033, CI - BySchemaAndSchemaType - True - v4.7.1 - CS - Properties - False - True - True - Payments2 - True - SIMPLE - SFA.DAS.Payments - True - - - bin\Release\ - $(MSBuildProjectName).sql - False - pdbonly - true - false - true - prompt - 4 - - - bin\Debug\ - $(MSBuildProjectName).sql - false - true - full - false - true - true - prompt - 4 - - - 11.0 - - True - 11.0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Local Machine - $(SqlCmdVar__4) - - - X.Y.Z-LocalDev - $(SqlCmdVar__3) - - - NotUsedLocally!!! - $(SqlCmdVar__6) - - - From Local Machine - $(SqlCmdVar__5) - - - NotUsedLocally! - $(SqlCmdVar__1) - - - NotUsedLocally!! - $(SqlCmdVar__2) - - - - - - \ No newline at end of file diff --git a/src/SFA.DAS.Payments.Audit.Database/Security/RoleMemberships.sql b/src/SFA.DAS.Payments.Audit.Database/Security/RoleMemberships.sql deleted file mode 100644 index 512fb1c7a..000000000 --- a/src/SFA.DAS.Payments.Audit.Database/Security/RoleMemberships.sql +++ /dev/null @@ -1,7 +0,0 @@ - -GO -ALTER ROLE [DataViewer] ADD MEMBER [DASPaymentAuditROUser]; -GO -ALTER ROLE [DataProcessing] ADD MEMBER [DASPaymentAuditRWUser]; -GO - diff --git a/src/SFA.DAS.Payments.Audit.Database/Security/Role_DataProcessing.sql b/src/SFA.DAS.Payments.Audit.Database/Security/Role_DataProcessing.sql deleted file mode 100644 index 4c0c7e4e2..000000000 --- a/src/SFA.DAS.Payments.Audit.Database/Security/Role_DataProcessing.sql +++ /dev/null @@ -1,17 +0,0 @@ - -CREATE ROLE [DataProcessing] AUTHORIZATION [dbo] -GO - --- Grant access rights to a specific schema in the database -GRANT - DELETE, - EXECUTE, - INSERT, - REFERENCES, - SELECT, - UPDATE, - ALTER, - VIEW DEFINITION -ON SCHEMA::[Payments2] - TO [DataProcessing] -GO diff --git a/src/SFA.DAS.Payments.Audit.Database/Security/Role_DataViewer.sql b/src/SFA.DAS.Payments.Audit.Database/Security/Role_DataViewer.sql deleted file mode 100644 index dd75cc594..000000000 --- a/src/SFA.DAS.Payments.Audit.Database/Security/Role_DataViewer.sql +++ /dev/null @@ -1,12 +0,0 @@ - -CREATE ROLE [DataViewer] AUTHORIZATION [dbo] -GO - --- Grant access rights to a specific schema in the database -GRANT - REFERENCES, - SELECT, - VIEW DEFINITION -ON SCHEMA::[Payments2] - TO [DataViewer] -GO \ No newline at end of file diff --git a/src/SFA.DAS.Payments.Audit.Database/Security/Schema_Payments2.sql b/src/SFA.DAS.Payments.Audit.Database/Security/Schema_Payments2.sql deleted file mode 100644 index 093cfad97..000000000 --- a/src/SFA.DAS.Payments.Audit.Database/Security/Schema_Payments2.sql +++ /dev/null @@ -1,7 +0,0 @@ -CREATE SCHEMA [Payments2] - AUTHORIZATION [dbo]; - - - - - diff --git a/src/SFA.DAS.Payments.Audit.Database/Security/User_RO.sql b/src/SFA.DAS.Payments.Audit.Database/Security/User_RO.sql deleted file mode 100644 index 73a849ab0..000000000 --- a/src/SFA.DAS.Payments.Audit.Database/Security/User_RO.sql +++ /dev/null @@ -1,7 +0,0 @@ -CREATE USER [DASPaymentAuditROUser] - WITH PASSWORD = N'$(AuditROUserPassword)'; -GO -GRANT CONNECT TO [DASPaymentAuditROUser] -GO - - diff --git a/src/SFA.DAS.Payments.Audit.Database/Security/User_RW.sql b/src/SFA.DAS.Payments.Audit.Database/Security/User_RW.sql deleted file mode 100644 index b724f2584..000000000 --- a/src/SFA.DAS.Payments.Audit.Database/Security/User_RW.sql +++ /dev/null @@ -1,7 +0,0 @@ -CREATE USER [DASPaymentAuditRWUser] - WITH PASSWORD = N'$(AuditRWUserPassword)'; -GO -GRANT CONNECT TO [DASPaymentAuditRWUser] -GO - - diff --git a/src/SFA.DAS.Payments.Audit.Database/dbo/Stored Procedures/dbo.usp_DisplayDeploymentProperties.sql b/src/SFA.DAS.Payments.Audit.Database/dbo/Stored Procedures/dbo.usp_DisplayDeploymentProperties.sql deleted file mode 100644 index 5df43a8dc..000000000 --- a/src/SFA.DAS.Payments.Audit.Database/dbo/Stored Procedures/dbo.usp_DisplayDeploymentProperties.sql +++ /dev/null @@ -1,48 +0,0 @@ -CREATE PROCEDURE [dbo].[usp_DisplayDeploymentProperties] -AS -BEGIN - SET NOCOUNT ON; - - BEGIN TRY - --- Core Tables - EXEC ('SELECT name, value FROM fn_listextendedproperty(default, default, default, default, default, default, default);') - - RETURN 0; - - END TRY --- --------------------------------------------------------------------------------------- --- Handle any problems --------------------------------------------------------------------------------------- --- - BEGIN CATCH - - DECLARE @ErrorMessage NVARCHAR(4000) - , @ErrorSeverity INT - , @ErrorState INT - , @ErrorNumber INT - - SELECT @ErrorNumber = ERROR_NUMBER() - , @ErrorMessage = 'Error in :' + ISNULL(OBJECT_NAME(@@PROCID),'') + ' - Error was :' + ERROR_MESSAGE() - , @ErrorSeverity = ERROR_SEVERITY() - , @ErrorState = ERROR_STATE(); - - RAISERROR ( - @ErrorMessage -- Message text. - , @ErrorSeverity -- Severity. - , @ErrorState -- State. - ); - - RETURN @ErrorNumber; - - END CATCH --- --------------------------------------------------------------------------------------- --- All done --------------------------------------------------------------------------------------- --- -END -GO -GRANT EXECUTE ON [dbo].[usp_DisplayDeploymentProperties] TO [DataViewer]; -GO \ No newline at end of file diff --git a/src/SFA.DAS.Payments.Audit.Database/zzz.Script.PostDeployment.sql b/src/SFA.DAS.Payments.Audit.Database/zzz.Script.PostDeployment.sql deleted file mode 100644 index c9f855f7c..000000000 --- a/src/SFA.DAS.Payments.Audit.Database/zzz.Script.PostDeployment.sql +++ /dev/null @@ -1,62 +0,0 @@ -/* --------------------------------------------------------------------------------------- -Post-Deployment Script --------------------------------------------------------------------------------------- -*/ - -SET NOCOUNT ON; -GO - -RAISERROR(' Extended Property',10,1) WITH NOWAIT; -GO - -RAISERROR(' %s - %s',10,1,'BuildNumber','$(BUILD_BUILDNUMBER)') WITH NOWAIT; -IF NOT EXISTS (SELECT name, value FROM fn_listextendedproperty('BuildNumber', default, default, default, default, default, default)) - EXEC sp_addextendedproperty @name = N'BuildNumber', @value = '$(BUILD_BUILDNUMBER)'; -ELSE - EXEC sp_updateextendedproperty @name = N'BuildNumber', @value = '$(BUILD_BUILDNUMBER)'; - -GO - -RAISERROR(' %s - %s',10,1,'BuildBranch','$(BUILD_BRANCHNAME)') WITH NOWAIT; -IF NOT EXISTS (SELECT name, value FROM fn_listextendedproperty('BuildBranch', default, default, default, default, default, default)) - EXEC sp_addextendedproperty @name = N'BuildBranch', @value = '$(BUILD_BRANCHNAME)'; -ELSE - EXEC sp_updateextendedproperty @name = N'BuildBranch', @value = '$(BUILD_BRANCHNAME)'; -GO - -DECLARE @DeploymentTime VARCHAR(35) = CONVERT(VARCHAR(35),GETUTCDATE(),113); -RAISERROR(' %s - %s',10,1,'DeploymentDatetime',@DeploymentTime) WITH NOWAIT; -IF NOT EXISTS (SELECT name, value FROM fn_listextendedproperty('DeploymentDatetime', default, default, default, default, default, default)) - EXEC sp_addextendedproperty @name = N'DeploymentDatetime', @value = @DeploymentTime; -ELSE - EXEC sp_updateextendedproperty @name = N'DeploymentDatetime', @value = @DeploymentTime; -GO - -RAISERROR(' %s - %s',10,1,'ReleaseName','$(RELEASE_RELEASENAME)') WITH NOWAIT; -IF NOT EXISTS (SELECT name, value FROM fn_listextendedproperty('ReleaseName', default, default, default, default, default, default)) - EXEC sp_addextendedproperty @name = N'ReleaseName', @value = '$(RELEASE_RELEASENAME)'; -ELSE - EXEC sp_updateextendedproperty @name = N'ReleaseName', @value = '$(BUILD_BRANCHNAME)'; -GO - -RAISERROR(' Drop DisplayDeploymentProperties View.',10,1,'ReleaseName','$(RELEASE_RELEASENAME)') WITH NOWAIT; -IF EXISTS (SELECT * FROM [sys].[objects] WHERE [type] = 'V' AND Name = 'DisplayDeploymentProperties_VW') -BEGIN - DROP VIEW [dbo].[DisplayDeploymentProperties_VW]; -END -GO - -RAISERROR(' Update User Account Passwords',10,1) WITH NOWAIT; -GO - -RAISERROR(' RO User',10,1) WITH NOWAIT; -ALTER USER [DASPaymentAuditROUser] WITH PASSWORD = N'$(AuditROUserPassword)'; -GO - -RAISERROR(' RW User',10,1) WITH NOWAIT; -ALTER USER [DASPaymentAuditRWUser] WITH PASSWORD = N'$(AuditRWUserPassword)'; -GO - -RAISERROR('Completed',10,1) WITH NOWAIT; -GO \ No newline at end of file diff --git a/src/SFA.DAS.Payments.Database.Legacy.Payments/Payments.sql b/src/SFA.DAS.Payments.Database.Legacy.Payments/Payments.sql deleted file mode 100644 index fccf71cbd..000000000 --- a/src/SFA.DAS.Payments.Database.Legacy.Payments/Payments.sql +++ /dev/null @@ -1 +0,0 @@ -CREATE SCHEMA [Payments] diff --git a/src/SFA.DAS.Payments.Database.Legacy.Payments/Payments/Payments.sql b/src/SFA.DAS.Payments.Database.Legacy.Payments/Payments/Payments.sql deleted file mode 100644 index 22c6704ad..000000000 --- a/src/SFA.DAS.Payments.Database.Legacy.Payments/Payments/Payments.sql +++ /dev/null @@ -1,20 +0,0 @@ -CREATE TABLE [Payments].[Payments] -( - [PaymentId] [uniqueidentifier] NOT NULL PRIMARY KEY, - [RequiredPaymentId] [uniqueidentifier] NOT NULL, - [DeliveryMonth] [int] NOT NULL, - [DeliveryYear] [int] NOT NULL, - [CollectionPeriodName] [varchar](8) NOT NULL, - [CollectionPeriodMonth] [int] NOT NULL, - [CollectionPeriodYear] [int] NOT NULL, - [FundingSource] [int] NOT NULL, - [TransactionType] [int] NOT NULL, - [Amount] [decimal](15, 5) NULL, -) - -GO - - -ALTER TABLE [Payments].[Payments] ADD DEFAULT (newid()) FOR [PaymentId] -GO - diff --git a/src/SFA.DAS.Payments.Database.Legacy.Payments/Payments/Periods.sql b/src/SFA.DAS.Payments.Database.Legacy.Payments/Payments/Periods.sql deleted file mode 100644 index f0b6bbcd6..000000000 --- a/src/SFA.DAS.Payments.Database.Legacy.Payments/Payments/Periods.sql +++ /dev/null @@ -1,12 +0,0 @@ -CREATE TABLE [Payments].[Periods]( - [PeriodName] [char](8) NOT NULL, - [CalendarMonth] [int] NOT NULL, - [CalendarYear] [int] NOT NULL, - [AccountDataValidAt] [datetime] NULL, - [CommitmentDataValidAt] [datetime] NULL, - [CompletionDateTime] [datetime] NOT NULL, -PRIMARY KEY CLUSTERED -( - [PeriodName] ASC -) -) \ No newline at end of file diff --git a/src/SFA.DAS.Payments.Database.Legacy.Payments/PaymentsDue.sql b/src/SFA.DAS.Payments.Database.Legacy.Payments/PaymentsDue.sql deleted file mode 100644 index ceea35110..000000000 --- a/src/SFA.DAS.Payments.Database.Legacy.Payments/PaymentsDue.sql +++ /dev/null @@ -1 +0,0 @@ -CREATE SCHEMA [PaymentsDue] diff --git a/src/SFA.DAS.Payments.Database.Legacy.Payments/PaymentsDue/Earnings.sql b/src/SFA.DAS.Payments.Database.Legacy.Payments/PaymentsDue/Earnings.sql deleted file mode 100644 index 9380e3fe2..000000000 --- a/src/SFA.DAS.Payments.Database.Legacy.Payments/PaymentsDue/Earnings.sql +++ /dev/null @@ -1,11 +0,0 @@ -CREATE TABLE [PaymentsDue].[Earnings]( - [RequiredPaymentId] [uniqueidentifier] NOT NULL, - [StartDate] [datetime] NOT NULL, - [PlannedEndDate] [datetime] NOT NULL, - [ActualEnddate] [datetime] NULL, - [CompletionStatus] [int] NULL, - [CompletionAmount] [decimal](15, 5) NULL, - [MonthlyInstallment] [decimal](15, 5) NOT NULL, - [TotalInstallments] [int] NOT NULL, - [EndpointAssessorId] [varchar](7) NULL -) \ No newline at end of file diff --git a/src/SFA.DAS.Payments.Database.Legacy.Payments/PaymentsDue/RequiredPayments.sql b/src/SFA.DAS.Payments.Database.Legacy.Payments/PaymentsDue/RequiredPayments.sql deleted file mode 100644 index ba289defc..000000000 --- a/src/SFA.DAS.Payments.Database.Legacy.Payments/PaymentsDue/RequiredPayments.sql +++ /dev/null @@ -1,35 +0,0 @@ -CREATE TABLE [PaymentsDue].[RequiredPayments] -( - [Id] [uniqueidentifier] NOT NULL, - [CommitmentId] [bigint] NULL, - [CommitmentVersionId] [varchar](25) NULL, - [AccountId] [bigint] NULL, - [AccountVersionId] [varchar](50) NULL, - [Uln] [bigint] NULL, - [LearnRefNumber] [varchar](12) NULL, - [AimSeqNumber] [int] NULL, - [Ukprn] [bigint] NULL, - [IlrSubmissionDateTime] [datetime] NULL, - [PriceEpisodeIdentifier] [varchar](25) NULL, - [StandardCode] [bigint] NULL, - [ProgrammeType] [int] NULL, - [FrameworkCode] [int] NULL, - [PathwayCode] [int] NULL, - [ApprenticeshipContractType] [int] NULL, - [DeliveryMonth] [int] NULL, - [DeliveryYear] [int] NULL, - [CollectionPeriodName] [varchar](8) NOT NULL, - [CollectionPeriodMonth] [int] NOT NULL, - [CollectionPeriodYear] [int] NOT NULL, - [TransactionType] [int] NULL, - [AmountDue] [decimal](15, 5) NULL, - [SfaContributionPercentage] [decimal](15, 5) NULL, - [FundingLineType] [varchar](100) NULL, - [UseLevyBalance] [bit] NULL, - [LearnAimRef] [varchar](8) NULL, - [LearningStartDate] [datetime] NULL, -) -GO - -ALTER TABLE [PaymentsDue].[RequiredPayments] ADD DEFAULT (newid()) FOR [Id] -GO \ No newline at end of file diff --git a/src/SFA.DAS.Payments.Database.Legacy.Payments/SFA.DAS.Payments.Database.Legacy.Payments.sqlproj b/src/SFA.DAS.Payments.Database.Legacy.Payments/SFA.DAS.Payments.Database.Legacy.Payments.sqlproj deleted file mode 100644 index a8f507231..000000000 --- a/src/SFA.DAS.Payments.Database.Legacy.Payments/SFA.DAS.Payments.Database.Legacy.Payments.sqlproj +++ /dev/null @@ -1,73 +0,0 @@ - - - - Debug - AnyCPU - SFA.DAS.Payments.Database.Legacy.Payments - 2.0 - 4.1 - {f8dc3227-6a79-44d5-89d8-6ace0b8fcb37} - Microsoft.Data.Tools.Schema.Sql.SqlAzureV12DatabaseSchemaProvider - Database - - - SFA.DAS.Payments.Database.Legacy.Payments - SFA.DAS.Payments.Database.Legacy.Payments - 1033, CI - BySchemaAndSchemaType - True - v4.5 - CS - Properties - False - True - True - - - bin\Release\ - $(MSBuildProjectName).sql - False - pdbonly - true - false - true - prompt - 4 - - - bin\Debug\ - $(MSBuildProjectName).sql - false - true - full - false - true - true - prompt - 4 - - - 11.0 - - True - 11.0 - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/SFA.DAS.Payments.Database.Legacy.Payments/TransferPayments.sql b/src/SFA.DAS.Payments.Database.Legacy.Payments/TransferPayments.sql deleted file mode 100644 index ca68509c7..000000000 --- a/src/SFA.DAS.Payments.Database.Legacy.Payments/TransferPayments.sql +++ /dev/null @@ -1 +0,0 @@ -CREATE SCHEMA [TransferPayments] diff --git a/src/SFA.DAS.Payments.Database.Legacy.Payments/TransferPayments/AccountTransfers.sql b/src/SFA.DAS.Payments.Database.Legacy.Payments/TransferPayments/AccountTransfers.sql deleted file mode 100644 index e05139fef..000000000 --- a/src/SFA.DAS.Payments.Database.Legacy.Payments/TransferPayments/AccountTransfers.sql +++ /dev/null @@ -1,15 +0,0 @@ -CREATE TABLE TransferPayments.AccountTransfers - ( - TransferId bigint PRIMARY KEY identity(1,1), - SendingAccountId bigint NOT NULL, - ReceivingAccountId bigint NOT NULL, - RequiredPaymentId uniqueidentifier NOT NULL, - CommitmentId bigint NOT NULL, - Amount decimal(15,5) NOT NULL, - TransferType int NOT NULL, - CollectionPeriodName varchar(8) NOT NULL, - CollectionPeriodMonth int NOT NULL, - CollectionPeriodYear int NOT NULL - ) - GO - CREATE INDEX IX_TransferPayments_AccountTransfers_RequiredPaymentId ON TransferPayments.AccountTransfers (RequiredPaymentId) \ No newline at end of file diff --git a/src/SFA.DAS.Payments.Database.Legacy/DataLock/DataLock.sql b/src/SFA.DAS.Payments.Database.Legacy/DataLock/DataLock.sql deleted file mode 100644 index 63d49776f..000000000 --- a/src/SFA.DAS.Payments.Database.Legacy/DataLock/DataLock.sql +++ /dev/null @@ -1 +0,0 @@ -CREATE SCHEMA [DataLock] diff --git a/src/SFA.DAS.Payments.Database.Legacy/DataLock/DataLockEventCommitmentVersions.sql b/src/SFA.DAS.Payments.Database.Legacy/DataLock/DataLockEventCommitmentVersions.sql deleted file mode 100644 index 396e0d7cc..000000000 --- a/src/SFA.DAS.Payments.Database.Legacy/DataLock/DataLockEventCommitmentVersions.sql +++ /dev/null @@ -1,12 +0,0 @@ -CREATE TABLE [DataLock].[DataLockEventCommitmentVersions] -( - DataLockEventId uniqueidentifier NOT NULL, - CommitmentVersion VARCHAR(25) NOT NULL, - CommitmentStartDate date NOT NULL, - CommitmentStandardCode bigint NULL, - CommitmentProgrammeType int NULL, - CommitmentFrameworkCode int NULL, - CommitmentPathwayCode int NULL, - CommitmentNegotiatedPrice decimal(12,5) NOT NULL, - CommitmentEffectiveDate date NOT NULL -) diff --git a/src/SFA.DAS.Payments.Database.Legacy/DataLock/DataLockEventErrors.sql b/src/SFA.DAS.Payments.Database.Legacy/DataLock/DataLockEventErrors.sql deleted file mode 100644 index 8540dc9c6..000000000 --- a/src/SFA.DAS.Payments.Database.Legacy/DataLock/DataLockEventErrors.sql +++ /dev/null @@ -1,7 +0,0 @@ -CREATE TABLE [DataLock].[DataLockEventErrors] -( - DataLockEventId uniqueidentifier NOT NULL, - ErrorCode varchar(15) NOT NULL, - SystemDescription nvarchar(255) NOT NULL, - PRIMARY KEY (DataLockEventId, ErrorCode) -) diff --git a/src/SFA.DAS.Payments.Database.Legacy/DataLock/DataLockEventPeriods.sql b/src/SFA.DAS.Payments.Database.Legacy/DataLock/DataLockEventPeriods.sql deleted file mode 100644 index 654f0056a..000000000 --- a/src/SFA.DAS.Payments.Database.Legacy/DataLock/DataLockEventPeriods.sql +++ /dev/null @@ -1,11 +0,0 @@ -CREATE TABLE [DataLock].[DataLockEventPeriods] -( - DataLockEventId uniqueidentifier NOT NULL, - CollectionPeriodName varchar(8) NOT NULL, - CollectionPeriodMonth int NOT NULL, - CollectionPeriodYear int NOT NULL, - CommitmentVersion VARCHAR(25) NOT NULL, - IsPayable bit NOT NULL, - TransactionType int NOT NULL, - [TransactionTypesFlag] INT NULL -) diff --git a/src/SFA.DAS.Payments.Database.Legacy/DataLock/DataLockEvents.sql b/src/SFA.DAS.Payments.Database.Legacy/DataLock/DataLockEvents.sql deleted file mode 100644 index 8b0b73c00..000000000 --- a/src/SFA.DAS.Payments.Database.Legacy/DataLock/DataLockEvents.sql +++ /dev/null @@ -1,28 +0,0 @@ -CREATE TABLE [DataLock].[DataLockEvents] -( - Id bigint PRIMARY KEY IDENTITY(1,1), - DataLockEventId uniqueidentifier NOT NULL, - ProcessDateTime datetime NOT NULL, - IlrFileName nvarchar(50) NOT NULL, - SubmittedDateTime datetime NOT NULL, - AcademicYear varchar(4) NOT NULL, - UKPRN bigint NOT NULL, - ULN bigint NOT NULL, - LearnRefNumber varchar(12) NOT NULL, - AimSeqNumber INT NOT NULL, - PriceEpisodeIdentifier varchar(25) NOT NULL, - CommitmentId bigint NOT NULL, - EmployerAccountId bigint NOT NULL, - EventSource int NOT NULL, - HasErrors bit NOT NULL, - IlrStartDate date NULL, - IlrStandardCode bigint NULL, - IlrProgrammeType int NULL, - IlrFrameworkCode int NULL, - IlrPathwayCode int NULL, - IlrTrainingPrice decimal(12,5) NULL, - IlrEndpointAssessorPrice decimal(12,5) NULL, - IlrPriceEffectiveFromDate date NULL, - IlrPriceEffectiveToDate date NULL, - [Status] INT NOT NULL -) diff --git a/src/SFA.DAS.Payments.Database.Legacy/SFA.DAS.Payments.Database.Legacy.sqlproj b/src/SFA.DAS.Payments.Database.Legacy/SFA.DAS.Payments.Database.Legacy.sqlproj deleted file mode 100644 index 544bcaa2c..000000000 --- a/src/SFA.DAS.Payments.Database.Legacy/SFA.DAS.Payments.Database.Legacy.sqlproj +++ /dev/null @@ -1,69 +0,0 @@ - - - - - Debug - AnyCPU - SFA.DAS.Payments.Database.Legacy - 2.0 - 4.1 - {e307a71f-9f25-4d11-8f50-57b84ef4aa5e} - Microsoft.Data.Tools.Schema.Sql.SqlAzureV12DatabaseSchemaProvider - Database - - - SFA.DAS.Payments.Database.Legacy - SFA.DAS.Payments.Database.Legacy - 1033, CI - BySchemaAndSchemaType - True - v4.5 - CS - Properties - False - True - True - - - bin\Release\ - $(MSBuildProjectName).sql - False - pdbonly - true - false - true - prompt - 4 - - - bin\Debug\ - $(MSBuildProjectName).sql - false - true - full - false - true - true - prompt - 4 - - - 11.0 - - True - 11.0 - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/SFA.DAS.Payments.Database/Metrics/Schemas/Metrics.sql b/src/SFA.DAS.Payments.Database/Metrics/Schemas/Metrics.sql deleted file mode 100644 index 4e99c9950..000000000 --- a/src/SFA.DAS.Payments.Database/Metrics/Schemas/Metrics.sql +++ /dev/null @@ -1,2 +0,0 @@ -CREATE SCHEMA [Metrics] - AUTHORIZATION [dbo]; diff --git a/src/SFA.DAS.Payments.Database/Metrics/Tables/Metrics.CollectionPeriodTolerance.sql b/src/SFA.DAS.Payments.Database/Metrics/Tables/Metrics.CollectionPeriodTolerance.sql deleted file mode 100644 index 16be87ff2..000000000 --- a/src/SFA.DAS.Payments.Database/Metrics/Tables/Metrics.CollectionPeriodTolerance.sql +++ /dev/null @@ -1,14 +0,0 @@ -CREATE TABLE [Metrics].[CollectionPeriodTolerance] -( - [Id] INT IDENTITY(1,1) NOT NULL CONSTRAINT PK_CollectionPeriodTolerance PRIMARY KEY CLUSTERED, - [AcademicYear] SMALLINT NOT NULL, - [CollectionPeriod] TINYINT NOT NULL, - [SubmissionToleranceLower] DECIMAL(15,5) NOT NULL, - [SubmissionToleranceUpper] DECIMAL(15,5) NOT NULL, - [PeriodEndToleranceLower] DECIMAL(15,5) NOT NULL, - [PeriodEndToleranceUpper] DECIMAL(15,5) NOT NULL, - - INDEX IX_CollectionPeriodTolerance__AcademicYear_CollectionPeriod (AcademicYear, CollectionPeriod), - CONSTRAINT UQ_CollectionPeriodTolerance UNIQUE (AcademicYear, CollectionPeriod) -); -GO diff --git a/src/SFA.DAS.Payments.Database/Metrics/Tables/Metrics.PeriodEndSummary.sql b/src/SFA.DAS.Payments.Database/Metrics/Tables/Metrics.PeriodEndSummary.sql deleted file mode 100644 index dae4ca675..000000000 --- a/src/SFA.DAS.Payments.Database/Metrics/Tables/Metrics.PeriodEndSummary.sql +++ /dev/null @@ -1,43 +0,0 @@ -CREATE TABLE [Metrics].[PeriodEndSummary] ( - [Id] BIGINT IDENTITY (1, 1) NOT NULL, - [AcademicYear] SMALLINT NOT NULL, - [CollectionPeriod] TINYINT NOT NULL, - [JobId] BIGINT NOT NULL, - [Percentage] DECIMAL (15, 5) NOT NULL, - [ContractType1] DECIMAL (15, 5) NOT NULL, - [ContractType2] DECIMAL (15, 5) NOT NULL, - [DifferenceContractType1] DECIMAL (15, 5) NOT NULL, - [DifferenceContractType2] DECIMAL (15, 5) NOT NULL, - [PercentageContractType1] DECIMAL (15, 5) NOT NULL, - [PercentageContractType2] DECIMAL (15, 5) NOT NULL, - [EarningsDCContractType1] DECIMAL (15, 5) NOT NULL, - [EarningsDCContractType2] DECIMAL (15, 5) NOT NULL, - [PaymentsContractType1] DECIMAL (15, 5) NOT NULL, - [PaymentsContractType2] DECIMAL (15, 5) NOT NULL, - [AdjustedDataLockedEarnings] DECIMAL (15, 5) NOT NULL, - [AdjustedDataLockedEarnings16To18] DECIMAL (15, 5) CONSTRAINT [DF_PeriodEndSummary__AdjustedDataLockedEarnings16To18] DEFAULT ((0)) NOT NULL, - [AdjustedDataLockedEarnings19Plus] DECIMAL (15, 5) CONSTRAINT [DF_PeriodEndSummary__AdjustedDataLockedEarnings19Plus] DEFAULT ((0)) NOT NULL, - [AlreadyPaidDataLockedEarnings] DECIMAL (15, 5) CONSTRAINT [DF_PeriodEndSummary__AlreadyPaidDataLockedEarnings] DEFAULT ((0)) NOT NULL, - [AlreadyPaidDataLockedEarnings16To18] DECIMAL (15, 5) CONSTRAINT [DF_PeriodEndSummary__AlreadyPaidDataLockedEarnings16To18] DEFAULT ((0)) NOT NULL, - [AlreadyPaidDataLockedEarnings19Plus] DECIMAL (15, 5) CONSTRAINT [DF_PeriodEndSummary__AlreadyPaidDataLockedEarnings19Plus] DEFAULT ((0)) NOT NULL, - [TotalDataLockedEarnings] DECIMAL (15, 5) CONSTRAINT [DF_PeriodEndSummary__TotalDataLockedEarnings] DEFAULT ((0)) NOT NULL, - [TotalDataLockedEarnings16To18] DECIMAL (15, 5) CONSTRAINT [DF_PeriodEndSummary__TotalDataLockedEarnings16To18] DEFAULT ((0)) NULL, - [TotalDataLockedEarnings19Plus] DECIMAL (15, 5) CONSTRAINT [DF_PeriodEndSummary__TotalDataLockedEarnings19Plus] DEFAULT ((0)) NULL, - [HeldBackCompletionPaymentsContractType1] DECIMAL (15, 5) NOT NULL, - [HeldBackCompletionPaymentsContractType2] DECIMAL (15, 5) NOT NULL, - [PaymentsYearToDateContractType1] DECIMAL (15, 5) NOT NULL, - [PaymentsYearToDateContractType2] DECIMAL (15, 5) NOT NULL, - [InLearning] INT NULL, - [NegativeEarningsContractType1] DECIMAL (15, 5) NULL, - [NegativeEarningsContractType2] DECIMAL (15, 5) NULL, - [IsWithinTolerance] BIT NOT NULL, - [CreationDate] DATETIMEOFFSET (7) CONSTRAINT [DF_PeriodEndSummary__CreationDate] DEFAULT (sysdatetimeoffset()) NOT NULL, - CONSTRAINT [PK_PeriodEndSummary] PRIMARY KEY CLUSTERED ([Id] ASC), - CONSTRAINT [UQ_PeriodEndSummary] UNIQUE NONCLUSTERED ([AcademicYear] ASC, [CollectionPeriod] ASC) -); - - -GO -CREATE NONCLUSTERED INDEX [IX_PeriodEndSummary] - ON [Metrics].[PeriodEndSummary]([JobId] ASC, [AcademicYear] ASC, [CollectionPeriod] ASC, [CreationDate] ASC); - diff --git a/src/SFA.DAS.Payments.Database/Metrics/Tables/Metrics.ProviderDataLockCounts.sql b/src/SFA.DAS.Payments.Database/Metrics/Tables/Metrics.ProviderDataLockCounts.sql deleted file mode 100644 index bf91b062c..000000000 --- a/src/SFA.DAS.Payments.Database/Metrics/Tables/Metrics.ProviderDataLockCounts.sql +++ /dev/null @@ -1,18 +0,0 @@ -create table Metrics.ProviderDataLockCounts( - Id bigint not null identity(1,1) constraint PK_ProviderDataLockCounts primary key clustered - ,SubmissionSummaryId bigint not null constraint FK_ProviderDataLockCounts__SubmissionSummary_Id foreign key references [Metrics].[SubmissionSummary] (Id) on delete cascade - ,DataLock1 int not null - ,DataLock2 int not null - ,DataLock3 int not null - ,DataLock4 int not null - ,DataLock5 int not null - ,DataLock6 int not null - ,DataLock7 int not null - ,DataLock8 int not null - ,DataLock9 int not null - ,DataLock10 int not null - ,DataLock11 int not null - ,DataLock12 int not null - ,CreationDate datetimeoffset not null Constraint DF_ProviderDataLockCounts__CreationDate Default (sysdatetimeoffset()) - ,Index IX_ProviderDataLockCounts (SubmissionSummaryId, CreationDate) -) diff --git a/src/SFA.DAS.Payments.Database/Metrics/Tables/Metrics.ProviderEarning.sql b/src/SFA.DAS.Payments.Database/Metrics/Tables/Metrics.ProviderEarning.sql deleted file mode 100644 index f7a0f0d0e..000000000 --- a/src/SFA.DAS.Payments.Database/Metrics/Tables/Metrics.ProviderEarning.sql +++ /dev/null @@ -1,24 +0,0 @@ -create table Metrics.ProviderEarning( - Id bigint not null identity(1,1) constraint PK_ProviderEarning primary key clustered - ,SubmissionSummaryId bigint not null constraint FK_ProviderEarning__SubmissionSummary_Id foreign key references [Metrics].[SubmissionSummary] (Id) on delete cascade - ,EarningsType tinyint not null constraint FK_ProviderEarning__SubmissionEarningType_Id foreign key references [Metrics].[SubmissionEarningType] (Id) - ,ContractType tinyint not null - ,TransactionType1 decimal(15,5) not null - ,TransactionType2 decimal(15,5) not null - ,TransactionType3 decimal(15,5) not null - ,TransactionType4 decimal(15,5) not null - ,TransactionType5 decimal(15,5) not null - ,TransactionType6 decimal(15,5) not null - ,TransactionType7 decimal(15,5) not null - ,TransactionType8 decimal(15,5) not null - ,TransactionType9 decimal(15,5) not null - ,TransactionType10 decimal(15,5) not null - ,TransactionType11 decimal(15,5) not null - ,TransactionType12 decimal(15,5) not null - ,TransactionType13 decimal(15,5) not null - ,TransactionType14 decimal(15,5) not null - ,TransactionType15 decimal(15,5) not null - ,TransactionType16 decimal(15,5) not null - ,CreationDate datetimeoffset not null Constraint DF_ProviderEarning__CreationDate Default (sysdatetimeoffset()) - ,Index IX_ProviderEarning (SubmissionSummaryId, EarningsType, ContractType, CreationDate) -) diff --git a/src/SFA.DAS.Payments.Database/Metrics/Tables/Metrics.ProviderPaymentFundingSource.sql b/src/SFA.DAS.Payments.Database/Metrics/Tables/Metrics.ProviderPaymentFundingSource.sql deleted file mode 100644 index 30be5ee9c..000000000 --- a/src/SFA.DAS.Payments.Database/Metrics/Tables/Metrics.ProviderPaymentFundingSource.sql +++ /dev/null @@ -1,19 +0,0 @@ -CREATE TABLE [Metrics].[ProviderPaymentFundingSource] ( - [Id] BIGINT IDENTITY (1, 1) NOT NULL, - [ProviderPeriodEndSummaryId] BIGINT NOT NULL, - [ContractType] TINYINT NOT NULL, - [FundingSource1] DECIMAL (15, 5) NOT NULL, - [FundingSource2] DECIMAL (15, 5) NOT NULL, - [FundingSource3] DECIMAL (15, 5) NOT NULL, - [FundingSource4] DECIMAL (15, 5) NOT NULL, - [FundingSource5] DECIMAL (15, 5) NOT NULL, - [CreationDate] DATETIMEOFFSET (7) CONSTRAINT [DF_ProviderPaymentFundingSource__CreationDate] DEFAULT (sysdatetimeoffset()) NOT NULL, - CONSTRAINT [PK_ProviderPaymentFundingSource] PRIMARY KEY CLUSTERED ([Id] ASC), - CONSTRAINT [FK_ProviderPaymentFundingSource__ProviderPeriodEndSummary_Id] FOREIGN KEY ([ProviderPeriodEndSummaryId]) REFERENCES [Metrics].[ProviderPeriodEndSummary] ([Id]) ON DELETE CASCADE -); - - -GO -CREATE NONCLUSTERED INDEX [IX_ProviderPaymentFundingSource] - ON [Metrics].[ProviderPaymentFundingSource]([ProviderPeriodEndSummaryId] ASC, [ContractType] ASC, [CreationDate] ASC); - diff --git a/src/SFA.DAS.Payments.Database/Metrics/Tables/Metrics.ProviderPaymentTransaction.sql b/src/SFA.DAS.Payments.Database/Metrics/Tables/Metrics.ProviderPaymentTransaction.sql deleted file mode 100644 index 66c370c47..000000000 --- a/src/SFA.DAS.Payments.Database/Metrics/Tables/Metrics.ProviderPaymentTransaction.sql +++ /dev/null @@ -1,30 +0,0 @@ -CREATE TABLE [Metrics].[ProviderPaymentTransaction] ( - [Id] BIGINT IDENTITY (1, 1) NOT NULL, - [ProviderPeriodEndSummaryId] BIGINT NOT NULL, - [ContractType] TINYINT NOT NULL, - [TransactionType1] DECIMAL (15, 5) NOT NULL, - [TransactionType2] DECIMAL (15, 5) NOT NULL, - [TransactionType3] DECIMAL (15, 5) NOT NULL, - [TransactionType4] DECIMAL (15, 5) NOT NULL, - [TransactionType5] DECIMAL (15, 5) NOT NULL, - [TransactionType6] DECIMAL (15, 5) NOT NULL, - [TransactionType7] DECIMAL (15, 5) NOT NULL, - [TransactionType8] DECIMAL (15, 5) NOT NULL, - [TransactionType9] DECIMAL (15, 5) NOT NULL, - [TransactionType10] DECIMAL (15, 5) NOT NULL, - [TransactionType11] DECIMAL (15, 5) NOT NULL, - [TransactionType12] DECIMAL (15, 5) NOT NULL, - [TransactionType13] DECIMAL (15, 5) NOT NULL, - [TransactionType14] DECIMAL (15, 5) NOT NULL, - [TransactionType15] DECIMAL (15, 5) NOT NULL, - [TransactionType16] DECIMAL (15, 5) NOT NULL, - [CreationDate] DATETIMEOFFSET (7) CONSTRAINT [DF_ProviderPaymentTransaction__CreationDate] DEFAULT (sysdatetimeoffset()) NOT NULL, - CONSTRAINT [PK_ProviderPaymentTransaction] PRIMARY KEY CLUSTERED ([Id] ASC), - CONSTRAINT [FK_ProviderPaymentTransaction__ProviderPeriodEndSummary_Id] FOREIGN KEY ([ProviderPeriodEndSummaryId]) REFERENCES [Metrics].[ProviderPeriodEndSummary] ([Id]) ON DELETE CASCADE -); - - -GO -CREATE NONCLUSTERED INDEX [IX_ProviderPaymentTransaction] - ON [Metrics].[ProviderPaymentTransaction]([ProviderPeriodEndSummaryId] ASC, [ContractType] ASC, [CreationDate] ASC); - diff --git a/src/SFA.DAS.Payments.Database/Metrics/Tables/Metrics.ProviderPeriodEndSummary.sql b/src/SFA.DAS.Payments.Database/Metrics/Tables/Metrics.ProviderPeriodEndSummary.sql deleted file mode 100644 index a2ecfa0f5..000000000 --- a/src/SFA.DAS.Payments.Database/Metrics/Tables/Metrics.ProviderPeriodEndSummary.sql +++ /dev/null @@ -1,43 +0,0 @@ -CREATE TABLE [Metrics].[ProviderPeriodEndSummary] ( - [Id] BIGINT IDENTITY (1, 1) NOT NULL, - [Ukprn] BIGINT NOT NULL, - [AcademicYear] SMALLINT NOT NULL, - [CollectionPeriod] TINYINT NOT NULL, - [JobId] BIGINT NOT NULL, - [Percentage] DECIMAL (15, 5) NOT NULL, - [ContractType1] DECIMAL (15, 5) NOT NULL, - [ContractType2] DECIMAL (15, 5) NOT NULL, - [DifferenceContractType1] DECIMAL (15, 5) NOT NULL, - [DifferenceContractType2] DECIMAL (15, 5) NOT NULL, - [PercentageContractType1] DECIMAL (15, 5) NOT NULL, - [PercentageContractType2] DECIMAL (15, 5) NOT NULL, - [EarningsDCContractType1] DECIMAL (15, 5) NOT NULL, - [EarningsDCContractType2] DECIMAL (15, 5) NOT NULL, - [PaymentsContractType1] DECIMAL (15, 5) NOT NULL, - [PaymentsContractType2] DECIMAL (15, 5) NOT NULL, - [AdjustedDataLockedEarnings] DECIMAL (15, 5) NOT NULL, - [AdjustedDataLockedEarnings16To18] DECIMAL (15, 5) CONSTRAINT [DF_ProviderPeriodEndSummary__AdjustedDataLockedEarnings16To18] DEFAULT ((0)) NOT NULL, - [AdjustedDataLockedEarnings19Plus] DECIMAL (15, 5) CONSTRAINT [DF_ProviderPeriodEndSummary__AdjustedDataLockedEarnings19Plus] DEFAULT ((0)) NOT NULL, - [AlreadyPaidDataLockedEarnings] DECIMAL (15, 5) CONSTRAINT [DF_ProviderPeriodEndSummary__AlreadyPaidDataLockedEarnings] DEFAULT ((0)) NOT NULL, - [AlreadyPaidDataLockedEarnings16To18] DECIMAL (15, 5) CONSTRAINT [DF_ProviderPeriodEndSummary__AlreadyPaidDataLockedEarnings16To18] DEFAULT ((0)) NOT NULL, - [AlreadyPaidDataLockedEarnings19Plus] DECIMAL (15, 5) CONSTRAINT [DF_ProviderPeriodEndSummary__AlreadyPaidDataLockedEarnings19Plus] DEFAULT ((0)) NOT NULL, - [TotalDataLockedEarnings] DECIMAL (15, 5) CONSTRAINT [DF_ProviderPeriodEndSummary__TotalDataLockedEarnings] DEFAULT ((0)) NOT NULL, - [TotalDataLockedEarnings16To18] DECIMAL (15, 5) CONSTRAINT [DF_ProviderPeriodEndSummary__TotalDataLockedEarnings16To18] DEFAULT ((0)) NULL, - [TotalDataLockedEarnings19Plus] DECIMAL (15, 5) CONSTRAINT [DF_ProviderPeriodEndSummary__TotalDataLockedEarnings19Plus] DEFAULT ((0)) NULL, - [HeldBackCompletionPaymentsContractType1] DECIMAL (15, 5) NOT NULL, - [HeldBackCompletionPaymentsContractType2] DECIMAL (15, 5) NOT NULL, - [PaymentsYearToDateContractType1] DECIMAL (15, 5) NOT NULL, - [PaymentsYearToDateContractType2] DECIMAL (15, 5) NOT NULL, - [InLearning] INT NULL, - [NegativeEarningsContractType1] DECIMAL (15, 5) NULL, - [NegativeEarningsContractType2] DECIMAL (15, 5) NULL, - [CreationDate] DATETIMEOFFSET (7) CONSTRAINT [DF_ProviderPeriodEndSummary__CreationDate] DEFAULT (sysdatetimeoffset()) NOT NULL, - CONSTRAINT [PK_ProviderPeriodEndSummary] PRIMARY KEY CLUSTERED ([Id] ASC), - CONSTRAINT [UQ_ProviderPeriodEndSummary] UNIQUE NONCLUSTERED ([Ukprn] ASC, [AcademicYear] ASC, [CollectionPeriod] ASC) -); - - -GO -CREATE NONCLUSTERED INDEX [IX_ProviderPeriodEndSummary] - ON [Metrics].[ProviderPeriodEndSummary]([Ukprn] ASC, [JobId] ASC, [AcademicYear] ASC, [CollectionPeriod] ASC, [CreationDate] ASC); - diff --git a/src/SFA.DAS.Payments.Database/Metrics/Tables/Metrics.ProviderRequiredPayment.sql b/src/SFA.DAS.Payments.Database/Metrics/Tables/Metrics.ProviderRequiredPayment.sql deleted file mode 100644 index 6fdd84222..000000000 --- a/src/SFA.DAS.Payments.Database/Metrics/Tables/Metrics.ProviderRequiredPayment.sql +++ /dev/null @@ -1,23 +0,0 @@ -create table Metrics.ProviderRequiredPayment( - Id bigint not null identity(1,1) constraint PK_ProviderRequiredPayment primary key clustered - ,SubmissionSummaryId bigint not null constraint FK_ProviderRequiredPayment__SubmissionSummary_Id foreign key references [Metrics].[SubmissionSummary] (Id) on delete cascade - ,ContractType tinyint not null - ,TransactionType1 decimal(15,5) not null - ,TransactionType2 decimal(15,5) not null - ,TransactionType3 decimal(15,5) not null - ,TransactionType4 decimal(15,5) not null - ,TransactionType5 decimal(15,5) not null - ,TransactionType6 decimal(15,5) not null - ,TransactionType7 decimal(15,5) not null - ,TransactionType8 decimal(15,5) not null - ,TransactionType9 decimal(15,5) not null - ,TransactionType10 decimal(15,5) not null - ,TransactionType11 decimal(15,5) not null - ,TransactionType12 decimal(15,5) not null - ,TransactionType13 decimal(15,5) not null - ,TransactionType14 decimal(15,5) not null - ,TransactionType15 decimal(15,5) not null - ,TransactionType16 decimal(15,5) not null - ,CreationDate datetimeoffset not null Constraint DF_ProviderRequiredPayment__CreationDate Default (sysdatetimeoffset()) - ,Index IX_ProviderRequiredPayment (SubmissionSummaryId, ContractType, CreationDate) -) \ No newline at end of file diff --git a/src/SFA.DAS.Payments.Database/Metrics/Tables/Metrics.SubmissionEarningType.sql b/src/SFA.DAS.Payments.Database/Metrics/Tables/Metrics.SubmissionEarningType.sql deleted file mode 100644 index 0e49258ef..000000000 --- a/src/SFA.DAS.Payments.Database/Metrics/Tables/Metrics.SubmissionEarningType.sql +++ /dev/null @@ -1,4 +0,0 @@ -create table Metrics.SubmissionEarningType ( - Id tinyint not null constraint PK_SubmissionEarningType primary key clustered, - [Description] varchar(500) not null -) \ No newline at end of file diff --git a/src/SFA.DAS.Payments.Database/Metrics/Tables/Metrics.SubmissionSummary.sql b/src/SFA.DAS.Payments.Database/Metrics/Tables/Metrics.SubmissionSummary.sql deleted file mode 100644 index ebe210292..000000000 --- a/src/SFA.DAS.Payments.Database/Metrics/Tables/Metrics.SubmissionSummary.sql +++ /dev/null @@ -1,34 +0,0 @@ -create table Metrics.SubmissionSummary ( - Id bigint not null identity(1,1) constraint PK_SubmissionSummary primary key clustered - ,Ukprn bigint not null - ,AcademicYear smallint not null - ,CollectionPeriod tinyint not null - ,JobId bigint not null - ,[Percentage] decimal(15,5) not null - ,ContractType1 decimal(15,5) not null - ,ContractType2 decimal(15,5) not null - ,DifferenceContractType1 decimal(15,5) not null - ,DifferenceContractType2 decimal(15,5) not null - ,PercentageContractType1 decimal(15,5) not null - ,PercentageContractType2 decimal(15,5) not null - ,EarningsDCContractType1 decimal(15,5) not null - ,EarningsDCContractType2 decimal(15,5) not null - ,EarningsDASContractType1 decimal(15,5) not null - ,EarningsDASContractType2 decimal(15,5) not null - ,EarningsDifferenceContractType1 decimal(15,5) not null - ,EarningsDifferenceContractType2 decimal(15,5) not null - ,EarningsPercentageContractType1 decimal(15,5) not null - ,EarningsPercentageContractType2 decimal(15,5) not null - ,RequiredPaymentsContractType1 decimal(15,5) not null - ,RequiredPaymentsContractType2 decimal(15,5) not null - ,AdjustedDataLockedEarnings decimal(15,5) not null - ,AlreadyPaidDataLockedEarnings decimal(15,5) not null Constraint DF_SubmissionSummary__AlreadyPaidDataLockedEarnings default(0) - ,TotalDataLockedEarnings decimal(15,5) not null Constraint DF_SubmissionSummary__TotalDataLockedEarnings default(0) - ,HeldBackCompletionPaymentsContractType1 decimal(15,5) not null - ,HeldBackCompletionPaymentsContractType2 decimal(15,5) not null - ,PaymentsYearToDateContractType1 decimal(15,5) not null - ,PaymentsYearToDateContractType2 decimal(15,5) not null - ,CreationDate datetimeoffset not null Constraint DF_SubmissionSummary__CreationDate Default (sysdatetimeoffset()) - ,Index IX_SubmissionSummary (Ukprn, JobId, AcademicYear, CollectionPeriod, CreationDate) - ,CONSTRAINT UQ_SubmissionSummary Unique (Ukprn, AcademicYear, CollectionPeriod) -) \ No newline at end of file diff --git a/src/SFA.DAS.Payments.Database/Metrics/Tables/Metrics.SubmissionsSummary.sql b/src/SFA.DAS.Payments.Database/Metrics/Tables/Metrics.SubmissionsSummary.sql deleted file mode 100644 index a862d0b18..000000000 --- a/src/SFA.DAS.Payments.Database/Metrics/Tables/Metrics.SubmissionsSummary.sql +++ /dev/null @@ -1,34 +0,0 @@ -create table Metrics.SubmissionsSummary ( - Id bigint not null identity(1,1) constraint PK_SubmissionsSummary primary key clustered - ,IsWithinTolerance bit not null - ,AcademicYear smallint not null - ,CollectionPeriod tinyint not null - ,JobId bigint not null - ,[Percentage] decimal(15,5) not null - ,ContractType1 decimal(15,5) not null - ,ContractType2 decimal(15,5) not null - ,DifferenceContractType1 decimal(15,5) not null - ,DifferenceContractType2 decimal(15,5) not null - ,PercentageContractType1 decimal(15,5) not null - ,PercentageContractType2 decimal(15,5) not null - ,EarningsDCContractType1 decimal(15,5) not null - ,EarningsDCContractType2 decimal(15,5) not null - ,EarningsDASContractType1 decimal(15,5) not null - ,EarningsDASContractType2 decimal(15,5) not null - ,EarningsDifferenceContractType1 decimal(15,5) not null - ,EarningsDifferenceContractType2 decimal(15,5) not null - ,EarningsPercentageContractType1 decimal(15,5) not null - ,EarningsPercentageContractType2 decimal(15,5) not null - ,RequiredPaymentsContractType1 decimal(15,5) not null - ,RequiredPaymentsContractType2 decimal(15,5) not null - ,AdjustedDataLockedEarnings decimal(15,5) not null - ,AlreadyPaidDataLockedEarnings decimal(15,5) not null Constraint DF_SubmissionsSummary__AlreadyPaidDataLockedEarnings default(0) - ,TotalDataLockedEarnings decimal(15,5) not null Constraint DF_SubmissionsSummary__TotalDataLockedEarnings default(0) - ,HeldBackCompletionPaymentsContractType1 decimal(15,5) not null - ,HeldBackCompletionPaymentsContractType2 decimal(15,5) not null - ,PaymentsYearToDateContractType1 decimal(15,5) not null - ,PaymentsYearToDateContractType2 decimal(15,5) not null - ,CreationDate datetimeoffset not null Constraint DF_SubmissionsSummary__CreationDate Default (sysdatetimeoffset()) - ,Index IX_SubmissionsSummary (JobId, AcademicYear, CollectionPeriod, CreationDate) - ,CONSTRAINT UQ_SubmissionsSummary Unique (AcademicYear, CollectionPeriod) -) diff --git a/src/SFA.DAS.Payments.Database/Metrics/Tables/Metrics.SubmissionsSummaryDataLockCounts.sql b/src/SFA.DAS.Payments.Database/Metrics/Tables/Metrics.SubmissionsSummaryDataLockCounts.sql deleted file mode 100644 index 92b2d9814..000000000 --- a/src/SFA.DAS.Payments.Database/Metrics/Tables/Metrics.SubmissionsSummaryDataLockCounts.sql +++ /dev/null @@ -1,18 +0,0 @@ -create table Metrics.SubmissionsSummaryDataLockCounts( - Id bigint not null identity(1,1) constraint PK_SubmissionsSummaryDataLockCounts primary key clustered - ,SubmissionsSummaryId bigint not null constraint FK_SubmissionsSummaryDataLockCounts__SubmissionsSummary_Id foreign key references [Metrics].[SubmissionsSummary] (Id) on delete cascade - ,DataLock1 int not null - ,DataLock2 int not null - ,DataLock3 int not null - ,DataLock4 int not null - ,DataLock5 int not null - ,DataLock6 int not null - ,DataLock7 int not null - ,DataLock8 int not null - ,DataLock9 int not null - ,DataLock10 int not null - ,DataLock11 int not null - ,DataLock12 int not null - ,CreationDate datetimeoffset not null Constraint DF_SubmissionsSummaryDataLockCounts__CreationDate Default (sysdatetimeoffset()) - ,Index IX_SubmissionsSummaryDataLockCounts (SubmissionsSummaryId, CreationDate) -) diff --git a/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.Apprenticeship.sql b/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.Apprenticeship.sql deleted file mode 100644 index bcde026be..000000000 --- a/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.Apprenticeship.sql +++ /dev/null @@ -1,59 +0,0 @@ -CREATE TABLE [Payments2].[Apprenticeship] -( - Id BIGINT NOT NULL CONSTRAINT PK_Apprenticeship PRIMARY KEY, - AccountId BIGINT NOT NULL, - AgreementId CHAR(6) NULL, - AgreedOnDate Date not null, - Uln BIGINT NOT NULL, - Ukprn BIGINT NOT NULL, - EstimatedStartDate Date NOT NULL, - EstimatedEndDate Date NOT NULL, - [Priority] INT NOT NULL, - StandardCode BIGINT NULL, - ProgrammeType INT NULL, - FrameworkCode INT NULL, - PathwayCode INT NULL, - LegalEntityName NVARCHAR (100) NULL, - TransferSendingEmployerAccountId BIGINT NULL, - StopDate Date NULL, - [Status] TINYINT NOT NULL, - [IsLevyPayer] BIT NOT NULL, - CreationDate DATETIMEOFFSET NOT NULL CONSTRAINT DF_Apprenticeship__CreationDate DEFAULT (SYSDATETIMEOFFSET()), - [ApprenticeshipEmployerType] TINYINT NOT NULL CONSTRAINT DF_Apprenticeship_ApprenticeshipEmployerType DEFAULT (1), - -) - -GO - -CREATE NONCLUSTERED INDEX [IX_Apprenticeship_Ukprn] ON [Payments2].[Apprenticeship] -( - [Ukprn] ASC -) INCLUDE ( - [Uln] -) - -GO - -CREATE INDEX [IX_Apprenticeship__AccountSearch] ON [Payments2].[Apprenticeship] -( - [Ukprn], - AccountId, - TransferSendingEmployerAccountId, - IsLevyPayer -) -GO - -CREATE NONCLUSTERED INDEX [IX_Apprenticeship_Uln] ON [Payments2].[Apprenticeship] -( - [Uln] ASC -) -GO - - -CREATE NONCLUSTERED INDEX [IX_Apprenticeship__Search] ON [Payments2].[Apprenticeship] -([AccountId]) -INCLUDE ([AgreedOnDate], [AgreementId], [ApprenticeshipEmployerType], [EstimatedEndDate], - [EstimatedStartDate], [FrameworkCode], [IsLevyPayer], [LegalEntityName], [PathwayCode], - [Priority], [ProgrammeType], [StandardCode], [Status], [StopDate], [TransferSendingEmployerAccountId], - [Ukprn], [Uln]) -WITH (ONLINE = ON) \ No newline at end of file diff --git a/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.ApprenticeshipDuplicate.sql b/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.ApprenticeshipDuplicate.sql deleted file mode 100644 index e9f898bca..000000000 --- a/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.ApprenticeshipDuplicate.sql +++ /dev/null @@ -1,14 +0,0 @@ -CREATE TABLE [Payments2].[ApprenticeshipDuplicate] -( - Id BIGINT NOT NULL IDENTITY CONSTRAINT PK_ApprenticeshipDuplicate PRIMARY KEY, - ApprenticeshipId BIGINT NOT NULL CONSTRAINT FK_ApprenticeshipDuplicate__Apprenticeship FOREIGN KEY REFERENCES [Payments2].[Apprenticeship] (Id), - Ukprn BIGINT NOT NULL , - Uln BIGINT NOT NULL -) - -GO - -CREATE INDEX IX_Payments2_ApprenticeshipDuplicate__Uln -ON Payments2.ApprenticeshipDuplicate (Uln) - -GO \ No newline at end of file diff --git a/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.ApprenticeshipPause.sql b/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.ApprenticeshipPause.sql deleted file mode 100644 index f7cb1b2c2..000000000 --- a/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.ApprenticeshipPause.sql +++ /dev/null @@ -1,14 +0,0 @@ -CREATE TABLE [Payments2].[ApprenticeshipPause] ( - [Id] BIGINT IDENTITY (1, 1) NOT NULL, - [ApprenticeshipId] BIGINT NOT NULL, - [PauseDate] DATE NOT NULL, - [ResumeDate] DATE NULL, - PRIMARY KEY CLUSTERED ([Id] ASC), - CONSTRAINT [FK_ApprenticeshipPause_Apprenticeship] FOREIGN KEY ([ApprenticeshipId]) REFERENCES [Payments2].[Apprenticeship] ([Id]) -); - - - -GO - - diff --git a/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.ApprenticeshipPriceEpisode.sql b/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.ApprenticeshipPriceEpisode.sql deleted file mode 100644 index 9960c2ddd..000000000 --- a/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.ApprenticeshipPriceEpisode.sql +++ /dev/null @@ -1,17 +0,0 @@ -CREATE TABLE [Payments2].[ApprenticeshipPriceEpisode] -( - Id BIGINT NOT NULL IDENTITY CONSTRAINT PK_ApprenticeshipPriceEpisode PRIMARY KEY, - ApprenticeshipId BIGINT NOT NULL CONSTRAINT FK_ApprenticeshipPriceEpisode__Apprenticeship FOREIGN KEY REFERENCES [Payments2].[Apprenticeship] (Id) ON DELETE CASCADE, - StartDate Date NOT NULL, - EndDate Date NULL, - Cost DECIMAL(15,5) NOT NULL, - Removed BIT NOT NULL CONSTRAINT DF_ApprenticeshipPriceEpisode__Removed DEFAULT (0), - CreationDate DATETIMEOFFSET NOT NULL CONSTRAINT DF_ApprenticeshipPriceEpisode__CreationDate DEFAULT (SYSDATETIMEOFFSET()), -) -GO - -CREATE INDEX [IX_ApprenticeshipPriceEpisode__ApprenticeshipId] ON [Payments2].[ApprenticeshipPriceEpisode] -( - ApprenticeshipId -) -GO diff --git a/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.ApprenticeshipStatus.sql b/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.ApprenticeshipStatus.sql deleted file mode 100644 index 44c17ac33..000000000 --- a/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.ApprenticeshipStatus.sql +++ /dev/null @@ -1,5 +0,0 @@ -CREATE TABLE [Payments2].[ApprenticeshipStatus] -( - Id TinyInt NOT NULL CONSTRAINT PK_ApprenticeshipStatus PRIMARY KEY, - [Description] VarChar(100) NOT NULL -) diff --git a/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.CollectionPeriod.sql b/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.CollectionPeriod.sql deleted file mode 100644 index be3e58092..000000000 --- a/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.CollectionPeriod.sql +++ /dev/null @@ -1,10 +0,0 @@ -CREATE TABLE [Payments2].[CollectionPeriod] -( - [Id] BIGINT NOT NULL IDENTITY(1,1) CONSTRAINT PK_CollectionPeriod PRIMARY KEY CLUSTERED, - [AcademicYear] SMALLINT NOT NULL, - [Period] TINYINT NOT NULL, - [ReferenceDataValidationDate] DATETIME2 NULL, - [CompletionDate] DATETIME2 NOT NULL, - [AuditMigrationCompletionDate] DATETIME2 NULL, - [CreationDate] DATETIME2 NOT NULL DEFAULT sysutcdatetime() -) diff --git a/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.CurrentPriceEpisode.sql b/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.CurrentPriceEpisode.sql deleted file mode 100644 index ebc9c8962..000000000 --- a/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.CurrentPriceEpisode.sql +++ /dev/null @@ -1,17 +0,0 @@ -CREATE TABLE [Payments2].[CurrentPriceEpisode] -( - [Id] BIGINT NOT NULL IDENTITY(1,1) CONSTRAINT PK_CurrentPriceEpisode PRIMARY KEY CLUSTERED, - [PriceEpisodeIdentifier] NVARCHAR(100) NOT NULL, - AgreedPrice DECIMAL(15, 5) NOT NULL, - [Ukprn] BIGINT NOT NULL, - [Uln] BIGINT NOT NULL, - [JobId] BIGINT NOT NULL, - [MessageType] NVARCHAR(2000) NOT NULL, - [Message] NVARCHAR(MAX) NOT NULL, - [CreationDate] DATETIME2 NOT NULL DEFAULT sysutcdatetime() -) - -GO - -CREATE INDEX [IX_CurrentPriceEpisode_Ukprn_JobId] ON [Payments2].[CurrentPriceEpisode] -([Ukprn], [JobId]) diff --git a/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.DataLockEvent.sql b/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.DataLockEvent.sql deleted file mode 100644 index f72f471d3..000000000 --- a/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.DataLockEvent.sql +++ /dev/null @@ -1,118 +0,0 @@ -CREATE TABLE [Payments2].[DataLockEvent] -( - Id BIGINT NOT NULL IDENTITY(1,1) CONSTRAINT PK_DataLockEvent PRIMARY KEY CLUSTERED, - EventId UNIQUEIDENTIFIER NOT NULL CONSTRAINT UQ_DataLockEvent_EventId UNIQUE, - EarningEventId UNIQUEIDENTIFIER NOT NULL, - Ukprn BIGINT NOT NULL, - ContractType TINYINT NOT NULL, - CollectionPeriod TINYINT NOT NULL, - AcademicYear SMALLINT NOT NULL, - LearnerReferenceNumber NVARCHAR(50) NOT NULL, - LearnerUln BIGINT NOT NULL, - LearningAimReference NVARCHAR(8) NOT NULL, - LearningAimProgrammeType INT NOT NULL , - LearningAimStandardCode INT NOT NULL, - LearningAimFrameworkCode INT NOT NULL, - LearningAimPathwayCode INT NOT NULL, - LearningAimFundingLineType NVARCHAR(100) NULL, - LearningStartDate DATETIME2 NULL, - AgreementId NVARCHAR(255) NULL, - IlrSubmissionDateTime DATETIME2 NOT NULL, - IsPayable BIT NOT NULL, - DataLockSourceId TINYINT NOT NULL CONSTRAINT DF_DataLockEvent__DataLockSourceId DEFAULT (1), - JobId BIGINT NOT NULL, - EventTime DATETIMEOFFSET NOT NULL, - CreationDate DATETIMEOFFSET NOT NULL CONSTRAINT DF_DataLockEvent__CreationDate DEFAULT (SYSDATETIMEOFFSET()), - DuplicateNumber INT NULL -) -GO - -CREATE UNIQUE INDEX [UX_DataLockEvent_LogicalDuplicates] ON [Payments2].[DataLockEvent] -( - [JobId], - [Ukprn], - [AcademicYear], - [CollectionPeriod], - [IsPayable], - [ContractType], - [LearnerUln], - [LearnerReferenceNumber], - [LearningAimReference], - [LearningAimProgrammeType], - [LearningAimStandardCode], - [LearningAimFrameworkCode], - [LearningAimPathwayCode], - [LearningAimFundingLineType], - [LearningStartDate], - [DuplicateNumber] -) -GO -CREATE NONCLUSTERED INDEX [IX_DataLockEvent_Submission] ON [Payments2].[DataLockEvent] -( - [Ukprn], - [AcademicYear], - [CollectionPeriod], - [IlrSubmissionDateTime] -) WITH (ONLINE = ON) -GO - -CREATE NONCLUSTERED INDEX [IX_DataLockEvent__Metrics] ON [Payments2].[DataLockEvent] -( - [AcademicYear], - [CollectionPeriod], - [IsPayable], - [LearningAimReference], - [Ukprn], - [JobId] -) -INCLUDE -( - [DataLockSourceId], - [EarningEventId], - [EventId], - [IlrSubmissionDateTime], - [LearnerReferenceNumber], - [LearnerUln] -) -WITH (ONLINE = ON) -Go - -CREATE NONCLUSTERED INDEX [IX_DataLockEvent__Metrics_Paid_DataLocks] ON [Payments2].[DataLockEvent] -( - [JobId], - [Ukprn], - [IsPayable] -) -INCLUDE -( - [CollectionPeriod], - [EventId], - [LearnerReferenceNumber], - [LearningAimFrameworkCode], - [LearningAimPathwayCode], - [LearningAimProgrammeType], - [LearningAimReference], - [LearningAimStandardCode] -) -WITH (ONLINE = ON) -GO - -CREATE NONCLUSTERED INDEX [IX_DataLockEvent__Manual_Metrics_Paid_DataLocks] ON [Payments2].[DataLockEvent] -( - [Ukprn] , - [CollectionPeriod], - [JobId], - [IsPayable] -) -INCLUDE -( - [EventId], - [LearnerReferenceNumber], - [LearningAimReference], - [LearningAimProgrammeType] , - [LearningAimStandardCode] , - [LearningAimFrameworkCode], - [LearningAimPathwayCode] -) -WITH (ONLINE = ON) -go \ No newline at end of file diff --git a/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.DataLockEventNonPayablePeriod.sql b/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.DataLockEventNonPayablePeriod.sql deleted file mode 100644 index a411b6041..000000000 --- a/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.DataLockEventNonPayablePeriod.sql +++ /dev/null @@ -1,40 +0,0 @@ -CREATE TABLE [Payments2].[DataLockEventNonPayablePeriod] -( - Id BIGINT NOT NULL IDENTITY(1,1) CONSTRAINT PK_DataLockEventNonPayablePeriod PRIMARY KEY CLUSTERED, - DataLockEventId UNIQUEIDENTIFIER NOT NULL CONSTRAINT FK_DataLockEventNonPayablePeriod__DataLockEvent FOREIGN KEY REFERENCES [Payments2].[DataLockEvent] (EventId) ON DELETE CASCADE, - DataLockEventNonPayablePeriodId UNIQUEIDENTIFIER NOT NULL CONSTRAINT UQ_DataLockEventNonPayablePeriod__DataLockEventNonPayablePeriodId UNIQUE, - PriceEpisodeIdentifier NVARCHAR(50) NULL, - TransactionType TINYINT NOT NULL, - DeliveryPeriod TINYINT NOT NULL, - Amount DECIMAL(15,5) NOT NULL, - SfaContributionPercentage DECIMAL(15,5) NULL, - CreationDate DATETIMEOFFSET NOT NULL CONSTRAINT DF_DataLockEventNonPayablePeriod__CreationDate DEFAULT (SYSDATETIMEOFFSET()), - LearningStartDate DATETIME2 NULL, - AcademicYear SMALLINT NULL, - CollectionPeriod TINYINT NULL, -) -GO - -CREATE NONCLUSTERED INDEX [IX_DataLockEventNonPayablePeriod__DataLockEventId] ON [Payments2].[DataLockEventNonPayablePeriod] -( - [DataLockEventId] -) -INCLUDE -( - [Amount], - [DataLockEventNonPayablePeriodId] -) -WITH (ONLINE = ON); -GO - -CREATE NONCLUSTERED INDEX [IX_DataLockEventNonPayablePeriod__TransactionType] ON [Payments2].[DataLockEventNonPayablePeriod] -( - [TransactionType] -) -INCLUDE -( - [DataLockEventId], - [DataLockEventNonPayablePeriodId] -) -WITH (ONLINE = ON) -GO diff --git a/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.DataLockEventNonPayablePeriodFailures.sql b/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.DataLockEventNonPayablePeriodFailures.sql deleted file mode 100644 index 280af3ebd..000000000 --- a/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.DataLockEventNonPayablePeriodFailures.sql +++ /dev/null @@ -1,22 +0,0 @@ -CREATE TABLE [Payments2].[DataLockEventNonPayablePeriodFailures] -( - Id BIGINT NOT NULL IDENTITY(1,1) CONSTRAINT PK_DataLockEventNonPayablePeriodFailures PRIMARY KEY CLUSTERED, - DataLockEventNonPayablePeriodId UNIQUEIDENTIFIER NOT NULL CONSTRAINT FK_DataLockEventNonPayablePeriodFailures__DataLockEventNonPayablePeriod FOREIGN KEY REFERENCES [Payments2].[DataLockEventNonPayablePeriod] (DataLockEventNonPayablePeriodId) ON DELETE CASCADE, - DataLockFailureId TINYINT NOT NULL, - CreationDate DATETIMEOFFSET NOT NULL CONSTRAINT DF_DataLockEventNonPayablePeriodFailures__CreationDate DEFAULT (SYSDATETIMEOFFSET()), - ApprenticeshipId BIGINT NULL, - AcademicYear SMALLINT NULL, - CollectionPeriod TINYINT NULL, -) -GO - -CREATE NONCLUSTERED INDEX [IX_DataLockEventNonPayablePeriodFailures__DataLockEventNonPayablePeriodId] ON [Payments2].[DataLockEventNonPayablePeriodFailures] -( - [DataLockEventNonPayablePeriodId] -) -INCLUDE -( - [DataLockFailureId] -) -WITH (ONLINE = ON); -GO \ No newline at end of file diff --git a/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.DataLockEventPayablePeriod.sql b/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.DataLockEventPayablePeriod.sql deleted file mode 100644 index bee972577..000000000 --- a/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.DataLockEventPayablePeriod.sql +++ /dev/null @@ -1,25 +0,0 @@ -CREATE TABLE [Payments2].[DataLockEventPayablePeriod] -( - Id BIGINT NOT NULL IDENTITY(1,1) CONSTRAINT PK_DataLockEventPayablePeriod PRIMARY KEY CLUSTERED, - DataLockEventId UNIQUEIDENTIFIER NOT NULL CONSTRAINT FK_DataLockEventPayablePeriod__DataLockEvent FOREIGN KEY REFERENCES [Payments2].[DataLockEvent] (EventId) ON DELETE CASCADE, - PriceEpisodeIdentifier NVARCHAR(50) NULL, - TransactionType TINYINT NOT NULL, - DeliveryPeriod TINYINT NOT NULL, - Amount DECIMAL(15,5) NOT NULL, - SfaContributionPercentage DECIMAL(15,5) NULL, - CreationDate DATETIMEOFFSET NOT NULL CONSTRAINT DF_DataLockEventPayablePeriod__CreationDate DEFAULT (SYSDATETIMEOFFSET()), - LearningStartDate DATETIME2 NULL, - ApprenticeshipId BIGINT NULL, - ApprenticeshipPriceEpisodeId BIGINT NULL, - ApprenticeshipEmployerType TINYINT NULL, - AcademicYear SMALLINT NULL, - CollectionPeriod TINYINT NULL -) -GO - -CREATE NONCLUSTERED INDEX [IX_DataLockEventPayablePeriod__DataLockEventId] ON [Payments2].[DataLockEventPayablePeriod] -( - [DataLockEventId] -) -WITH (ONLINE = ON); -GO \ No newline at end of file diff --git a/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.DataLockEventPriceEpisode.sql b/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.DataLockEventPriceEpisode.sql deleted file mode 100644 index 9f02bd61f..000000000 --- a/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.DataLockEventPriceEpisode.sql +++ /dev/null @@ -1,32 +0,0 @@ -CREATE TABLE [Payments2].[DataLockEventPriceEpisode] -( - Id BIGINT NOT NULL IDENTITY(1,1) CONSTRAINT PK_DataLockEventPriceEpisode PRIMARY KEY CLUSTERED, - DataLockEventId UNIQUEIDENTIFIER NOT NULL CONSTRAINT FK_DataLockEventPriceEpisode__DataLockEvent FOREIGN KEY REFERENCES [Payments2].[DataLockEvent] (EventId) ON DELETE CASCADE, - PriceEpisodeIdentifier NVARCHAR(50) NOT NULL, - SfaContributionPercentage DECIMAL(15,5) NOT NULL, - TotalNegotiatedPrice1 DECIMAL(15,5) NOT NULL, - TotalNegotiatedPrice2 DECIMAL(15,5) NULL, - TotalNegotiatedPrice3 DECIMAL(15,5) NULL, - TotalNegotiatedPrice4 DECIMAL(15,5) NULL, - StartDate DATETIME2 NOT NULL, - EffectiveTotalNegotiatedPriceStartDate DATETIME2 NULL, - PlannedEndDate DATETIME2 NOT NULL, - ActualEndDate DATETIME2 NULL, - NumberOfInstalments INT NOT NULL, - InstalmentAmount DECIMAL(15,5) NOT NULL, - CompletionAmount DECIMAL(15,5) NOT NULL, - Completed BIT NOT NULL, - EmployerContribution DECIMAL(15,5) NULL, - CompletionHoldBackExemptionCode INT NULL, - CreationDate DATETIMEOFFSET NOT NULL CONSTRAINT DF_DataLockEventPriceEpisode__CreationDate DEFAULT (SYSDATETIMEOFFSET()), - AcademicYear SMALLINT NULL, - CollectionPeriod TINYINT NULL -) -GO - -CREATE NONCLUSTERED INDEX [IX_DataLockEventPriceEpisode__DataLockEventId] ON [Payments2].[DataLockEventPriceEpisode] -( - [DataLockEventId] -) -WITH (ONLINE = ON) -GO \ No newline at end of file diff --git a/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.DataLockFailure.sql b/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.DataLockFailure.sql deleted file mode 100644 index 3beeace00..000000000 --- a/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.DataLockFailure.sql +++ /dev/null @@ -1,27 +0,0 @@ -CREATE TABLE [Payments2].[DataLockFailure] -( - [Id] BIGINT NOT NULL CONSTRAINT PK_DataLockFailure PRIMARY KEY IDENTITY, - [DataLockEventId] UNIQUEIDENTIFIER, - [EarningEventId] UNIQUEIDENTIFIER NOT NULL, - [Ukprn] BIGINT NOT NULL, - [LearnerUln] BIGINT NOT NULL, - [LearnerReferenceNumber] NVARCHAR(50) NOT NULL, - [LearningAimReference] NVARCHAR(8) NOT NULL, - [LearningAimProgrammeType] INT NOT NULL, - [LearningAimStandardCode] INT NOT NULL, - [LearningAimFrameworkCode] INT NOT NULL, - [LearningAimPathwayCode] INT NOT NULL, - [AcademicYear] SMALLINT NOT NULL, - [TransactionType] TINYINT NOT NULL, - [DeliveryPeriod] TINYINT NOT NULL, - [CollectionPeriod] TINYINT NOT NULL, - [EarningPeriod] NVARCHAR(MAX) NOT NULL, - [Amount] DECIMAL(15, 5) NOT NULL, - [CreationDate] DATETIME2 NOT NULL DEFAULT sysutcdatetime() -) - -GO - -CREATE UNIQUE INDEX [IX_DataLockFailure_Key] ON [Payments2].[DataLockFailure] ([Ukprn], [LearningAimFrameworkCode], [LearningAimPathwayCode], [LearningAimProgrammeType], [LearningAimStandardCode], [LearningAimReference], [LearnerReferenceNumber], [AcademicYear], [DeliveryPeriod], [TransactionType]) -GO -CREATE NONCLUSTERED INDEX [IX_DataLockFailure__Search] ON [Payments2].[DataLockFailure] ([AcademicYear], [LearnerReferenceNumber], [LearningAimReference], [Ukprn], [TransactionType]) INCLUDE ([Amount], [DataLockEventId], [DeliveryPeriod], [EarningEventId], [LearnerUln], [LearningAimFrameworkCode], [LearningAimPathwayCode], [LearningAimProgrammeType], [LearningAimStandardCode]) WITH (ONLINE = ON) \ No newline at end of file diff --git a/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.EarningEvent.sql b/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.EarningEvent.sql deleted file mode 100644 index 636ab0c5b..000000000 --- a/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.EarningEvent.sql +++ /dev/null @@ -1,90 +0,0 @@ -CREATE TABLE [Payments2].[EarningEvent] -( - Id BIGINT NOT NULL IDENTITY(1,1) CONSTRAINT PK_EarningEvent PRIMARY KEY CLUSTERED, - EventId UNIQUEIDENTIFIER NOT NULL CONSTRAINT UQ_EarningEvent_EventId UNIQUE, - Ukprn BIGINT NOT NULL, - ContractType TINYINT NOT NULL, - CollectionPeriod TINYINT NOT NULL, - AcademicYear SMALLINT NOT NULL, - LearnerReferenceNumber NVARCHAR(50) NOT NULL, - LearnerUln BIGINT NOT NULL, - LearningAimReference NVARCHAR(8) NOT NULL, - LearningAimProgrammeType INT NOT NULL , - LearningAimStandardCode INT NOT NULL, - LearningAimFrameworkCode INT NOT NULL, - LearningAimPathwayCode INT NOT NULL, - LearningAimFundingLineType NVARCHAR(100) NULL, - LearningStartDate DATETIME2 NULL, - AgreementId NVARCHAR(255) NULL, - IlrSubmissionDateTime DATETIME2 NOT NULL, - JobId BIGINT NOT NULL, - EventTime DATETIMEOFFSET NOT NULL, - CreationDate DATETIMEOFFSET NOT NULL CONSTRAINT DF_EarningEvent__CreationDate DEFAULT (SYSDATETIMEOFFSET()), - LearningAimSequenceNumber BIGINT NULL, - SfaContributionPercentage DECIMAL(15, 5) NULL, - IlrFileName NVARCHAR(400) NULL, - EventType NVARCHAR(4000) NULL, -) -GO - -CREATE UNIQUE INDEX UQ_EarningEvent ON [Payments2].[EarningEvent] -( - [JobId], - [Ukprn], - [AcademicYear], - [CollectionPeriod], - [ContractType], - [LearnerUln], - [LearnerReferenceNumber], - [LearningAimReference], - [LearningAimProgrammeType], - [LearningAimStandardCode], - [LearningAimFrameworkCode], - [LearningAimPathwayCode], - [LearningAimFundingLineType], - [LearningAimSequenceNumber], - [LearningStartDate], - [EventType] -) -GO - -CREATE NONCLUSTERED INDEX [IX_EarningEvent_ApprenticeshipEarningQuery] ON [Payments2].[EarningEvent] -( - [Ukprn], - [LearnerUln], - [EventType], - [JobId], - [ContractType], - [CollectionPeriod], - [AcademicYear], - [IlrSubmissionDateTime], - [CreationDate] -) -WITH (ONLINE = ON) -GO - -CREATE NONCLUSTERED INDEX [IX_EarningEvent__AcademicYear_CollectionPeriod_JobId] ON [Payments2].[EarningEvent] -( - [AcademicYear], - [CollectionPeriod], - [JobId] -) -INCLUDE -( - [EventId] -) -WITH (ONLINE = ON) -GO - -CREATE NONCLUSTERED INDEX [IX_EarningEvent__Ukprn_JobId] ON [Payments2].[EarningEvent] -( - [Ukprn], - [JobId] -) -INCLUDE -( - [EventId], - [ContractType] -) -WITH (ONLINE = ON) -GO \ No newline at end of file diff --git a/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.EarningEventPeriod.sql b/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.EarningEventPeriod.sql deleted file mode 100644 index 642a44fd7..000000000 --- a/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.EarningEventPeriod.sql +++ /dev/null @@ -1,27 +0,0 @@ -CREATE TABLE [Payments2].[EarningEventPeriod] -( - Id BIGINT NOT NULL IDENTITY(1,1) CONSTRAINT PK_EarningEventPeriod PRIMARY KEY CLUSTERED, - EarningEventId UNIQUEIDENTIFIER NOT NULL CONSTRAINT FK_EarningEventPeriod__EarningEvent FOREIGN KEY REFERENCES [Payments2].[EarningEvent] (EventId) ON DELETE CASCADE, - PriceEpisodeIdentifier NVARCHAR(50) NULL, - TransactionType TINYINT NOT NULL, - DeliveryPeriod TINYINT NOT NULL, - Amount DECIMAL(15,5) NOT NULL, - SfaContributionPercentage DECIMAL(15,5) NULL, - CreationDate DATETIMEOFFSET NOT NULL CONSTRAINT DF_EarningEventPeriod__CreationDate DEFAULT (SYSDATETIMEOFFSET()), - CensusDate DATETIME2 NULL, - AcademicYear SMALLINT NULL, - CollectionPeriod TINYINT NULL -) -GO - -CREATE NONCLUSTERED INDEX [IX_EarningEventPeriod__Metrics] ON [Payments2].[EarningEventPeriod] -( - [EarningEventId] -) -INCLUDE -( - [TransactionType], - [Amount] -) -WITH (ONLINE = ON) -GO \ No newline at end of file diff --git a/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.EarningEventPriceEpisode.sql b/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.EarningEventPriceEpisode.sql deleted file mode 100644 index fb3025df7..000000000 --- a/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.EarningEventPriceEpisode.sql +++ /dev/null @@ -1,45 +0,0 @@ -CREATE TABLE [Payments2].[EarningEventPriceEpisode] -( - Id BIGINT NOT NULL IDENTITY(1,1) CONSTRAINT PK_EarningEventPriceEpisode PRIMARY KEY CLUSTERED, - EarningEventId UNIQUEIDENTIFIER NOT NULL CONSTRAINT FK_EarningEventPriceEpisode__EarningEvent FOREIGN KEY REFERENCES [Payments2].[EarningEvent] (EventId) ON DELETE CASCADE, - PriceEpisodeIdentifier NVARCHAR(50) NOT NULL, - SfaContributionPercentage DECIMAL(15,5) NOT NULL, - TotalNegotiatedPrice1 DECIMAL(15,5) NOT NULL, - TotalNegotiatedPrice2 DECIMAL(15,5) NULL, - TotalNegotiatedPrice3 DECIMAL(15,5) NULL, - TotalNegotiatedPrice4 DECIMAL(15,5) NULL, - StartDate DATETIME2 NOT NULL, - EffectiveTotalNegotiatedPriceStartDate DATETIME2 NULL, - PlannedEndDate DATETIME2 NOT NULL, - ActualEndDate DATETIME2 NULL, - NumberOfInstalments INT NOT NULL, - InstalmentAmount DECIMAL(15,5) NOT NULL, - CompletionAmount DECIMAL(15,5) NOT NULL, - Completed BIT NOT NULL, - EmployerContribution DECIMAL(15,5) NULL, - CompletionHoldBackExemptionCode INT NULL, - CreationDate DATETIMEOFFSET NOT NULL CONSTRAINT DF_EarningEventPriceEpisode__CreationDate DEFAULT (SYSDATETIMEOFFSET()) , - AgreedPrice DECIMAL(15, 5) NULL, - CourseStartDate DATETIME2 NULL, - AcademicYear SMALLINT NULL, - CollectionPeriod TINYINT NULL, -) -GO - -CREATE NONCLUSTERED INDEX [IX_EarningEventPriceEpisode__EarningEventId] ON [Payments2].[EarningEventPriceEpisode] -( - [EarningEventId] -) -WITH (ONLINE = ON) -GO - -CREATE NONCLUSTERED INDEX [IX_EarningEventPriceEpisode__Search] ON [Payments2].[EarningEventPriceEpisode] -( - [EarningEventId], - [PriceEpisodeIdentifier], - [StartDate], - [CourseStartDate], - [AgreedPrice] -) -WITH (ONLINE = ON) -GO \ No newline at end of file diff --git a/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.EmployerProviderPriority.sql b/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.EmployerProviderPriority.sql deleted file mode 100644 index fb37d3b93..000000000 --- a/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.EmployerProviderPriority.sql +++ /dev/null @@ -1,15 +0,0 @@ -CREATE TABLE [Payments2].[EmployerProviderPriority] -( - Id bigint not null identity Constraint Pk_EmployerProviderPriority Primary Key, - EmployerAccountId bigint not null, - Ukprn bigint not null, - [Order] int not null -) -GO - - -CREATE INDEX [IX_EmployerProviderPriority_EmployerAccountId] ON [Payments2].[EmployerProviderPriority] -( - EmployerAccountId -) -GO \ No newline at end of file diff --git a/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.FundingSourceEvent.sql b/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.FundingSourceEvent.sql deleted file mode 100644 index 198d360a7..000000000 --- a/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.FundingSourceEvent.sql +++ /dev/null @@ -1,102 +0,0 @@ -CREATE TABLE [Payments2].[FundingSourceEvent] -( - Id BIGINT NOT NULL IDENTITY(1,1) CONSTRAINT PK_FundingSourceEvent PRIMARY KEY CLUSTERED, - EventId UNIQUEIDENTIFIER NOT NULL, - EarningEventId UNIQUEIDENTIFIER NOT NULL, - RequiredPaymentEventId UNIQUEIDENTIFIER NOT NULL, - ClawbackSourcePaymentEventId UNIQUEIDENTIFIER NULL, - EventTime DATETIMEOFFSET NOT NULL, - JobId BIGINT NOT NULL, - DeliveryPeriod TINYINT NOT NULL, - CollectionPeriod TINYINT NOT NULL, - AcademicYear SMALLINT NOT NULL, - Ukprn BIGINT NOT NULL, - LearnerReferenceNumber NVARCHAR(50) NOT NULL, - LearnerUln BIGINT NOT NULL, - PriceEpisodeIdentifier NVARCHAR(50) NOT NULL, - Amount DECIMAL(15,5) NOT NULL, - LearningAimReference NVARCHAR(8) NOT NULL, - LearningAimProgrammeType INT NOT NULL , - LearningAimStandardCode INT NOT NULL, - LearningAimFrameworkCode INT NOT NULL, - LearningAimPathwayCode INT NOT NULL, - LearningAimFundingLineType NVARCHAR(100) NOT NULL, - ContractType TINYINT NOT NULL, - TransactionType TINYINT NOT NULL, - FundingSourceType TINYINT NOT NULL, - IlrSubmissionDateTime DATETIME2 NOT NULL, - SfaContributionPercentage DECIMAL(15,5) NOT NULL, - AgreementId NVARCHAR(255) NULL, - AccountId BIGINT NULL, - TransferSenderAccountId BIGINT NULL, - CreationDate DATETIMEOFFSET NOT NULL CONSTRAINT DF_FundingSourceEvent__CreationDate DEFAULT (SYSDATETIMEOFFSET()), - EarningsStartDate DATETIME NOT NULL, - EarningsPlannedEndDate DATETIME NULL, - EarningsActualEndDate DATETIME NULL, - EarningsCompletionStatus TINYINT NOT NULL, - EarningsCompletionAmount DECIMAL (15,5), - EarningsInstalmentAmount DECIMAL (15,5), - EarningsNumberOfInstalments SMALLINT NOT NULL, - LearningStartDate DATETIME2 NULL, - ApprenticeshipId BIGINT NULL, - ApprenticeshipPriceEpisodeId BIGINT NULL, - ApprenticeshipEmployerType TINYINT NULL, - NonPaymentReason TINYINT NULL, - DuplicateNumber INT NULL -) -GO - -CREATE UNIQUE INDEX [UX_FundingSourceEvent_LogicalDuplicates] ON [Payments2].[FundingSourceEvent] -( - [JobId], - [Ukprn], - [AcademicYear], - [CollectionPeriod], - [DeliveryPeriod], - [ContractType], - [TransactionType], - [Amount], - [SfaContributionPercentage], - [LearnerUln], - [LearnerReferenceNumber], - [LearningAimReference], - [LearningAimProgrammeType], - [LearningAimStandardCode], - [LearningAimFrameworkCode], - [LearningAimPathwayCode], - [LearningAimFundingLineType], - [LearningStartDate], - [FundingSourceType], - [ApprenticeshipId], - [AccountId], - [TransferSenderAccountId], - [ApprenticeshipEmployerType], - [ClawbackSourcePaymentEventId], - [DuplicateNumber] -) -GO - -CREATE NONCLUSTERED INDEX [IX_FundingSourceEvent__Audit] ON [Payments2].[FundingSourceEvent] -( - [EarningEventId], - [RequiredPaymentEventId] -) -WITH (ONLINE = ON) -GO - -CREATE NONCLUSTERED INDEX [IX_FundingSourceEvent__Submission] ON [Payments2].[FundingSourceEvent] -( - [AcademicYear], - [CollectionPeriod], - [Ukprn], - [IlrSubmissionDateTime] -) -WITH (ONLINE = ON) -GO - -CREATE NONCLUSTERED INDEX [IX_FundingSourceEvent__JobId] ON [Payments2].[FundingSourceEvent] -( - [JobId] -) -WITH (ONLINE = ON) -GO \ No newline at end of file diff --git a/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.FundingSourceLevyTransaction.sql b/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.FundingSourceLevyTransaction.sql deleted file mode 100644 index 1558518d5..000000000 --- a/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.FundingSourceLevyTransaction.sql +++ /dev/null @@ -1,72 +0,0 @@ -CREATE TABLE [Payments2].[FundingSourceLevyTransaction] -( - [Id] BIGINT NOT NULL IDENTITY(1,1) CONSTRAINT PK_FundingSourceLevyTransaction PRIMARY KEY CLUSTERED, - [Ukprn] BIGINT NOT NULL, - [CollectionPeriod] TINYINT NOT NULL, - [AcademicYear] SMALLINT NOT NULL, - [DeliveryPeriod] TINYINT NOT NULL, - [JobId] BIGINT NOT NULL, - [AccountId] BIGINT NOT NULL, - [TransferSenderAccountId] BIGINT NULL, - [RequiredPaymentEventId] UNIQUEIDENTIFIER NOT NULL, - [EarningEventId] UNIQUEIDENTIFIER NOT NULL, - [ClawbackSourcePaymentEventId] UNIQUEIDENTIFIER NULL, - [CreationDate] DATETIMEOFFSET NOT NULL CONSTRAINT DF_FundingSourceLevyTransaction__CreationDate DEFAULT (SYSDATETIMEOFFSET()), - [Amount] DECIMAL(15,5) NOT NULL, - [MessagePayload] nvarchar(max) not null, - [MessageType] nvarchar(max) not null, - [IlrSubmissionDateTime] DATETIME NOT NULL, - [FundingAccountId] BIGINT NOT NULL, - [TransactionType] TINYINT NULL, - [SfaContributionPercentage] DECIMAL(15,5) NULL, - [LearnerUln] BIGINT NULL, - [LearnerReferenceNumber] NVARCHAR(50) NULL, - [LearningAimReference] NVARCHAR(8) NULL, - [LearningAimProgrammeType] INT NULL , - [LearningAimStandardCode] INT NULL, - [LearningAimFrameworkCode] INT NULL, - [LearningAimPathwayCode] INT NULL, - [LearningAimFundingLineType] NVARCHAR(100) NULL, - [LearningStartDate] DATETIME2 NULL, - [ApprenticeshipId] BIGINT NULL, - [ApprenticeshipEmployerType] TINYINT NULL, - [DuplicateNumber] INT NULL -) -GO - -CREATE NONCLUSTERED INDEX [IX_FundingSourceLevyTransaction__PeriodEnd] ON [Payments2].[FundingSourceLevyTransaction] -([FundingAccountId] ASC,[AcademicYear] ASC,[CollectionPeriod] ASC) -WITH (ONLINE = ON) -GO - -CREATE NONCLUSTERED INDEX [IX_FundingSourceLevyTransaction__SubmissionCleanup] -ON [Payments2].[FundingSourceLevyTransaction] ([Ukprn],[CollectionPeriod],[AcademicYear],[JobId],[IlrSubmissionDateTime]) -GO - -CREATE UNIQUE INDEX [UX_FundingSourceLevyTransaction_LogicalDuplicates] ON [Payments2].[FundingSourceLevyTransaction] -( -[JobId], -[Ukprn], -[AcademicYear], -[CollectionPeriod], -[DeliveryPeriod], -[TransactionType], -[Amount], -[SfaContributionPercentage], -[LearnerUln], -[LearnerReferenceNumber], -[LearningAimReference], -[LearningAimProgrammeType], -[LearningAimStandardCode], -[LearningAimFrameworkCode], -[LearningAimPathwayCode], -[LearningAimFundingLineType], -[LearningStartDate], -[ApprenticeshipId], -[AccountId], -[TransferSenderAccountId], -[ApprenticeshipEmployerType], -[ClawbackSourcePaymentEventId], -[DuplicateNumber] -) -GO \ No newline at end of file diff --git a/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.Job.sql b/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.Job.sql deleted file mode 100644 index da894c7e3..000000000 --- a/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.Job.sql +++ /dev/null @@ -1,42 +0,0 @@ -Create TABLE [Payments2].[Job] -( - JobId BIGINT NOT NULL IDENTITY(1,1) CONSTRAINT PK_Job PRIMARY KEY CLUSTERED, - JobType TINYINT NOT NULL CONSTRAINT FK_Job__JobType FOREIGN KEY REFERENCES [Payments2].[JobType] (Id), - StartTime DATETIMEOFFSET NOT NULL CONSTRAINT DF_Job__StartTime DEFAULT (SYSDATETIMEOFFSET()), - EndTime DATETIMEOFFSET NULL, - [Status] TINYINT NOT NULL CONSTRAINT FK_Job__JobStatus FOREIGN KEY REFERENCES [Payments2].[JobStatus] (Id) CONSTRAINT DF_Job__Status DEFAULT (1), - CreationDate DATETIMEOFFSET NOT NULL CONSTRAINT DF_Job__CreationDate DEFAULT (SYSDATETIMEOFFSET()), - DCJobId BIGINT NULL, - Ukprn BIGINT NULL, - IlrSubmissionTime DATETIME NULL, - LearnerCount INT NULL, - AcademicYear SMALLINT NOT NULL, - CollectionPeriod TINYINT NOT NULL, - DataLocksCompletionTime DATETIMEOFFSET NULL, - DCJobSucceeded BIT NULL, - DCJobEndTime DATETIMEOFFSET NULL -) -GO - -CREATE INDEX [IX_Job__Search] ON [Payments2].[Job] -( - JobId, - JobType, - DCJobId, - Ukprn, - [Status], - StartTime, - EndTime, - DataLocksCompletionTime, - DCJobSucceeded, - DCJobEndTime -) -GO - -CREATE INDEX IX_Payments2_Job__IlrSubmissionTime -ON Payments2.Job (IlrSubmissionTime) -GO - -CREATE NONCLUSTERED INDEX [IX_Payments2_Job_Search] -ON [Payments2].[Job] ([DCJobId], [AcademicYear], [DCJobSucceeded], [JobType], [Status]) -INCLUDE ([IlrSubmissionTime], [Ukprn]) WITH (ONLINE = ON) \ No newline at end of file diff --git a/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.JobEvent.sql b/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.JobEvent.sql deleted file mode 100644 index d3208325c..000000000 --- a/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.JobEvent.sql +++ /dev/null @@ -1,23 +0,0 @@ -CREATE TABLE [Payments2].[JobEvent] -( - JobEventId BIGINT NOT NULL IDENTITY(1,1) CONSTRAINT PK_JobEvent PRIMARY KEY CLUSTERED, - JobId BIGINT NOT NULL CONSTRAINT FK_JobEvent__Job FOREIGN KEY REFERENCES [Payments2].[Job] (JobId), - EventId UNIQUEIDENTIFIER NOT NULL, - ParentEventId UNIQUEIDENTIFIER NULL, - [Status] TINYINT NOT NULL CONSTRAINT FK_JobEvent__JobEventStatus FOREIGN KEY REFERENCES [Payments2].[JobEventStatus] (Id) CONSTRAINT DF_Job_Event__Status DEFAULT (1), - StartTime DATETIMEOFFSET NULL, - EndTime DATETIMEOFFSET NULL, - MessageName NVARCHAR(250) NOT NULL, - CreationDate DATETIMEOFFSET NOT NULL CONSTRAINT DF_JobEvent__CreationDate DEFAULT (SYSUTCDATETIME()), - CONSTRAINT UC_JobEvent__JobId_EventId UNIQUE (JobId,EventId) -) -GO - -CREATE INDEX [IX_JobEvent__Search] ON [Payments2].[JobEvent]( - JobEventId, - JobId, - EventId, - [Status], - EndTime -) -GO \ No newline at end of file diff --git a/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.JobEventStatus.sql b/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.JobEventStatus.sql deleted file mode 100644 index 044a791ae..000000000 --- a/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.JobEventStatus.sql +++ /dev/null @@ -1,4 +0,0 @@ -CREATE TABLE [Payments2].[JobEventStatus] ( - Id TINYINT NOT NULL CONSTRAINT PK_JobEventStatus PRIMARY KEY CLUSTERED, - [Description] VARCHAR(255) NOT NULL -) diff --git a/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.JobProviderEarnings.sql b/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.JobProviderEarnings.sql deleted file mode 100644 index f6f5d940a..000000000 --- a/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.JobProviderEarnings.sql +++ /dev/null @@ -1,9 +0,0 @@ -Create TABLE [Payments2].[JobProviderEarnings]( - JobId BIGINT NOT NULL CONSTRAINT PK_JobProviderEarnings PRIMARY KEY CLUSTERED CONSTRAINT FK_JobProviderEarnings__Job FOREIGN KEY REFERENCES [Payments2].[Job] (JobId), - DCJobId BIGINT NOT NULL, - Ukprn BIGINT NOT NULL, - IlrSubmissionTime DATETIME2 NOT NULL, - CollectionYear VARCHAR(4) NOT NULL, - CollectionPeriod TINYINT NOT NULL, - INDEX IX_JobProviderEarnings__DCJobId_Ukprn NONCLUSTERED (DCJobId, Ukprn) -) diff --git a/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.JobStatus.sql b/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.JobStatus.sql deleted file mode 100644 index 15e6938db..000000000 --- a/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.JobStatus.sql +++ /dev/null @@ -1,4 +0,0 @@ -CREATE TABLE [Payments2].[JobStatus] ( - Id TINYINT NOT NULL CONSTRAINT PK_JobStatus PRIMARY KEY CLUSTERED, - [Description] VARCHAR(255) NOT NULL -) \ No newline at end of file diff --git a/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.JobType.sql b/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.JobType.sql deleted file mode 100644 index 053a7ca71..000000000 --- a/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.JobType.sql +++ /dev/null @@ -1,5 +0,0 @@ -CREATE TABLE [Payments2].[JobType] -( - Id TINYINT NOT NULL CONSTRAINT PK_JobType PRIMARY KEY CLUSTERED, - [Description] VARCHAR(255) NOT NULL -) diff --git a/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.LevyAccount.sql b/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.LevyAccount.sql deleted file mode 100644 index fd0a951d5..000000000 --- a/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.LevyAccount.sql +++ /dev/null @@ -1,9 +0,0 @@ -CREATE TABLE [Payments2].[LevyAccount] -( - [AccountId] BIGINT NOT NULL , - [AccountName] VARCHAR(255) NOT NULL, - [Balance] DECIMAL(18, 4) NOT NULL, - [IsLevyPayer] BIT NOT NULL, - [TransferAllowance] DECIMAL(18, 4) NOT NULL, - PRIMARY KEY ([AccountId]) -) diff --git a/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.LevyAccountAudit.sql b/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.LevyAccountAudit.sql deleted file mode 100644 index c36e21a38..000000000 --- a/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.LevyAccountAudit.sql +++ /dev/null @@ -1,13 +0,0 @@ -CREATE TABLE [Payments2].[LevyAccountAudit] -( - [Id] BIGINT NOT NULL IDENTITY(1,1) CONSTRAINT PK_LevyAccountAudit PRIMARY KEY CLUSTERED, - [AccountId] BIGINT NOT NULL, - [AcademicYear] SMALLINT NOT NULL, - [CollectionPeriod] TINYINT NOT NULL, - [SourceLevyAccountBalance] DECIMAL(18, 4) NOT NULL, - [AdjustedLevyAccountBalance] DECIMAL(18, 4) NOT NULL, - [SourceTransferAllowance] DECIMAL(18, 4) NOT NULL, - [AdjustedTransferAllowance] DECIMAL(18, 4) NOT NULL, - [IsLevyPayer] BIT NOT NULL, - [CreationDate] DATETIMEOFFSET NOT NULL CONSTRAINT DF_LevyAccountAudit__CreationDate DEFAULT (SYSDATETIMEOFFSET()) -) diff --git a/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.Payment.sql b/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.Payment.sql deleted file mode 100644 index 795e7a4a7..000000000 --- a/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.Payment.sql +++ /dev/null @@ -1,179 +0,0 @@ -CREATE TABLE [Payments2].[Payment] -( - Id BIGINT NOT NULL IDENTITY(1,1) CONSTRAINT PK_Payment PRIMARY KEY, - EventId UNIQUEIDENTIFIER NOT NULL CONSTRAINT DF_Payment__EventId DEFAULT(NEWID()), CONSTRAINT UQ_Payment__EventId UNIQUE([EventId]), - EarningEventId UNIQUEIDENTIFIER NOT NULL, - FundingSourceEventId UNIQUEIDENTIFIER NOT NULL, - RequiredPaymentEventId UNIQUEIDENTIFIER NULL, - ClawbackSourcePaymentEventId UNIQUEIDENTIFIER NULL, - EventTime DATETIMEOFFSET NOT NULL, - JobId BIGINT NOT NULL, - DeliveryPeriod TINYINT NOT NULL, - CollectionPeriod TINYINT NOT NULL, - AcademicYear SMALLINT CONSTRAINT DF_Payment__AcademicYear DEFAULT ((0)) NOT NULL, - Ukprn BIGINT NOT NULL, - LearnerReferenceNumber NVARCHAR(50) NOT NULL, - LearnerUln BIGINT NOT NULL, - PriceEpisodeIdentifier NVARCHAR(50) NOT NULL, - Amount DECIMAL(15,5) NOT NULL, - LearningAimReference NVARCHAR(8) NOT NULL, - LearningAimProgrammeType INT NOT NULL , - LearningAimStandardCode INT NOT NULL, - LearningAimFrameworkCode INT NOT NULL, - LearningAimPathwayCode INT NOT NULL, - LearningAimFundingLineType NVARCHAR(100) NOT NULL, - ContractType TINYINT NOT NULL, - TransactionType TINYINT NOT NULL, - FundingSource TINYINT NOT NULL, - IlrSubmissionDateTime DATETIME2 NOT NULL, - SfaContributionPercentage DECIMAL(15,5) NOT NULL, - AgreementId NVARCHAR(255) NULL, - AccountId BIGINT NULL , - TransferSenderAccountId BIGINT NULL , - CreationDate DATETIMEOFFSET NOT NULL CONSTRAINT DF_Payment__CreationDate DEFAULT (SYSDATETIMEOFFSET()), - EarningsStartDate DATETIME NOT NULL, - EarningsPlannedEndDate DATETIME NULL, - EarningsActualEndDate DATETIME NULL, - EarningsCompletionStatus TINYINT NULL, - EarningsCompletionAmount DECIMAL (15,5) NULL, - EarningsInstalmentAmount DECIMAL (15,5) NULL, - EarningsNumberOfInstalments SMALLINT NULL, - LearningStartDate DATETIME2 NULL, - ApprenticeshipId BIGINT NULL, - ApprenticeshipPriceEpisodeId BIGINT NULL, - ApprenticeshipEmployerType TINYINT NULL, - ReportingAimFundingLineType NVARCHAR(120) NULL, - NonPaymentReason TINYINT NULL, - DuplicateNumber INT NULL, - LearningAimSequenceNumber BIGINT NULL -); -GO - -CREATE UNIQUE INDEX UX_Payment_LogicalDuplicates ON [Payments2].[Payment] -( - [JobId], - [Ukprn], - [AcademicYear], - [CollectionPeriod], - [DeliveryPeriod], - [ContractType], - [TransactionType], - [Amount], - [SfaContributionPercentage], - [LearnerUln], - [LearnerReferenceNumber], - [LearningAimReference], - [LearningAimProgrammeType], - [LearningAimStandardCode], - [LearningAimFrameworkCode], - [LearningAimPathwayCode], - [LearningAimFundingLineType], - [LearningStartDate], - [FundingSource], - [ApprenticeshipId], - [AccountId], - [TransferSenderAccountId], - [ApprenticeshipEmployerType], - [ClawbackSourcePaymentEventId], - [DuplicateNumber] -) -GO - -CREATE NONCLUSTERED INDEX [IX_Payment__ApprenticeshipKey] ON [Payments2].[Payment] -( - [Ukprn] ASC, - [AcademicYear] ASC, - [LearnerReferenceNumber] ASC, - [LearningAimReference] ASC, - [LearningAimProgrammeType] ASC, - [LearningAimStandardCode] ASC, - [LearningAimFrameworkCode] ASC, - [LearningAimPathwayCode] ASC, - [ContractType] ASC, - [LearnerUln] ASC -) -WITH (ONLINE = ON) -GO - -CREATE NONCLUSTERED INDEX [IX_Payment__UkprnPeriodSearch] ON [Payments2].[Payment] -( - [Ukprn], - [CollectionPeriod], - [AcademicYear], - [DeliveryPeriod], - [JobId] -) -WITH (ONLINE = ON) -GO - -CREATE NONCLUSTERED INDEX [IX_Payment__Audit] ON [Payments2].[Payment] -( - [EarningEventId], - [FundingSourceEventId] -) -WITH (ONLINE = ON) -GO - -CREATE NONCLUSTERED INDEX [IX_Payment__Metrics_Paid_DataLocks] ON [Payments2].[Payment] -( - [Ukprn], - [LearnerReferenceNumber] ASC, - [LearningAimReference] ASC, - [LearningAimProgrammeType] ASC, - [LearningAimStandardCode] ASC, - [LearningAimFrameworkCode] ASC, - [LearningAimPathwayCode] ASC, - [CollectionPeriod] -) -INCLUDE -( - [Amount], - [TransactionType], - [DeliveryPeriod] -) -WITH (ONLINE = ON) -GO - -CREATE NONCLUSTERED INDEX [IX_Payment__CollectionPeriodCompletionPayments] on [Payments2].[Payment] -( - [Ukprn], - [ContractType], - [TransactionType] -) -WITH (ONLINE = ON) -GO - -CREATE NONCLUSTERED INDEX [UX_Payment_ProviderEvents] ON [Payments2].[Payment] -( - [CollectionPeriod], - [AcademicYear], - [AccountId], - [FundingSource], - [TransferSenderAccountId], - [ApprenticeshipId] -) -INCLUDE -( - [EventId], - [RequiredPaymentEventId], - [DeliveryPeriod], - [Ukprn], - [LearnerUln], - [Amount], - [LearningAimProgrammeType], - [LearningAimStandardCode], - [LearningAimFrameworkCode], - [LearningAimPathwayCode], - [TransactionType], - [IlrSubmissionDateTime], - [EarningsStartDate], - [EarningsPlannedEndDate], - [EarningsActualEndDate], - [EarningsCompletionStatus], - [EarningsCompletionAmount], - [EarningsInstalmentAmount], - [EarningsNumberOfInstalments], - [ContractType] -) -WITH (ONLINE = ON) -GO \ No newline at end of file diff --git a/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.ProviderAdjustmentPayments.sql b/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.ProviderAdjustmentPayments.sql deleted file mode 100644 index e40ca06e2..000000000 --- a/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.ProviderAdjustmentPayments.sql +++ /dev/null @@ -1,22 +0,0 @@ -CREATE TABLE [Payments2].[ProviderAdjustmentPayments] -( - [Ukprn] [bigint] NOT NULL, - [SubmissionId] [uniqueidentifier] NOT NULL, - [SubmissionCollectionPeriod] [int] NOT NULL, - [SubmissionAcademicYear] [int] NOT NULL, - [PaymentType] [int] NOT NULL, - [PaymentTypeName] [nvarchar](250) NOT NULL, - [Amount] [decimal](15, 5) NOT NULL, - [CollectionPeriodName] [varchar](8) NOT NULL, - [CollectionPeriodMonth] [int] NOT NULL, - [CollectionPeriodYear] [int] NOT NULL, -PRIMARY KEY CLUSTERED -( - [Ukprn] ASC, - [SubmissionId] ASC, - [SubmissionCollectionPeriod] ASC, - [SubmissionAcademicYear] ASC, - [PaymentType] ASC, - [CollectionPeriodName] ASC - ) -) diff --git a/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.ProviderRequiringReprocessing.sql b/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.ProviderRequiringReprocessing.sql deleted file mode 100644 index b8c1bc325..000000000 --- a/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.ProviderRequiringReprocessing.sql +++ /dev/null @@ -1,14 +0,0 @@ -Create TABLE [Payments2].[ProviderRequiringReprocessing] -( - Id BIGINT NOT NULL IDENTITY(1,1) CONSTRAINT PK_ProviderRequiringReprocessing PRIMARY KEY CLUSTERED, - Ukprn BIGINT NOT NULL, - CreationDate DateTimeOffset(7) DEFAULT SYSDATETIMEOFFSET(), -) -GO - -CREATE UNIQUE INDEX [UX_ProviderRequiringReprocessing__Ukprn] ON [Payments2].[ProviderRequiringReprocessing] -( - Ukprn -) WITH (IGNORE_DUP_KEY = ON) -GO - diff --git a/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.ReceivedDataLockEvent.sql b/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.ReceivedDataLockEvent.sql deleted file mode 100644 index 95dfa32a8..000000000 --- a/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.ReceivedDataLockEvent.sql +++ /dev/null @@ -1,15 +0,0 @@ -CREATE TABLE Payments2.ReceivedDataLockEvent -( - [Id] BIGINT NOT NULL CONSTRAINT PK_ReceivedDataLockEvent PRIMARY KEY IDENTITY, - [Ukprn] BIGINT NOT NULL, - [JobId] BIGINT NOT NULL, - [MessageType] NVARCHAR(2000) NOT NULL, - [Message] NVARCHAR(MAX) NOT NULL, - [CreationDate] DATETIME2 NOT NULL DEFAULT sysutcdatetime() -) - - -GO - -CREATE INDEX [IX_ReceivedDataLockEvent_Ukprn_JobId] ON [Payments2].[ReceivedDataLockEvent] -([Ukprn], [JobId]) diff --git a/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.RequiredPaymentEvent.sql b/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.RequiredPaymentEvent.sql deleted file mode 100644 index d81be9956..000000000 --- a/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.RequiredPaymentEvent.sql +++ /dev/null @@ -1,121 +0,0 @@ -CREATE TABLE [Payments2].[RequiredPaymentEvent] -( - Id BIGINT NOT NULL IDENTITY(1,1) CONSTRAINT PK_RequiredPaymentEvent PRIMARY KEY CLUSTERED, - EventId UNIQUEIDENTIFIER NOT NULL, - EarningEventId UNIQUEIDENTIFIER NOT NULL, - [ClawbackSourcePaymentEventId] UNIQUEIDENTIFIER NULL, - PriceEpisodeIdentifier NVARCHAR(50) NOT NULL, - Ukprn BIGINT NOT NULL, - ContractType TINYINT NOT NULL, - TransactionType TINYINT NOT NULL, - SfaContributionPercentage DECIMAL(15,5) NOT NULL, - Amount DECIMAL(15,5) NOT NULL, - CollectionPeriod TINYINT NOT NULL, - AcademicYear SMALLINT NOT NULL, - DeliveryPeriod TINYINT NOT NULL, - LearnerReferenceNumber NVARCHAR(50) NOT NULL, - LearnerUln BIGINT NOT NULL, - LearningAimReference NVARCHAR(8) NOT NULL, - LearningAimProgrammeType INT NOT NULL , - LearningAimStandardCode INT NOT NULL, - LearningAimFrameworkCode INT NOT NULL, - LearningAimPathwayCode INT NOT NULL, - LearningAimFundingLineType NVARCHAR(100) NOT NULL, - AgreementId NVARCHAR(255) NULL, - IlrSubmissionDateTime DATETIME2 NOT NULL, - JobId BIGINT NOT NULL, - EventTime DATETIMEOFFSET NOT NULL, - AccountId BIGINT NULL , - TransferSenderAccountId BIGINT NULL , - CreationDate DATETIMEOFFSET NOT NULL CONSTRAINT DF_RequiredPaymentEvent__CreationDate DEFAULT (SYSDATETIMEOFFSET()), - EarningsStartDate DATETIME NOT NULL, - EarningsPlannedEndDate DATETIME NULL, - EarningsActualEndDate DATETIME NULL, - EarningsCompletionStatus TINYINT NOT NULL, - EarningsCompletionAmount DECIMAL (15,5), - EarningsInstalmentAmount DECIMAL (15,5), - EarningsNumberOfInstalments SMALLINT NOT NULL, - LearningStartDate DATETIME2 NULL, - ApprenticeshipId BIGINT NULL, - ApprenticeshipPriceEpisodeId BIGINT NULL, - ApprenticeshipEmployerType TINYINT NULL, - NonPaymentReason TINYINT NULL, - EventType NVARCHAR(4000) NULL, - DuplicateNumber INT NULL -) -GO - -CREATE UNIQUE INDEX [UX_RequiredPaymentEvent_LogicalDuplicates] ON [Payments2].[RequiredPaymentEvent] -( - [JobId], - [Ukprn], - [AcademicYear], - [CollectionPeriod], - [DeliveryPeriod], - [ContractType], - [TransactionType], - [Amount], - [SfaContributionPercentage], - [LearnerUln], - [LearnerReferenceNumber], - [LearningAimReference], - [LearningAimProgrammeType], - [LearningAimStandardCode], - [LearningAimFrameworkCode], - [LearningAimPathwayCode], - [LearningAimFundingLineType], - [LearningStartDate], - [EventType], - [ApprenticeshipId], - [AccountId], - [TransferSenderAccountId], - [ApprenticeshipEmployerType], - [ClawbackSourcePaymentEventId], - [DuplicateNumber] -) -GO - -CREATE NONCLUSTERED INDEX [IX_RequiredPaymentEvent__Audit] ON [Payments2].[RequiredPaymentEvent] -( - [EarningEventId] -) -WITH (ONLINE = ON) -GO - -CREATE NONCLUSTERED INDEX [IX_RequiredPaymentEvent_Submission] ON [Payments2].[RequiredPaymentEvent] -( - [AcademicYear], - [CollectionPeriod], - [Ukprn], - [IlrSubmissionDateTime] -) -WITH (ONLINE = ON) -GO - -CREATE NONCLUSTERED INDEX [IX_RequiredPaymentEvent__Metrics] ON [Payments2].[RequiredPaymentEvent] -( - [Ukprn], - [JobId], - [NonPaymentReason] -) -INCLUDE -( - [ContractType], - [TransactionType], - [Amount] -) -WITH (ONLINE = ON) -Go - -CREATE NONCLUSTERED INDEX [IX_RequiredPaymentEvent__AcademicYear_CollectionPeriod_JobId] ON [Payments2].[RequiredPaymentEvent] -( - [AcademicYear], - [CollectionPeriod], - [JobId] -) -INCLUDE -( - [EventId] -) -WITH (ONLINE = ON) -GO \ No newline at end of file diff --git a/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.SubmittedLearnerAim.sql b/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.SubmittedLearnerAim.sql deleted file mode 100644 index 1cab0dadb..000000000 --- a/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.SubmittedLearnerAim.sql +++ /dev/null @@ -1,54 +0,0 @@ -CREATE TABLE [Payments2].[SubmittedLearnerAim] -( - [Id] BIGINT NOT NULL IDENTITY(1,1) CONSTRAINT PK_SubmittedLearnerAim PRIMARY KEY CLUSTERED, - [Ukprn] BIGINT NOT NULL, - [LearnerReferenceNumber] NVARCHAR(12) NOT NULL, - [LearningAimFrameworkCode] INT NOT NULL, - [LearningAimPathwayCode] INT NOT NULL, - [LearningAimProgrammeType] INT NOT NULL, - [LearningAimStandardCode] INT NOT NULL, - [LearningAimReference] NVARCHAR(8) NOT NULL, - [CollectionPeriod] TINYINT NOT NULL, - [AcademicYear] SMALLINT NOT NULL, - [IlrSubmissionDateTime] DATETIME2 NOT NULL, - [CreationDate] DATETIMEOFFSET NOT NULL CONSTRAINT DF_SubmittedLearnerAim_CreationDate DEFAULT (SYSDATETIMEOFFSET()), - [LearnerUln] BIGINT NULL, - [JobId] BIGINT NOT NULL, - [ContractType] TINYINT NOT NULL, -) - -GO - -CREATE INDEX [IX_SubmittedLearnerAim_ApprenticeshipKey] ON [Payments2].[SubmittedLearnerAim] ([Ukprn], [LearnerReferenceNumber], [LearningAimFrameworkCode], [LearningAimPathwayCode], [LearningAimProgrammeType], [LearningAimStandardCode], [LearningAimReference], [ContractType]) -Go - -CREATE INDEX [IX_SubmittedLearnerAim__Delete] ON [Payments2].[SubmittedLearnerAim] -( - [Ukprn], - [AcademicYear], - [CollectionPeriod], - [IlrSubmissionDateTime] -) -INCLUDE -( - [LearnerUln] -) -Go - -CREATE NONCLUSTERED INDEX [IX_SubmittedLearnerAim_RemovedLearningAim] ON [Payments2].[SubmittedLearnerAim] -( - [Ukprn], - [CollectionPeriod], - [AcademicYear] -) -INCLUDE -( - [LearnerReferenceNumber], - [LearningAimFrameworkCode], - [LearningAimPathwayCode], - [LearningAimProgrammeType], - [LearningAimStandardCode], - [LearningAimReference], - [ContractType] -) -GO \ No newline at end of file diff --git a/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.TestingProvider.sql b/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.TestingProvider.sql deleted file mode 100644 index 0e120f865..000000000 --- a/src/SFA.DAS.Payments.Database/Payments2/Tables/Payments2.TestingProvider.sql +++ /dev/null @@ -1,5 +0,0 @@ -CREATE TABLE [Payments2].[TestingProvider] -( - [Ukprn] INT NOT NULL PRIMARY KEY, - [LastUsed] DATETIME NOT NULL DEFAULT GetUtcDate() -) diff --git a/src/SFA.DAS.Payments.Database/Payments2/Views/Payments2.DataMatchReport.sql b/src/SFA.DAS.Payments.Database/Payments2/Views/Payments2.DataMatchReport.sql deleted file mode 100644 index 1b3f29765..000000000 --- a/src/SFA.DAS.Payments.Database/Payments2/Views/Payments2.DataMatchReport.sql +++ /dev/null @@ -1,24 +0,0 @@ -CREATE VIEW [Payments2].[DataMatchReport] -AS - -SELECT (CASE WHEN Dle.Datalocksourceid = 1 THEN 'ILR' ELSE 'DAS_PE' END) AS Collectiontype - , Dle.Ukprn - , Dle.Learnerreferencenumber - , Dle.Learneruln - , Dlenppf.Datalockfailureid - , Ee.Learningaimsequencenumber - , Dle.Collectionperiod - , Dle.Academicyear - , Dle.Ilrsubmissiondatetime - , Dlenpp.Deliveryperiod - , Dle.Datalocksourceid - , Dle.Ispayable - , Dle.Learningaimreference - , Dle.Jobid -FROM Payments2.Datalockevent AS Dle WITH (NOLOCK) -INNER JOIN Payments2.Earningevent AS Ee WITH (NOLOCK) ON Dle.Earningeventid = Ee.Eventid -INNER JOIN Payments2.Datalockeventnonpayableperiod AS Dlenpp WITH (NOLOCK) ON Dle.Eventid = Dlenpp.Datalockeventid -INNER JOIN Payments2.Datalockeventnonpayableperiodfailures AS Dlenppf WITH (NOLOCK) ON Dlenpp.Datalockeventnonpayableperiodid = Dlenppf.Datalockeventnonpayableperiodid -INNER JOIN Payments2.Latestsuccessfuldatalockjobs Lsj WITH (NOLOCK) ON Dle.Jobid = Lsj.Dcjobid -WHERE Dle.Ispayable = 0 - AND Dle.Learningaimreference = 'ZPROG001' \ No newline at end of file diff --git a/src/SFA.DAS.Payments.Database/Payments2/Views/Payments2.LatestSuccessfulDataLockJobs.sql b/src/SFA.DAS.Payments.Database/Payments2/Views/Payments2.LatestSuccessfulDataLockJobs.sql deleted file mode 100644 index ebf34b6e4..000000000 --- a/src/SFA.DAS.Payments.Database/Payments2/Views/Payments2.LatestSuccessfulDataLockJobs.sql +++ /dev/null @@ -1,17 +0,0 @@ -CREATE VIEW [Payments2].[LatestSuccessfulDataLockJobs] AS - -WITH Validjobs AS - ( - SELECT max(Ilrsubmissiontime) [IlrSubmissionTime], Ukprn, AcademicYear - FROM Payments2.Job - WHERE Status IN (1, 2, 3) - AND Dcjobsucceeded = 1 - AND Jobtype = 1 - GROUP BY Ukprn, AcademicYear - ) -SELECT J.* -FROM Payments2.Job AS J -JOIN Validjobs AS Vj - ON J.Ilrsubmissiontime = Vj.Ilrsubmissiontime - AND J.Ukprn = Vj.Ukprn - AND J.AcademicYear = VJ.AcademicYear diff --git a/src/SFA.DAS.Payments.Database/Payments2/Views/Payments2.LatestSuccessfulJobs.sql b/src/SFA.DAS.Payments.Database/Payments2/Views/Payments2.LatestSuccessfulJobs.sql deleted file mode 100644 index fdcb830a5..000000000 --- a/src/SFA.DAS.Payments.Database/Payments2/Views/Payments2.LatestSuccessfulJobs.sql +++ /dev/null @@ -1,17 +0,0 @@ -CREATE VIEW [Payments2].[LatestSuccessfulJobs] -AS - -WITH validJobs AS ( - SELECT MAX(IlrSubmissionTime) AS IlrSubmissionTime, Ukprn, AcademicYear - FROM Payments2.Job - WHERE (Status IN (2, 3)) - AND (DCJobSucceeded = 1) - AND (JobType = 1) - GROUP BY Ukprn, AcademicYear) - SELECT j.* - FROM Payments2.Job AS j - INNER JOIN validJobs AS vj - ON j.IlrSubmissionTime = vj.IlrSubmissionTime - AND j.Ukprn = vj.Ukprn - AND j.AcademicYear = vj.AcademicYear - diff --git a/src/SFA.DAS.Payments.Database/SFA.DAS.Payments.Database.refactorlog b/src/SFA.DAS.Payments.Database/SFA.DAS.Payments.Database.refactorlog deleted file mode 100644 index d36d75b60..000000000 --- a/src/SFA.DAS.Payments.Database/SFA.DAS.Payments.Database.refactorlog +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/SFA.DAS.Payments.Database/SFA.DAS.Payments.Database.sqlproj b/src/SFA.DAS.Payments.Database/SFA.DAS.Payments.Database.sqlproj deleted file mode 100644 index 25fdd5e3c..000000000 --- a/src/SFA.DAS.Payments.Database/SFA.DAS.Payments.Database.sqlproj +++ /dev/null @@ -1,171 +0,0 @@ - - - - - Debug - AnyCPU - SFA.DAS.Payments.Database - 2.0 - 4.1 - {a99eda09-50b8-439d-afb5-323feaa5ca4d} - Microsoft.Data.Tools.Schema.Sql.SqlAzureV12DatabaseSchemaProvider - Database - - - SFA.DAS.Payments.Database - SFA.DAS.Payments.Database - 1033, CI - BySchemaAndSchemaType - True - v4.7.1 - CS - Properties - False - True - True - Payments2 - True - SIMPLE - SFA.DAS.Payments - True - - - bin\Release\ - $(MSBuildProjectName).sql - False - pdbonly - true - false - true - prompt - 4 - - - bin\Debug\ - $(MSBuildProjectName).sql - false - true - full - false - true - true - prompt - 4 - - - 11.0 - - True - 11.0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Local Machine - $(SqlCmdVar__4) - - - X.Y.Z-LocalDev - $(SqlCmdVar__3) - - - NotUsedLocally!!! - $(SqlCmdVar__6) - - - From Local Machine - $(SqlCmdVar__5) - - - NotUsedLocally! - $(SqlCmdVar__1) - - - NotUsedLocally!! - $(SqlCmdVar__2) - - - - - - - - - \ No newline at end of file diff --git a/src/SFA.DAS.Payments.Database/Security/RoleMemberships.sql b/src/SFA.DAS.Payments.Database/Security/RoleMemberships.sql deleted file mode 100644 index 47643f529..000000000 --- a/src/SFA.DAS.Payments.Database/Security/RoleMemberships.sql +++ /dev/null @@ -1,9 +0,0 @@ - -GO ---ALTER ROLE [DataViewer] ADD MEMBER [User_DSCI]; -GO -ALTER ROLE [DataViewer] ADD MEMBER [DASPaymentROUser]; -GO -ALTER ROLE [DataProcessing] ADD MEMBER [DASPaymentRWUser]; -GO - diff --git a/src/SFA.DAS.Payments.Database/Security/Role_DataProcessing.sql b/src/SFA.DAS.Payments.Database/Security/Role_DataProcessing.sql deleted file mode 100644 index b2502f468..000000000 --- a/src/SFA.DAS.Payments.Database/Security/Role_DataProcessing.sql +++ /dev/null @@ -1,29 +0,0 @@ - -CREATE ROLE [DataProcessing] AUTHORIZATION [dbo] -GO - --- Grant access rights to a specific schema in the database -GRANT - DELETE, - EXECUTE, - INSERT, - REFERENCES, - SELECT, - UPDATE, - ALTER, - VIEW DEFINITION -ON SCHEMA::[Payments2] - TO [DataProcessing] -GO - -GRANT - DELETE, - EXECUTE, - INSERT, - REFERENCES, - SELECT, - UPDATE, - VIEW DEFINITION -ON SCHEMA::[Metrics] - TO [DataProcessing] -GO diff --git a/src/SFA.DAS.Payments.Database/Security/Role_DataViewer.sql b/src/SFA.DAS.Payments.Database/Security/Role_DataViewer.sql deleted file mode 100644 index 4a2b7720a..000000000 --- a/src/SFA.DAS.Payments.Database/Security/Role_DataViewer.sql +++ /dev/null @@ -1,20 +0,0 @@ - -CREATE ROLE [DataViewer] AUTHORIZATION [dbo] -GO - --- Grant access rights to a specific schema in the database -GRANT - REFERENCES, - SELECT, - VIEW DEFINITION -ON SCHEMA::[Payments2] - TO [DataViewer] -GO - -GRANT - REFERENCES, - SELECT, - VIEW DEFINITION -ON SCHEMA::[Metrics] - TO [DataViewer] -GO \ No newline at end of file diff --git a/src/SFA.DAS.Payments.Database/Security/Schema_Payments2.sql b/src/SFA.DAS.Payments.Database/Security/Schema_Payments2.sql deleted file mode 100644 index 093cfad97..000000000 --- a/src/SFA.DAS.Payments.Database/Security/Schema_Payments2.sql +++ /dev/null @@ -1,7 +0,0 @@ -CREATE SCHEMA [Payments2] - AUTHORIZATION [dbo]; - - - - - diff --git a/src/SFA.DAS.Payments.Database/Security/User_DsciUser.sql b/src/SFA.DAS.Payments.Database/Security/User_DsciUser.sql deleted file mode 100644 index 8b021eb40..000000000 --- a/src/SFA.DAS.Payments.Database/Security/User_DsciUser.sql +++ /dev/null @@ -1,7 +0,0 @@ - -CREATE USER [User_DSCI] - WITH PASSWORD = N'$(DsciUserPassword)'; -GO - -GRANT CONNECT TO [User_DSCI] -GO diff --git a/src/SFA.DAS.Payments.Database/Security/User_RO.sql b/src/SFA.DAS.Payments.Database/Security/User_RO.sql deleted file mode 100644 index f1df84064..000000000 --- a/src/SFA.DAS.Payments.Database/Security/User_RO.sql +++ /dev/null @@ -1,7 +0,0 @@ -CREATE USER [DASPaymentROUser] - WITH PASSWORD = N'$(ROUserPassword)'; -GO -GRANT CONNECT TO [DASPaymentROUser] -GO - - diff --git a/src/SFA.DAS.Payments.Database/Security/User_RW.sql b/src/SFA.DAS.Payments.Database/Security/User_RW.sql deleted file mode 100644 index 71e999cc8..000000000 --- a/src/SFA.DAS.Payments.Database/Security/User_RW.sql +++ /dev/null @@ -1,7 +0,0 @@ -CREATE USER [DASPaymentRWUser] - WITH PASSWORD = N'$(RWUserPassword)'; -GO -GRANT CONNECT TO [DASPaymentRWUser] -GO - - diff --git a/src/SFA.DAS.Payments.Database/dbo/Stored Procedures/dbo.MetricsPayments.sql b/src/SFA.DAS.Payments.Database/dbo/Stored Procedures/dbo.MetricsPayments.sql deleted file mode 100644 index bf51641da..000000000 --- a/src/SFA.DAS.Payments.Database/dbo/Stored Procedures/dbo.MetricsPayments.sql +++ /dev/null @@ -1,119 +0,0 @@ -create procedure [dbo].[Metrics_Payments] - @academicYear smallint, - @collectionPeriod tinyint, - @populateEarnings bit = 0 -as -begin - with ukprns as ( -- remove ukprns where there was no submissions and where there were failures - select distinct ukprn from Payments2.Job j1 where AcademicYear = @academicYear and CollectionPeriod = @collectionPeriod - --and not exists(select 1 from Payments2.Job j2 where j2.Ukprn = j1.Ukprn and j2.Status <> 2) - --and not exists(select 1 from Payments2.Payment p where p.Ukprn = j1.Ukprn and AcademicYear = @academicYear and EarningEventId = '00000000-0000-0000-0000-000000000000') - ) - select - TransactionTypes.TransactionType as [Transaction Type], - isnull(Earnings.EarningsYTD, 0) as [Earnings YTD], - isnull(Earnings.EarningsACT1, 0) as [Earnings ACT1], - isnull(Earnings.EarningsACT2, 0) as [Earnings ACT2], - isnull(Earnings.NegativeEarningsYTD, 0) as [Negative Earnings], - isnull(Earnings.NegativeEarningsACT1, 0) as [Negative Earnings ACT1], - isnull(Earnings.NegativeEarningsACT2, 0) as [Negative Earnings ACT2], - isnull(ActualPayments.ActualPaymentYTD, 0) as [Payments YTD], - isnull(ActualPayments.ActualPaymentACT1, 0) as [Payments ACT1], - isnull(ActualPayments.ActualPaymentACT2, 0) as [Payments ACT2], - isnull([DataLockErrors], 0) as [Data Lock Errors], - isnull([HeldBackCompletionPayments], 0) as [Held Back Completion], - isnull([HeldBackCompletionPaymentsAct1], 0) as [HBCP ACT1], - isnull([HeldBackCompletionPaymentsAct2], 0) as [HBCP ACT2] - from ( - select n as TransactionType from (values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13),(14),(15),(16)) v(n) - ) as TransactionTypes - - left join ( - select - TransactionType, - sum(case when Amount > 0 then Amount end) [EarningsYTD], - sum(case when ContractType = 1 and Amount > 0 then Amount end) [EarningsACT1], - sum(case when ContractType = 2 and Amount > 0 then Amount end) [EarningsACT2], - sum(case when Amount < 0 then Amount end) [NegativeEarningsYTD], - sum(case when ContractType = 1 and Amount < 0 then Amount end) [NegativeEarningsACT1], - sum(case when ContractType = 2 and Amount < 0 then Amount end) [NegativeEarningsACT2] - from - Payments2.EarningEvent e with(nolock) - join Payments2.EarningEventPeriod p with(nolock) on p.EarningEventId = e.EventId - join ukprns on ukprns.Ukprn = e.Ukprn - where - e.AcademicYear = @academicYear - and e.CollectionPeriod = @collectionPeriod - and p.DeliveryPeriod <= @collectionPeriod - and @populateEarnings = 1 - group by - p.TransactionType - ) as Earnings - on Earnings.TransactionType = TransactionTypes.TransactionType - - left join ( - select - TransactionType, - sum(Amount) [ActualPaymentYTD], - sum(case when ContractType = 1 then Amount end) [ActualPaymentACT1], - sum(case when ContractType = 2 then Amount end) [ActualPaymentACT2] - from - Payments2.Payment with(nolock) - join ukprns on ukprns.Ukprn = Payments2.Payment.Ukprn - where - AcademicYear = @academicYear - and CollectionPeriod <= @collectionPeriod - group by - TransactionType - ) as ActualPayments - on ActualPayments.TransactionType = TransactionTypes.TransactionType - - left join ( - select - TransactionType, - sum(cast(json_value(EarningPeriod, '$.Amount') as decimal(15,5))) [DataLockErrors] - from - Payments2.DataLockFailure with(nolock) - join ukprns on ukprns.Ukprn = Payments2.DataLockFailure.Ukprn - where - AcademicYear = @academicYear - and CollectionPeriod = @collectionPeriod - and DeliveryPeriod <= CollectionPeriod - group by - TransactionType - ) as [DataLockErrors] - on [DataLockErrors].TransactionType = TransactionTypes.TransactionType - - left join ( -- we're not recording HBCP yet so working out all TT2 earnings that were not paid and had no DL error - select - ep.TransactionType, - sum(case when p.Id is null and f.Id is null then ep.Amount end) as HeldBackCompletionPayments, - sum(case when p.Id is null and f.Id is null and e.ContractType = 1 then ep.Amount end) as HeldBackCompletionPaymentsAct1, - sum(case when p.Id is null and f.Id is null and e.ContractType = 2 then ep.Amount end) as HeldBackCompletionPaymentsAct2 - from - Payments2.EarningEvent e with(nolock) - join Payments2.EarningEventPeriod ep with(nolock) on ep.EarningEventId = e.EventId - join ukprns on ukprns.Ukprn = e.Ukprn - left join Payments2.Payment p with(nolock) on p.EarningEventId = ep.EarningEventId - and p.DeliveryPeriod = ep.DeliveryPeriod - and p.TransactionType = ep.TransactionType - left join Payments2.DataLockFailure f with(nolock) on f.EarningEventId = e.EventId - and f.DeliveryPeriod = ep.DeliveryPeriod - and f.TransactionType = ep.TransactionType - where - ep.TransactionType = 2 - and ep.Amount <> 0 - and e.AcademicYear = @academicYear - and e.CollectionPeriod = @collectionPeriod - and ep.DeliveryPeriod <= @collectionPeriod - group by - ep.TransactionType - ) as HeldBackCompletionPayments - on HeldBackCompletionPayments.TransactionType = TransactionTypes.TransactionType - - order by - 1 -end -GO -GRANT EXECUTE ON [dbo].[Metrics_Payments] to [DataViewer] -GO diff --git a/src/SFA.DAS.Payments.Database/dbo/Stored Procedures/dbo.usp_DisplayDeploymentProperties.sql b/src/SFA.DAS.Payments.Database/dbo/Stored Procedures/dbo.usp_DisplayDeploymentProperties.sql deleted file mode 100644 index 5df43a8dc..000000000 --- a/src/SFA.DAS.Payments.Database/dbo/Stored Procedures/dbo.usp_DisplayDeploymentProperties.sql +++ /dev/null @@ -1,48 +0,0 @@ -CREATE PROCEDURE [dbo].[usp_DisplayDeploymentProperties] -AS -BEGIN - SET NOCOUNT ON; - - BEGIN TRY - --- Core Tables - EXEC ('SELECT name, value FROM fn_listextendedproperty(default, default, default, default, default, default, default);') - - RETURN 0; - - END TRY --- --------------------------------------------------------------------------------------- --- Handle any problems --------------------------------------------------------------------------------------- --- - BEGIN CATCH - - DECLARE @ErrorMessage NVARCHAR(4000) - , @ErrorSeverity INT - , @ErrorState INT - , @ErrorNumber INT - - SELECT @ErrorNumber = ERROR_NUMBER() - , @ErrorMessage = 'Error in :' + ISNULL(OBJECT_NAME(@@PROCID),'') + ' - Error was :' + ERROR_MESSAGE() - , @ErrorSeverity = ERROR_SEVERITY() - , @ErrorState = ERROR_STATE(); - - RAISERROR ( - @ErrorMessage -- Message text. - , @ErrorSeverity -- Severity. - , @ErrorState -- State. - ); - - RETURN @ErrorNumber; - - END CATCH --- --------------------------------------------------------------------------------------- --- All done --------------------------------------------------------------------------------------- --- -END -GO -GRANT EXECUTE ON [dbo].[usp_DisplayDeploymentProperties] TO [DataViewer]; -GO \ No newline at end of file diff --git a/src/SFA.DAS.Payments.Database/zzz.Script.PostDeployment.sql b/src/SFA.DAS.Payments.Database/zzz.Script.PostDeployment.sql deleted file mode 100644 index 4f8327217..000000000 --- a/src/SFA.DAS.Payments.Database/zzz.Script.PostDeployment.sql +++ /dev/null @@ -1,229 +0,0 @@ -/* --------------------------------------------------------------------------------------- -Post-Deployment Script --------------------------------------------------------------------------------------- -*/ - -SET NOCOUNT ON; -GO - -IF NOT EXISTS (SELECT * FROM [Payments2].[JobStatus] WHERE [Id] = 1) - INSERT INTO [Payments2].[JobStatus] values (1,'In progress') -GO - -IF NOT EXISTS (SELECT * FROM [Payments2].[JobStatus] WHERE [Id] = 2) - INSERT INTO [Payments2].[JobStatus] VALUES (2,'Completed') -GO - -IF NOT EXISTS (SELECT * FROM [Payments2].[JobStatus] WHERE [Id] = 3) - INSERT INTO [Payments2].[JobStatus] values (3,'Completed with errors') -GO - -IF NOT EXISTS (SELECT * FROM [Payments2].[JobStatus] WHERE [Id] = 4) - INSERT INTO [Payments2].[JobStatus] values (4,'Timed out due to idle job') -GO - -IF NOT EXISTS (SELECT * FROM [Payments2].[JobStatus] WHERE [Id] = 5) - INSERT INTO [Payments2].[JobStatus] values (5,'DC Tasks Failed') -GO - -IF NOT EXISTS (SELECT * FROM [Payments2].[JobEventStatus] WHERE [Id] = 1) - INSERT INTO [Payments2].[JobEventStatus] values (1,'Queued') -GO - -IF NOT EXISTS (SELECT * FROM [Payments2].[JobEventStatus] WHERE [Id] = 2) - INSERT INTO [Payments2].[JobEventStatus] values (2,'Processing') -GO - -IF NOT EXISTS (SELECT * FROM [Payments2].[JobEventStatus] WHERE [Id] = 3) - INSERT INTO [Payments2].[JobEventStatus] values (3,'Completed') -GO - -IF NOT EXISTS (SELECT * FROM [Payments2].[JobEventStatus] WHERE [Id] = 4) - INSERT INTO [Payments2].[JobEventStatus] values (4,'Failed') -GO - -IF NOT EXISTS (SELECT * FROM [Payments2].[JobType] WHERE [Id] = 1) - INSERT INTO [Payments2].[JobType] values (1,'Earnings job') -GO - -IF NOT EXISTS (SELECT * FROM [Payments2].[JobType] WHERE [Id] = 2) - INSERT INTO [Payments2].[JobType] values (2,'Period end start job') -else - UPDATE [Payments2].[JobType] SET [Description] = 'Period end start job' WHERE [Id] = 2 -GO - -IF NOT EXISTS (SELECT * FROM [Payments2].[JobType] WHERE [Id] = 3) - INSERT INTO [Payments2].[JobType] VALUES (3,'Component test earnings job') -GO - -IF NOT EXISTS (SELECT * FROM [Payments2].[JobType] WHERE [Id] = 4) - INSERT INTO [Payments2].[JobType] VALUES (4,'Component test month end job') -GO - -IF NOT EXISTS (SELECT * FROM [Payments2].[JobType] WHERE [Id] = 5) - INSERT INTO [Payments2].[JobType] values (5,'Period end run job') -GO - -IF NOT EXISTS (SELECT * FROM [Payments2].[JobType] WHERE [Id] = 6) - INSERT INTO [Payments2].[JobType] values (6,'Period end stop job') -GO - -IF NOT EXISTS (SELECT * FROM [Payments2].[JobType] WHERE [Id] = 7) - INSERT INTO [Payments2].[JobType] values (7,'Period end submission window validation job') -GO - - -IF NOT EXISTS (SELECT * FROM [Payments2].[JobType] WHERE [Id] = 8) - INSERT INTO [Payments2].[JobType] values (8,'Period end request reports job') -GO - -MERGE INTO [Payments2].[ApprenticeshipStatus] AS Target -USING (VALUES -(1 , N'Active'), -(2 , N'Paused'), -(3 , N'Stopped'), -(4 , N'Inactive') -) AS Source ([Id],[Description]) -ON (Target.[Id] = Source.[Id]) -WHEN MATCHED AND - ( NULLIF(Source.[Description], Target.[Description]) IS NOT NULL) THEN - UPDATE SET [Description] = Source.[Description] -WHEN NOT MATCHED BY TARGET THEN - INSERT([Id],[Description]) VALUES(Source.[Id],Source.[Description]) -WHEN NOT MATCHED BY SOURCE THEN - DELETE; - GO - - -RAISERROR(' Extended Property',10,1) WITH NOWAIT; -GO - -RAISERROR(' %s - %s',10,1,'BuildNumber','$(BUILD_BUILDNUMBER)') WITH NOWAIT; -IF NOT EXISTS (SELECT name, value FROM fn_listextendedproperty('BuildNumber', default, default, default, default, default, default)) - EXEC sp_addextendedproperty @name = N'BuildNumber', @value = '$(BUILD_BUILDNUMBER)'; -ELSE - EXEC sp_updateextendedproperty @name = N'BuildNumber', @value = '$(BUILD_BUILDNUMBER)'; - -GO - -RAISERROR(' %s - %s',10,1,'BuildBranch','$(BUILD_BRANCHNAME)') WITH NOWAIT; -IF NOT EXISTS (SELECT name, value FROM fn_listextendedproperty('BuildBranch', default, default, default, default, default, default)) - EXEC sp_addextendedproperty @name = N'BuildBranch', @value = '$(BUILD_BRANCHNAME)'; -ELSE - EXEC sp_updateextendedproperty @name = N'BuildBranch', @value = '$(BUILD_BRANCHNAME)'; -GO - -DECLARE @DeploymentTime VARCHAR(35) = CONVERT(VARCHAR(35),GETUTCDATE(),113); -RAISERROR(' %s - %s',10,1,'DeploymentDatetime',@DeploymentTime) WITH NOWAIT; -IF NOT EXISTS (SELECT name, value FROM fn_listextendedproperty('DeploymentDatetime', default, default, default, default, default, default)) - EXEC sp_addextendedproperty @name = N'DeploymentDatetime', @value = @DeploymentTime; -ELSE - EXEC sp_updateextendedproperty @name = N'DeploymentDatetime', @value = @DeploymentTime; -GO - -RAISERROR(' %s - %s',10,1,'ReleaseName','$(RELEASE_RELEASENAME)') WITH NOWAIT; -IF NOT EXISTS (SELECT name, value FROM fn_listextendedproperty('ReleaseName', default, default, default, default, default, default)) - EXEC sp_addextendedproperty @name = N'ReleaseName', @value = '$(RELEASE_RELEASENAME)'; -ELSE - EXEC sp_updateextendedproperty @name = N'ReleaseName', @value = '$(BUILD_BRANCHNAME)'; -GO - -RAISERROR(' Drop DisplayDeploymentProperties View.',10,1,'ReleaseName','$(RELEASE_RELEASENAME)') WITH NOWAIT; -IF EXISTS (SELECT * FROM [sys].[objects] WHERE [type] = 'V' AND Name = 'DisplayDeploymentProperties_VW') -BEGIN - DROP VIEW [dbo].[DisplayDeploymentProperties_VW]; -END -GO - -RAISERROR(' Update User Account Passwords',10,1) WITH NOWAIT; -GO - -RAISERROR(' RO User',10,1) WITH NOWAIT; -ALTER USER [DASPaymentROUser] WITH PASSWORD = N'$(ROUserPassword)'; -GO - -RAISERROR(' RW User',10,1) WITH NOWAIT; -ALTER USER [DASPaymentRWUser] WITH PASSWORD = N'$(RWUserPassword)'; -GO - -RAISERROR(' DSCI User',10,1) WITH NOWAIT; -ALTER USER [User_DSCI] WITH PASSWORD = N'$(DsciUserPassword)'; -GO - -RAISERROR('Completed',10,1) WITH NOWAIT; -GO - -/* ---- Well-known UKPRNs for DC integration testing ---- */ -;with KnownUkprns as ( - select '10000833' as Ukprn union - select '10001144' union - select '10001326' union - select '10001436' union - select '10001548' union - select '10001971' union - select '10002005' union - select '10002815' union - select '10002843' union - select '10002919' union - select '10002935' union - select '10003538' union - select '10004180' union - select '10004760' union - select '10005583' union - select '10005926' union - select '10006432' union - select '10006519' union - select '10006574' union - select '10006847' union - select '10007419' union - select '10007635' union - select '10007643' union - select '10008227' union - select '10010178' union - select '10010939' union - select '10013222' union - select '10018361' union - select '10020395' union - select '10027518' union - select '10028120' union - select '10030102' union - select '10030571' union - select '10030758' union - select '10031093' union - select '10031408' union - select '10032250' union - select '10033904' union - select '10034279' union - select '10036176' union - select '10037830' union - select '10038872' union - select '10044985' union - select '10045119' union - select '10046078' union - select '10046354' union - select '10052903' union - select '10057010' union - select '10058123' union - select '10063506' - ) -insert into Payments2.TestingProvider (Ukprn) - select distinct Ukprn - from KnownUkprns t - where not exists (select 1 from Payments2.TestingProvider t2 where t2.Ukprn = t.Ukprn); -GO - -MERGE INTO [Metrics].[SubmissionEarningType] AS Target -USING (VALUES -(1 , N'DC Earnings'), -(2 , N'DAS Earnings') -) AS Source ([Id],[Description]) -ON (Target.[Id] = Source.[Id]) -WHEN MATCHED AND - ( NULLIF(Source.[Description], Target.[Description]) IS NOT NULL) THEN - UPDATE SET [Description] = Source.[Description] -WHEN NOT MATCHED BY TARGET THEN - INSERT([Id],[Description]) VALUES(Source.[Id],Source.[Description]) -WHEN NOT MATCHED BY SOURCE THEN - DELETE; - GO diff --git a/src/SFA.DAS.Payments.sln b/src/SFA.DAS.Payments.sln index 3182651f5..840aa479b 100644 --- a/src/SFA.DAS.Payments.sln +++ b/src/SFA.DAS.Payments.sln @@ -109,8 +109,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SFA.DAS.Payments.FundingSou EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SFA.DAS.Payments.EarningEvents.Messages.Internal", "SFA.DAS.Payments.EarningEvents.Messages.Internal\SFA.DAS.Payments.EarningEvents.Messages.Internal.csproj", "{B5FF4D1A-925D-4979-9363-4C8298C483B8}" EndProject -Project("{00D1A9C2-B5F0-4AF3-8072-F6C62B433612}") = "SFA.DAS.Payments.Database", "SFA.DAS.Payments.Database\SFA.DAS.Payments.Database.sqlproj", "{A99EDA09-50B8-439D-AFB5-323FEAA5CA4D}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SFA.DAS.Payments.ProviderPayments.Messages.Internal", "SFA.DAS.Payments.ProviderPayments.Messages.Internal\SFA.DAS.Payments.ProviderPayments.Messages.Internal.csproj", "{25B9DFA3-DF0C-4C53-A991-1F3D3BB407A8}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SFA.DAS.Payments.AcceptanceTests.EndToEnd", "SFA.DAS.Payments.AcceptanceTests.EndToEnd\SFA.DAS.Payments.AcceptanceTests.EndToEnd.csproj", "{EA55A5F0-CF98-4A19-A827-5344216974DA}" @@ -197,8 +195,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SFA.DAS.Payments.RequiredPa EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SFA.DAS.Payments.RequiredPayments.RemovedLearnerService.Interfaces", "SFA.DAS.Payments.RequiredPayments.RemovedLearnerService.Interfaces\SFA.DAS.Payments.RequiredPayments.RemovedLearnerService.Interfaces.csproj", "{2D2930BB-77E7-4AA1-B18C-BD3E072894F5}" EndProject -Project("{00D1A9C2-B5F0-4AF3-8072-F6C62B433612}") = "SFA.DAS.Payments.Database.Legacy", "SFA.DAS.Payments.Database.Legacy\SFA.DAS.Payments.Database.Legacy.sqlproj", "{E307A71F-9F25-4D11-8F50-57B84EF4AA5E}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SFA.DAS.Payments.DataLocks.DataLockStatusChangedService", "SFA.DAS.Payments.DataLocks.DataLockStatusChangedService\SFA.DAS.Payments.DataLocks.DataLockStatusChangedService.csproj", "{63D92999-F026-4068-9C92-47C0235D978E}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SFA.DAS.Payments.Monitoring.Jobs.Client.UnitTests", "SFA.DAS.Payments.Monitoring.Jobs.Client.UnitTests\SFA.DAS.Payments.Monitoring.Jobs.Client.UnitTests.csproj", "{37BE2A88-61FA-4C09-A3CB-00A4BCB39EA1}" @@ -258,8 +254,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SFA.DAS.Payments.Monitoring.Jobs.JobService", "SFA.DAS.Payments.Monitoring.Jobs.JobService\SFA.DAS.Payments.Monitoring.Jobs.JobService.csproj", "{FF262C9E-E06E-4969-9549-6BD4EFC44C5C}" EndProject -Project("{00D1A9C2-B5F0-4AF3-8072-F6C62B433612}") = "SFA.DAS.Payments.Database.Legacy.Payments", "SFA.DAS.Payments.Database.Legacy.Payments\SFA.DAS.Payments.Database.Legacy.Payments.sqlproj", "{F8DC3227-6A79-44D5-89D8-6ACE0B8FCB37}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SFA.DAS.Payments.ProviderPayments.LegacyExportService", "SFA.DAS.Payments.ProviderPayments.LegacyExportService\SFA.DAS.Payments.ProviderPayments.LegacyExportService.csproj", "{2CFF45F6-6398-4F3A-B3AE-03BC82F06F63}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SFA.DAS.Payments.Monitoring.Jobs.JobService.Interfaces", "SFA.DAS.Payments.Monitoring.Jobs.JobService.Interfaces\SFA.DAS.Payments.Monitoring.Jobs.JobService.Interfaces.csproj", "{AED49A8C-EC1F-4649-B0FE-D0DB1DD07873}" @@ -377,8 +371,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SFA.DAS.Payments.PeriodEnd. EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SFA.DAS.Payments.RequiredPayments.ClawbackRemovedLearnerService", "SFA.DAS.Payments.RequiredPayments.ClawbackRemovedLearnerService\SFA.DAS.Payments.RequiredPayments.ClawbackRemovedLearnerService.csproj", "{56BE8D57-BF1B-47EC-8958-76588BF4A4B9}" EndProject -Project("{00D1A9C2-B5F0-4AF3-8072-F6C62B433612}") = "SFA.DAS.Payments.Audit.Database", "SFA.DAS.Payments.Audit.Database\SFA.DAS.Payments.Audit.Database.sqlproj", "{EC15FDBA-CCA7-4245-93B1-04506A09BABA}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Alerts", "Alerts", "{77F5C18E-B300-4FF9-995F-50E904E025A3}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SFA.DAS.Payments.Monitoring.Alerts.Function", "SFA.DAS.Payments.Monitoring.Alerts.Function\SFA.DAS.Payments.Monitoring.Alerts.Function.csproj", "{69D15B97-1E91-4CFA-96CC-D218C3629EF1}" @@ -757,18 +749,6 @@ Global {B5FF4D1A-925D-4979-9363-4C8298C483B8}.Release|Any CPU.Build.0 = Release|Any CPU {B5FF4D1A-925D-4979-9363-4C8298C483B8}.Release|x64.ActiveCfg = Release|Any CPU {B5FF4D1A-925D-4979-9363-4C8298C483B8}.Release|x64.Build.0 = Release|Any CPU - {A99EDA09-50B8-439D-AFB5-323FEAA5CA4D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A99EDA09-50B8-439D-AFB5-323FEAA5CA4D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A99EDA09-50B8-439D-AFB5-323FEAA5CA4D}.Debug|Any CPU.Deploy.0 = Debug|Any CPU - {A99EDA09-50B8-439D-AFB5-323FEAA5CA4D}.Debug|x64.ActiveCfg = Debug|Any CPU - {A99EDA09-50B8-439D-AFB5-323FEAA5CA4D}.Debug|x64.Build.0 = Debug|Any CPU - {A99EDA09-50B8-439D-AFB5-323FEAA5CA4D}.Debug|x64.Deploy.0 = Debug|Any CPU - {A99EDA09-50B8-439D-AFB5-323FEAA5CA4D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A99EDA09-50B8-439D-AFB5-323FEAA5CA4D}.Release|Any CPU.Build.0 = Release|Any CPU - {A99EDA09-50B8-439D-AFB5-323FEAA5CA4D}.Release|Any CPU.Deploy.0 = Release|Any CPU - {A99EDA09-50B8-439D-AFB5-323FEAA5CA4D}.Release|x64.ActiveCfg = Release|Any CPU - {A99EDA09-50B8-439D-AFB5-323FEAA5CA4D}.Release|x64.Build.0 = Release|Any CPU - {A99EDA09-50B8-439D-AFB5-323FEAA5CA4D}.Release|x64.Deploy.0 = Release|Any CPU {25B9DFA3-DF0C-4C53-A991-1F3D3BB407A8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {25B9DFA3-DF0C-4C53-A991-1F3D3BB407A8}.Debug|Any CPU.Build.0 = Debug|Any CPU {25B9DFA3-DF0C-4C53-A991-1F3D3BB407A8}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -1071,18 +1051,6 @@ Global {2D2930BB-77E7-4AA1-B18C-BD3E072894F5}.Release|Any CPU.Build.0 = Release|Any CPU {2D2930BB-77E7-4AA1-B18C-BD3E072894F5}.Release|x64.ActiveCfg = Release|Any CPU {2D2930BB-77E7-4AA1-B18C-BD3E072894F5}.Release|x64.Build.0 = Release|Any CPU - {E307A71F-9F25-4D11-8F50-57B84EF4AA5E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E307A71F-9F25-4D11-8F50-57B84EF4AA5E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E307A71F-9F25-4D11-8F50-57B84EF4AA5E}.Debug|Any CPU.Deploy.0 = Debug|Any CPU - {E307A71F-9F25-4D11-8F50-57B84EF4AA5E}.Debug|x64.ActiveCfg = Debug|Any CPU - {E307A71F-9F25-4D11-8F50-57B84EF4AA5E}.Debug|x64.Build.0 = Debug|Any CPU - {E307A71F-9F25-4D11-8F50-57B84EF4AA5E}.Debug|x64.Deploy.0 = Debug|Any CPU - {E307A71F-9F25-4D11-8F50-57B84EF4AA5E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E307A71F-9F25-4D11-8F50-57B84EF4AA5E}.Release|Any CPU.Build.0 = Release|Any CPU - {E307A71F-9F25-4D11-8F50-57B84EF4AA5E}.Release|Any CPU.Deploy.0 = Release|Any CPU - {E307A71F-9F25-4D11-8F50-57B84EF4AA5E}.Release|x64.ActiveCfg = Release|Any CPU - {E307A71F-9F25-4D11-8F50-57B84EF4AA5E}.Release|x64.Build.0 = Release|Any CPU - {E307A71F-9F25-4D11-8F50-57B84EF4AA5E}.Release|x64.Deploy.0 = Release|Any CPU {63D92999-F026-4068-9C92-47C0235D978E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {63D92999-F026-4068-9C92-47C0235D978E}.Debug|Any CPU.Build.0 = Debug|Any CPU {63D92999-F026-4068-9C92-47C0235D978E}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -1245,18 +1213,6 @@ Global {FF262C9E-E06E-4969-9549-6BD4EFC44C5C}.Release|Any CPU.Build.0 = Release|Any CPU {FF262C9E-E06E-4969-9549-6BD4EFC44C5C}.Release|x64.ActiveCfg = Release|Any CPU {FF262C9E-E06E-4969-9549-6BD4EFC44C5C}.Release|x64.Build.0 = Release|Any CPU - {F8DC3227-6A79-44D5-89D8-6ACE0B8FCB37}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F8DC3227-6A79-44D5-89D8-6ACE0B8FCB37}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F8DC3227-6A79-44D5-89D8-6ACE0B8FCB37}.Debug|Any CPU.Deploy.0 = Debug|Any CPU - {F8DC3227-6A79-44D5-89D8-6ACE0B8FCB37}.Debug|x64.ActiveCfg = Debug|Any CPU - {F8DC3227-6A79-44D5-89D8-6ACE0B8FCB37}.Debug|x64.Build.0 = Debug|Any CPU - {F8DC3227-6A79-44D5-89D8-6ACE0B8FCB37}.Debug|x64.Deploy.0 = Debug|Any CPU - {F8DC3227-6A79-44D5-89D8-6ACE0B8FCB37}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F8DC3227-6A79-44D5-89D8-6ACE0B8FCB37}.Release|Any CPU.Build.0 = Release|Any CPU - {F8DC3227-6A79-44D5-89D8-6ACE0B8FCB37}.Release|Any CPU.Deploy.0 = Release|Any CPU - {F8DC3227-6A79-44D5-89D8-6ACE0B8FCB37}.Release|x64.ActiveCfg = Release|Any CPU - {F8DC3227-6A79-44D5-89D8-6ACE0B8FCB37}.Release|x64.Build.0 = Release|Any CPU - {F8DC3227-6A79-44D5-89D8-6ACE0B8FCB37}.Release|x64.Deploy.0 = Release|Any CPU {2CFF45F6-6398-4F3A-B3AE-03BC82F06F63}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {2CFF45F6-6398-4F3A-B3AE-03BC82F06F63}.Debug|Any CPU.Build.0 = Debug|Any CPU {2CFF45F6-6398-4F3A-B3AE-03BC82F06F63}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -1539,18 +1495,6 @@ Global {56BE8D57-BF1B-47EC-8958-76588BF4A4B9}.Release|Any CPU.Build.0 = Release|Any CPU {56BE8D57-BF1B-47EC-8958-76588BF4A4B9}.Release|x64.ActiveCfg = Release|Any CPU {56BE8D57-BF1B-47EC-8958-76588BF4A4B9}.Release|x64.Build.0 = Release|Any CPU - {EC15FDBA-CCA7-4245-93B1-04506A09BABA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {EC15FDBA-CCA7-4245-93B1-04506A09BABA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {EC15FDBA-CCA7-4245-93B1-04506A09BABA}.Debug|Any CPU.Deploy.0 = Debug|Any CPU - {EC15FDBA-CCA7-4245-93B1-04506A09BABA}.Debug|x64.ActiveCfg = Debug|Any CPU - {EC15FDBA-CCA7-4245-93B1-04506A09BABA}.Debug|x64.Build.0 = Debug|Any CPU - {EC15FDBA-CCA7-4245-93B1-04506A09BABA}.Debug|x64.Deploy.0 = Debug|Any CPU - {EC15FDBA-CCA7-4245-93B1-04506A09BABA}.Release|Any CPU.ActiveCfg = Release|Any CPU - {EC15FDBA-CCA7-4245-93B1-04506A09BABA}.Release|Any CPU.Build.0 = Release|Any CPU - {EC15FDBA-CCA7-4245-93B1-04506A09BABA}.Release|Any CPU.Deploy.0 = Release|Any CPU - {EC15FDBA-CCA7-4245-93B1-04506A09BABA}.Release|x64.ActiveCfg = Release|Any CPU - {EC15FDBA-CCA7-4245-93B1-04506A09BABA}.Release|x64.Build.0 = Release|Any CPU - {EC15FDBA-CCA7-4245-93B1-04506A09BABA}.Release|x64.Deploy.0 = Release|Any CPU {69D15B97-1E91-4CFA-96CC-D218C3629EF1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {69D15B97-1E91-4CFA-96CC-D218C3629EF1}.Debug|Any CPU.Build.0 = Debug|Any CPU {69D15B97-1E91-4CFA-96CC-D218C3629EF1}.Debug|x64.ActiveCfg = Debug|Any CPU