diff --git a/AdminUI/LearningHub.Nhs.AdminUI/LearningHub.Nhs.AdminUI.csproj b/AdminUI/LearningHub.Nhs.AdminUI/LearningHub.Nhs.AdminUI.csproj
index a42f95f98..e662a43af 100644
--- a/AdminUI/LearningHub.Nhs.AdminUI/LearningHub.Nhs.AdminUI.csproj
+++ b/AdminUI/LearningHub.Nhs.AdminUI/LearningHub.Nhs.AdminUI.csproj
@@ -86,7 +86,7 @@
-
+
diff --git a/WebAPI/LearningHub.Nhs.Database/LearningHub.Nhs.Database.sqlproj b/WebAPI/LearningHub.Nhs.Database/LearningHub.Nhs.Database.sqlproj
index 6be19efc9..3b0baf9db 100644
--- a/WebAPI/LearningHub.Nhs.Database/LearningHub.Nhs.Database.sqlproj
+++ b/WebAPI/LearningHub.Nhs.Database/LearningHub.Nhs.Database.sqlproj
@@ -83,7 +83,6 @@
-
@@ -101,9 +100,8 @@
-
-
+
@@ -206,8 +204,6 @@
-
-
@@ -325,13 +321,9 @@
-
-
-
-
@@ -343,7 +335,6 @@
-
@@ -472,7 +463,6 @@
-
@@ -548,154 +538,28 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
diff --git a/WebAPI/LearningHub.Nhs.Database/Schemas/elfh.sql b/WebAPI/LearningHub.Nhs.Database/Schemas/elfh.sql
deleted file mode 100644
index 09637bd31..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Schemas/elfh.sql
+++ /dev/null
@@ -1,3 +0,0 @@
-CREATE SCHEMA [elfh]
- AUTHORIZATION [dbo];
-GO
\ No newline at end of file
diff --git a/WebAPI/LearningHub.Nhs.Database/Scripts/Pre-Deploy/Scripts/TD-7057-drop-elfh tables.sql b/WebAPI/LearningHub.Nhs.Database/Scripts/Pre-Deploy/Scripts/TD-7057-drop-elfh tables.sql
new file mode 100644
index 000000000..fdb1d7151
--- /dev/null
+++ b/WebAPI/LearningHub.Nhs.Database/Scripts/Pre-Deploy/Scripts/TD-7057-drop-elfh tables.sql
@@ -0,0 +1,178 @@
+--DROP TABLE IF EXISTS elfh.userTermsAndConditionsTBL;
+--DROP TABLE IF EXISTS elfh.userRoleUpgradeTBL;
+--DROP TABLE IF EXISTS elfh.userReportingUserTBL;
+--DROP TABLE IF EXISTS elfh.userPasswordValidationTokenTBL;
+
+--IF OBJECT_ID('FK_userHistoryAttributeTBL_attributeId', 'F') IS NOT NULL
+--BEGIN
+-- ALTER TABLE [elfh].[userHistoryAttributeTBL]
+-- DROP CONSTRAINT [FK_userHistoryAttributeTBL_attributeId];
+--END;
+
+--IF OBJECT_ID('FK_userHistoryAttributeTBL_userHistoryId', 'F') IS NOT NULL
+--BEGIN
+-- ALTER TABLE [elfh].[userHistoryAttributeTBL]
+-- DROP CONSTRAINT [FK_userHistoryAttributeTBL_userHistoryId];
+--END;
+
+--DROP TABLE IF EXISTS elfh.userHistoryTBL;
+--DROP TABLE IF EXISTS elfh.userHistoryTypeTBL;
+
+--DROP TABLE IF EXISTS elfh.userGroupTypeInputValidationTBL;
+--DROP TABLE IF EXISTS elfh.userGroupReporterTBL;
+--DROP TABLE IF EXISTS elfh.userEmploymentResponsibilityTBL;
+--DROP TABLE IF EXISTS elfh.userEmploymentReferenceTBL;
+--DROP TABLE IF EXISTS elfh.userAttributeTBL;
+--DROP TABLE IF EXISTS elfh.userAdminLocationTBLCopy;
+--DROP TABLE IF EXISTS elfh.userAdminLocationTBL;
+--DROP TABLE IF EXISTS elfh.termsAndConditionsTBL;
+--DROP TABLE IF EXISTS elfh.tenantUrlTBL;
+--DROP TABLE IF EXISTS elfh.tenantTBL;
+--DROP TABLE IF EXISTS elfh.tenantSmtpTBL;
+--DROP TABLE IF EXISTS elfh.systemSettingTBL;
+--DROP TABLE IF EXISTS elfh.mergeUserTBL;
+--DROP TABLE IF EXISTS elfh.loginWizardStageActivityTBL;
+--DROP TABLE IF EXISTS elfh.ipCountryLookupTBL;
+--DROP TABLE IF EXISTS elfh.gmclrmpTBL;
+--DROP TABLE IF EXISTS elfh.gdcRegisterTBL;
+--DROP TABLE IF EXISTS elfh.employmentReferenceTypeTBL;
+--DROP TABLE IF EXISTS elfh.emailTemplateTypeTBL;
+--DROP TABLE IF EXISTS elfh.emailTemplateTBL;
+--DROP TABLE IF EXISTS elfh.attributeTBL;
+--DROP TABLE IF EXISTS elfh.attributeTypeTBL;
+--DROP TABLE IF EXISTS elfh.loginWizardRuleTBL;
+--DROP TABLE IF EXISTS elfh.loginWizardStageTBL;
+
+
+---- Foreign Keys
+--IF OBJECT_ID('[elfh].[FK_userEmploymentTBL_gradeTBL]', 'F') IS NOT NULL
+-- ALTER TABLE [elfh].[userEmploymentTBL] DROP CONSTRAINT [FK_userEmploymentTBL_gradeTBL];
+
+--IF OBJECT_ID('[elfh].[FK_userEmploymentTBL_jobRoleTBL]', 'F') IS NOT NULL
+-- ALTER TABLE [elfh].[userEmploymentTBL] DROP CONSTRAINT [FK_userEmploymentTBL_jobRoleTBL];
+
+--IF OBJECT_ID('[elfh].[FK_userEmploymentTBL_locationTBL]', 'F') IS NOT NULL
+-- ALTER TABLE [elfh].[userEmploymentTBL] DROP CONSTRAINT [FK_userEmploymentTBL_locationTBL];
+
+--IF OBJECT_ID('[elfh].[FK_userEmploymentTBL_medicalCouncilTBL]', 'F') IS NOT NULL
+-- ALTER TABLE [elfh].[userEmploymentTBL] DROP CONSTRAINT [FK_userEmploymentTBL_medicalCouncilTBL];
+
+--IF OBJECT_ID('[elfh].[FK_userEmploymentTBL_schoolTBL]', 'F') IS NOT NULL
+-- ALTER TABLE [elfh].[userEmploymentTBL] DROP CONSTRAINT [FK_userEmploymentTBL_schoolTBL];
+
+--IF OBJECT_ID('[elfh].[FK_userEmploymentTBL_specialtyTBL]', 'F') IS NOT NULL
+-- ALTER TABLE [elfh].[userEmploymentTBL] DROP CONSTRAINT [FK_userEmploymentTBL_specialtyTBL];
+
+--IF OBJECT_ID('[elfh].[FK_userEmploymentTBL_userTBL]', 'F') IS NOT NULL
+-- ALTER TABLE [elfh].[userEmploymentTBL] DROP CONSTRAINT [FK_userEmploymentTBL_userTBL];
+
+--IF OBJECT_ID('[elfh].[FK_userEmploymentTBL_userTBL_AmendUser]', 'F') IS NOT NULL
+-- ALTER TABLE [elfh].[userEmploymentTBL] DROP CONSTRAINT [FK_userEmploymentTBL_userTBL_AmendUser];
+
+---- Default Constraints
+--IF OBJECT_ID('[elfh].[DF_userEmploymentTBL_deleted]', 'D') IS NOT NULL
+-- ALTER TABLE [elfh].[userEmploymentTBL] DROP CONSTRAINT [DF_userEmploymentTBL_deleted];
+
+--IF OBJECT_ID('[elfh].[DF_userEmploymentTBL_archived]', 'D') IS NOT NULL
+-- ALTER TABLE [elfh].[userEmploymentTBL] DROP CONSTRAINT [DF_userEmploymentTBL_archived];
+
+---- Primary Key
+----IF OBJECT_ID('[elfh].[PK_userEmploymentTBL]', 'PK') IS NOT NULL
+-- -- ALTER TABLE [elfh].[userEmploymentTBL] DROP CONSTRAINT [PK_userEmploymentTBL];
+
+
+--DROP TABLE IF EXISTS elfh.medicalCouncilTBL;
+--DROP TABLE IF EXISTS elfh.gradeTBL;
+--DROP TABLE IF EXISTS elfh.deaneryTBL;
+--DROP TABLE IF EXISTS elfh.locationTBL;
+--DROP TABLE IF EXISTS elfh.locationTypeTBL;
+--DROP TABLE IF EXISTS elfh.jobRoleTBL;
+--DROP TABLE IF EXISTS elfh.schoolTBL;
+--DROP TABLE IF EXISTS elfh.staffGroupTBL;
+--DROP TABLE IF EXISTS elfh.specialtyTBL;
+
+
+--IF OBJECT_ID('[hub].[FK_userTBL_countryTBL]', 'F') IS NOT NULL
+--BEGIN
+-- ALTER TABLE hub.[User]
+-- DROP CONSTRAINT FK_userTBL_countryTBL;
+--END;
+
+--IF OBJECT_ID('[hub].[FK_userTBL_regionTBL]', 'F') IS NOT NULL
+--BEGIN
+-- ALTER TABLE hub.[User]
+-- DROP CONSTRAINT FK_userTBL_regionTBL;
+--END;
+
+--IF OBJECT_ID('[hub].[FK_userTBL_userEmploymentTBL]', 'F') IS NOT NULL
+--BEGIN
+-- ALTER TABLE hub.[User]
+-- DROP CONSTRAINT FK_userTBL_userEmploymentTBL;
+--END;
+
+--DROP TABLE IF EXISTS elfh.userEmploymentTBL;
+--DROP TABLE IF EXISTS elfh.regionTBL;
+--DROP TABLE IF EXISTS elfh.countryTBL;
+--DROP TABLE IF EXISTS elfh.userEmploymentTBL;
+--DROP TABLE IF EXISTS elfh.regionTBL;
+--DROP TABLE IF EXISTS elfh.countryTBL;
+--DROP TABLE IF EXISTS elfh.userHistoryAttributeTBL
+
+
+
+
+DECLARE @sql NVARCHAR(MAX) = N'';
+
+SELECT @sql = @sql + '
+ALTER TABLE ' + QUOTENAME(SCHEMA_NAME(fk.schema_id)) + '.' + QUOTENAME(OBJECT_NAME(fk.parent_object_id)) +
+' DROP CONSTRAINT ' + QUOTENAME(fk.name) + ';'
+FROM sys.foreign_keys fk
+WHERE fk.referenced_object_id IN (
+ SELECT object_id FROM sys.tables WHERE schema_id = SCHEMA_ID('elfh')
+);
+
+EXEC sp_executesql @sql;
+
+
+/* ============================================================
+ 2. DROP SPECIFIC FOREIGN KEYS OUTSIDE elfh (hub.User)
+ ============================================================ */
+IF OBJECT_ID('[hub].[FK_userTBL_countryTBL]', 'F') IS NOT NULL
+ ALTER TABLE hub.[User] DROP CONSTRAINT [FK_userTBL_countryTBL];
+
+IF OBJECT_ID('[hub].[FK_userTBL_regionTBL]', 'F') IS NOT NULL
+ ALTER TABLE hub.[User] DROP CONSTRAINT [FK_userTBL_regionTBL];
+
+IF OBJECT_ID('[hub].[FK_userTBL_userEmploymentTBL]', 'F') IS NOT NULL
+ ALTER TABLE hub.[User] DROP CONSTRAINT [FK_userTBL_userEmploymentTBL];
+
+
+/* ============================================================
+ 3. DROP ALL DEFAULT CONSTRAINTS IN elfh SCHEMA
+ ============================================================ */
+SET @sql = N'';
+
+SELECT @sql = @sql + '
+ALTER TABLE ' + QUOTENAME(SCHEMA_NAME(t.schema_id)) + '.' + QUOTENAME(t.name) +
+' DROP CONSTRAINT ' + QUOTENAME(dc.name) + ';'
+FROM sys.default_constraints dc
+JOIN sys.tables t ON dc.parent_object_id = t.object_id
+WHERE t.schema_id = SCHEMA_ID('elfh');
+
+EXEC sp_executesql @sql;
+
+
+/* ============================================================
+ 4. DROP ALL TABLES IN elfh SCHEMA
+ ============================================================ */
+SET @sql = N'';
+
+SELECT @sql = @sql + '
+DROP TABLE ' + QUOTENAME(SCHEMA_NAME(schema_id)) + '.' + QUOTENAME(name) + ';'
+FROM sys.tables
+WHERE schema_id = SCHEMA_ID('elfh')
+ORDER BY name;
+
+EXEC sp_executesql @sql;
+
+
diff --git a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergeEmailTemplate.sql b/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergeEmailTemplate.sql
deleted file mode 100644
index 92f822c7f..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergeEmailTemplate.sql
+++ /dev/null
@@ -1,59 +0,0 @@
--------------------------------------------------------------------------------
--- Author Sarathlal
--- Created 04-11-2025
--- Purpose ELFH-LH Data sync
---
--- Modification History
---
--- 04-11-2025 Sarathlal Initial Revision
--------------------------------------------------------------------------------
-CREATE PROCEDURE [dbo].[AdfMergeEmailTemplate]
- @EmailTemplateList [dbo].[EmailTemplate] READONLY
-AS
-BEGIN
- SET NOCOUNT ON;
- SET IDENTITY_INSERT [elfh].[emailTemplateTBL] ON;
- MERGE [elfh].[emailTemplateTBL] AS TARGET
- USING @EmailTemplateList AS SOURCE
- ON TARGET.[emailTemplateId] = SOURCE.[emailTemplateId]
-
- WHEN MATCHED THEN
- UPDATE SET
- TARGET.[emailTemplateTypeId] = SOURCE.[emailTemplateTypeId],
- TARGET.[programmeComponentId] = SOURCE.[programmeComponentId],
- TARGET.[title] = SOURCE.[title],
- TARGET.[subject] = SOURCE.[subject],
- TARGET.[body] = SOURCE.[body],
- TARGET.[deleted] = SOURCE.[deleted],
- TARGET.[amendUserID] = SOURCE.[amendUserID],
- TARGET.[amendDate] = SOURCE.[amendDate],
- TARGET.[tenantId] = SOURCE.[tenantId]
-
- WHEN NOT MATCHED BY TARGET THEN
- INSERT (
- [emailTemplateId],
- [emailTemplateTypeId],
- [programmeComponentId],
- [title],
- [subject],
- [body],
- [deleted],
- [amendUserID],
- [amendDate],
- [tenantId]
- )
- VALUES (
- SOURCE.[emailTemplateId],
- SOURCE.[emailTemplateTypeId],
- SOURCE.[programmeComponentId],
- SOURCE.[title],
- SOURCE.[subject],
- SOURCE.[body],
- SOURCE.[deleted],
- SOURCE.[amendUserID],
- SOURCE.[amendDate],
- SOURCE.[tenantId]
- );
- SET IDENTITY_INSERT [elfh].[emailTemplateTBL] OFF;
-END;
-GO
diff --git a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergeEmploymentReferenceType.sql b/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergeEmploymentReferenceType.sql
deleted file mode 100644
index 03816a823..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergeEmploymentReferenceType.sql
+++ /dev/null
@@ -1,39 +0,0 @@
--------------------------------------------------------------------------------
--- Author Sarathlal
--- Created 04-11-2025
--- Purpose ELFH-LH Data sync
---
--- Modification History
---
--- 04-11-2025 Sarathlal Initial Revision
--------------------------------------------------------------------------------
-CREATE PROCEDURE [dbo].[AdfMergeEmploymentReferenceType]
- @EmploymentReferenceType dbo.EmploymentReferenceType READONLY
-AS
-BEGIN
- SET NOCOUNT ON;
-
-
- MERGE [ELFH].[employmentReferenceTypeTBL] AS target
- USING @EmploymentReferenceType AS source
- ON target.[EmploymentReferenceTypeId] = source.[EmploymentReferenceTypeId]
-
- WHEN MATCHED THEN
- UPDATE SET
- target.[Title] = source.[Title],
- target.[RefAccess] = source.[RefAccess]
-
- WHEN NOT MATCHED BY TARGET THEN
- INSERT (
- [EmploymentReferenceTypeId],
- [Title],
- [RefAccess]
- )
- VALUES (
- source.[EmploymentReferenceTypeId],
- source.[Title],
- source.[RefAccess]
- );
-
-END
-GO
diff --git a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergeHubUser.sql b/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergeHubUser.sql
deleted file mode 100644
index eeb1e5df8..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergeHubUser.sql
+++ /dev/null
@@ -1,72 +0,0 @@
--------------------------------------------------------------------------------
--- Author Sarathlal
--- Created 04-11-2025
--- Purpose ELFH-LH Data sync
---
--- Modification History
---
--- 04-11-2025 Sarathlal Initial Revision
--------------------------------------------------------------------------------
-CREATE PROCEDURE [dbo].[AdfMergeHubUser]
- @UserList [dbo].[UserType_Hub] READONLY
-AS
-BEGIN
- SET NOCOUNT ON;
-
- ALTER TABLE [hub].[user] NOCHECK CONSTRAINT FK_userTBL_userEmploymentTBL;
- ALTER TABLE [elfh].[userEmploymentTBL] NOCHECK CONSTRAINT FK_userEmploymentTBL_userTBL;
- ALTER TABLE [hub].[User] NOCHECK CONSTRAINT ALL;
-
- MERGE [hub].[User] AS target
- USING @UserList AS source
- ON target.[Id] = source.[Id]
- WHEN MATCHED THEN
- UPDATE SET
- target.[UserName] = source.[UserName],
- target.[countryId] = source.[countryId],
- target.[registrationCode] = source.[registrationCode],
- target.[activeFromDate] = source.[activeFromDate],
- target.[activeToDate] = source.[activeToDate],
- target.[passwordHash] = source.[passwordHash],
- target.[mustChangeNextLogin] = source.[mustChangeNextLogin],
- target.[passwordLifeCounter] = source.[passwordLifeCounter],
- target.[securityLifeCounter] = source.[securityLifeCounter],
- target.[RemoteLoginKey] = source.[RemoteLoginKey],
- target.[RemoteLoginGuid] = source.[RemoteLoginGuid],
- target.[RemoteLoginStart] = source.[RemoteLoginStart],
- target.[RestrictToSSO] = source.[RestrictToSSO],
- target.[loginTimes] = source.[loginTimes],
- target.[loginWizardInProgress] = source.[loginWizardInProgress],
- target.[lastLoginWizardCompleted] = source.[lastLoginWizardCompleted],
- target.[primaryUserEmploymentId] = source.[primaryUserEmploymentId],
- target.[regionId] = source.[regionId],
- target.[preferredTenantId] = source.[preferredTenantId],
- target.[AmendUserId] = source.[AmendUserId],
- target.[AmendDate] = source.[AmendDate],
- target.[Deleted] = source.[Deleted]
- WHEN NOT MATCHED BY TARGET THEN
- INSERT (
- [Id], [UserName], [countryId], [registrationCode],
- [activeFromDate], [activeToDate], [passwordHash],
- [mustChangeNextLogin], [passwordLifeCounter], [securityLifeCounter],
- [RemoteLoginKey], [RemoteLoginGuid], [RemoteLoginStart],
- [RestrictToSSO], [loginTimes], [loginWizardInProgress],
- [lastLoginWizardCompleted], [primaryUserEmploymentId],
- [regionId], [preferredTenantId], [CreateUserId],
- [CreateDate], [AmendUserId], [AmendDate], [Deleted]
- )
- VALUES (
- source.[Id], source.[UserName], source.[countryId], source.[registrationCode],
- source.[activeFromDate], source.[activeToDate], source.[passwordHash],
- source.[mustChangeNextLogin], source.[passwordLifeCounter], source.[securityLifeCounter],
- source.[RemoteLoginKey], source.[RemoteLoginGuid], source.[RemoteLoginStart],
- source.[RestrictToSSO], source.[loginTimes], source.[loginWizardInProgress],
- source.[lastLoginWizardCompleted], source.[primaryUserEmploymentId],
- source.[regionId], source.[preferredTenantId],4,
- source.[CreateDate], source.[AmendUserId], source.[AmendDate], source.[Deleted]
- );
- ALTER TABLE [hub].[user] NOCHECK CONSTRAINT FK_userTBL_userEmploymentTBL;
- ALTER TABLE [elfh].[userEmploymentTBL] NOCHECK CONSTRAINT FK_userEmploymentTBL_userTBL;
- ALTER TABLE [hub].[User] CHECK CONSTRAINT ALL;
-END
-GO
diff --git a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergeMergeUser.sql b/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergeMergeUser.sql
deleted file mode 100644
index f4b3dbe93..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergeMergeUser.sql
+++ /dev/null
@@ -1,47 +0,0 @@
--------------------------------------------------------------------------------
--- Author Sarathlal
--- Created 04-11-2025
--- Purpose ELFH-LH Data sync
---
--- Modification History
---
--- 04-11-2025 Sarathlal Initial Revision
--------------------------------------------------------------------------------
-CREATE PROCEDURE [AdfMergeMergeUser]
- @MergeUserList dbo.MergeUser READONLY
-AS
-BEGIN
- SET NOCOUNT ON;
-
- SET IDENTITY_INSERT [elfh].[mergeUserTBL] ON;
-
- MERGE [elfh].[mergeUserTBL] AS target
- USING @MergeUserList AS source
- ON target.[mergeUserId] = source.[mergeUserId]
-
- WHEN MATCHED THEN
- UPDATE SET
- target.[fromUserId] = source.[fromUserId],
- target.[intoUserId] = source.[intoUserId],
- target.[amendUserId] = source.[amendUserId],
- target.[createdDatetime] = source.[createdDatetime]
-
- WHEN NOT MATCHED BY TARGET THEN
- INSERT (
- [mergeUserId],
- [fromUserId],
- [intoUserId],
- [amendUserId],
- [createdDatetime]
- )
- VALUES (
- source.[mergeUserId],
- source.[fromUserId],
- source.[intoUserId],
- source.[amendUserId],
- source.[createdDatetime]
- );
-
- SET IDENTITY_INSERT [elfh].[mergeUserTBL] OFF;
-END
-GO
diff --git a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergeUserAdminLocation.sql b/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergeUserAdminLocation.sql
deleted file mode 100644
index 3d7d41724..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergeUserAdminLocation.sql
+++ /dev/null
@@ -1,81 +0,0 @@
--------------------------------------------------------------------------------
--- Author Sarathlal
--- Created 04-11-2025
--- Purpose ELFH-LH Data sync
---
--- Modification History
---
--- 04-11-2025 Sarathlal Initial Revision
--- 14-01-2026 Swapna TD-6760: To handle duplicate records in the Sync table
--------------------------------------------------------------------------------
-CREATE PROCEDURE [dbo].[AdfMergeUserAdminLocation]
- @UserAdminLocationList dbo.UserAdminLocationType READONLY
-AS
-BEGIN
- SET NOCOUNT ON;
-
- --------------------------------------------------------------------
- -- 1. Remove deleted duplicates when an active row exists
- --------------------------------------------------------------------
- DELETE tgt
- FROM elfh.userAdminLocationTBL tgt
- INNER JOIN @UserAdminLocationList src
- ON tgt.userId = src.userId
- AND tgt.adminLocationId = src.adminLocationId
- WHERE tgt.deleted = 1
- AND EXISTS (
- SELECT 1
- FROM elfh.userAdminLocationTBL a
- WHERE a.userId = src.userId
- AND a.adminLocationId = src.adminLocationId
- AND a.deleted = 0
- );
-
- --------------------------------------------------------------------
- -- 2. Update existing ACTIVE rows only
- -- (do NOT overwrite deleted rows)
- --------------------------------------------------------------------
- UPDATE tgt
- SET
- tgt.amendUserId = src.amendUserId,
- tgt.amendDate = src.amendDate,
- tgt.createdUserId = src.createdUserId,
- tgt.createdDate = src.createdDate,
- tgt.deleted = src.deleted
- FROM elfh.userAdminLocationTBL tgt
- INNER JOIN @UserAdminLocationList src
- ON tgt.userId = src.userId
- AND tgt.adminLocationId = src.adminLocationId
- WHERE tgt.deleted = 0;
-
- --------------------------------------------------------------------
- -- 3. Insert rows that do not exist
- -- (both deleted = 0 and deleted = 1 allowed)
- --------------------------------------------------------------------
- INSERT INTO elfh.userAdminLocationTBL (
- userId,
- adminLocationId,
- deleted,
- amendUserId,
- amendDate,
- createdUserId,
- createdDate
- )
- SELECT
- src.userId,
- src.adminLocationId,
- src.deleted,
- src.amendUserId,
- src.amendDate,
- src.createdUserId,
- src.createdDate
- FROM @UserAdminLocationList src
- WHERE NOT EXISTS (
- SELECT 1
- FROM elfh.userAdminLocationTBL tgt WITH (UPDLOCK, HOLDLOCK)
- WHERE tgt.userId = src.userId
- AND tgt.adminLocationId = src.adminLocationId
- AND tgt.deleted = src.deleted
- );
-END;
-GO
diff --git a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergeUserAttribute.sql b/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergeUserAttribute.sql
deleted file mode 100644
index ebdf23815..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergeUserAttribute.sql
+++ /dev/null
@@ -1,62 +0,0 @@
--------------------------------------------------------------------------------
--- Author Sarathlal
--- Created 04-11-2025
--- Purpose ELFH-LH Data sync
---
--- Modification History
---
--- 04-11-2025 Sarathlal Initial Revision
--------------------------------------------------------------------------------
-CREATE PROCEDURE [dbo].[AdfMergeUserAttribute]
- @userAttributeList dbo.UserAttribute READONLY -- Table-valued parameter
-AS
-BEGIN
- SET NOCOUNT ON;
- SET IDENTITY_INSERT [elfh].[userAttributeTBL] ON;
-
- MERGE [elfh].[userAttributeTBL] AS target
- USING @userAttributeList AS source
- ON target.userAttributeId = source.userAttributeId
-
- WHEN MATCHED THEN
- UPDATE SET
- userId = source.userId,
- attributeId = source.attributeId,
- intValue = source.intValue,
- textValue = source.textValue,
- booleanValue = source.booleanValue,
- dateValue = source.dateValue,
- deleted = source.deleted,
- amendUserId = source.amendUserId,
- amendDate = source.amendDate
-
- WHEN NOT MATCHED THEN
- INSERT (
- userAttributeId,
- userId,
- attributeId,
- intValue,
- textValue,
- booleanValue,
- dateValue,
- deleted,
- amendUserId,
- amendDate
- )
- VALUES (
- source.userAttributeId,
- source.userId,
- source.attributeId,
- source.intValue,
- source.textValue,
- source.booleanValue,
- source.dateValue,
- source.deleted,
- source.amendUserId,
- source.amendDate
- );
-
- -- Disable identity insert
- SET IDENTITY_INSERT [elfh].[userAttributeTBL] OFF;
-END
-GO
diff --git a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergeUserEmploymentReference.sql b/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergeUserEmploymentReference.sql
deleted file mode 100644
index e6f0d2ad3..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergeUserEmploymentReference.sql
+++ /dev/null
@@ -1,53 +0,0 @@
--------------------------------------------------------------------------------
--- Author Sarathlal
--- Created 04-11-2025
--- Purpose ELFH-LH Data sync
---
--- Modification History
---
--- 04-11-2025 Sarathlal Initial Revision
--------------------------------------------------------------------------------
-CREATE PROCEDURE [dbo].[AdfMergeUserEmploymentReference]
- @UserEmploymentReferenceList dbo.UserEmploymentReferenceType READONLY
-AS
-BEGIN
- SET NOCOUNT ON;
-
- SET IDENTITY_INSERT [elfh].[userEmploymentReferenceTBL] ON;
- ALTER TABLE [elfh].[userEmploymentReferenceTBL] NOCHECK CONSTRAINT ALL;
- MERGE [elfh].[userEmploymentReferenceTBL] AS target
- USING @UserEmploymentReferenceList AS source
- ON target.[userEmploymentReferenceId] = source.[userEmploymentReferenceId]
-
- WHEN MATCHED THEN
- UPDATE SET
- target.[employmentReferenceTypeId] = source.[employmentReferenceTypeId],
- target.[userEmploymentId] = source.[userEmploymentId],
- target.[referenceValue] = source.[referenceValue],
- target.[deleted] = source.[deleted],
- target.[amendUserId] = source.[amendUserId],
- target.[amendDate] = source.[amendDate]
-
- WHEN NOT MATCHED BY TARGET THEN
- INSERT (
- [userEmploymentReferenceId],
- [employmentReferenceTypeId],
- [userEmploymentId],
- [referenceValue],
- [deleted],
- [amendUserId],
- [amendDate]
- )
- VALUES (
- source.[userEmploymentReferenceId],
- source.[employmentReferenceTypeId],
- source.[userEmploymentId],
- source.[referenceValue],
- source.[deleted],
- source.[amendUserId],
- source.[amendDate]
- );
- SET IDENTITY_INSERT [elfh].[userEmploymentReferenceTBL] OFF;
- ALTER TABLE [elfh].[userEmploymentReferenceTBL] NOCHECK CONSTRAINT ALL;
-END
-GO
diff --git a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergeUserEmploymentResponsibility.sql b/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergeUserEmploymentResponsibility.sql
deleted file mode 100644
index ca257de1f..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergeUserEmploymentResponsibility.sql
+++ /dev/null
@@ -1,45 +0,0 @@
--------------------------------------------------------------------------------
--- Author Sarathlal
--- Created 04-11-2025
--- Purpose ELFH-LH Data sync
---
--- Modification History
---
--- 04-11-2025 Sarathlal Initial Revision
--------------------------------------------------------------------------------
-CREATE PROCEDURE [AdfMergeUserEmploymentResponsibility]
- @UserEmploymentResponsibilityList dbo.UserEmploymentResponsibilityType READONLY
-AS
-BEGIN
- SET NOCOUNT ON;
-
- SET IDENTITY_INSERT [elfh].[userEmploymentResponsibilityTBL] ON;
- MERGE [elfh].[userEmploymentResponsibilityTBL] AS target
- USING @UserEmploymentResponsibilityList AS source
- ON target.[userEmploymentResponsibilityId] = source.[userEmploymentResponsibilityId]
-
- WHEN MATCHED THEN
- UPDATE SET
- target.[userEmploymentId] = source.[userEmploymentId],
- target.[additionalResponsibilityId] = source.[additionalResponsibilityId],
- target.[deleted] = source.[deleted],
- target.[amendUserId] = source.[amendUserId]
-
- WHEN NOT MATCHED BY TARGET THEN
- INSERT (
- [userEmploymentResponsibilityId],
- [userEmploymentId],
- [additionalResponsibilityId],
- [deleted],
- [amendUserId]
- )
- VALUES (
- source.[userEmploymentResponsibilityId],
- source.[userEmploymentId],
- source.[additionalResponsibilityId],
- source.[deleted],
- source.[amendUserId]
- );
- SET IDENTITY_INSERT [elfh].[userEmploymentResponsibilityTBL] OFF;
-END
-GO
diff --git a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergeUserGroupReporter.sql b/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergeUserGroupReporter.sql
deleted file mode 100644
index d1817a389..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergeUserGroupReporter.sql
+++ /dev/null
@@ -1,50 +0,0 @@
--------------------------------------------------------------------------------
--- Author Sarathlal
--- Created 25-11-2025
--- Purpose ELFH-LH Data sync
---
--- Modification History
---
--- 25-11-2025 Sarathlal Initial Revision
--------------------------------------------------------------------------------
-CREATE PROCEDURE [dbo].[AdfMergeUserGroupReporter]
- @UserGroupReporterList [dbo].[UserGroupReporterType] READONLY
-AS
-BEGIN
- SET NOCOUNT ON;
- SET IDENTITY_INSERT [elfh].[userGroupReporterTBL] ON;
- ALTER TABLE elfh.userGroupReporterTBL NOCHECK CONSTRAINT FK_userGroupReporterTBL_userGroupTBL;
- MERGE [elfh].[userGroupReporterTBL] AS target
- USING @UserGroupReporterList AS source
- ON target.[userGroupReporterId] = source.[userGroupReporterId]
-
- WHEN MATCHED THEN
- UPDATE SET
- target.[userId] = source.[userId],
- target.[userGroupId] = source.[userGroupId],
- target.[deleted] = source.[deleted],
- target.[amendUserId] = source.[amendUserId],
- target.[amendDate] = source.[amendDate]
-
- WHEN NOT MATCHED BY TARGET THEN
- INSERT (
- [userGroupReporterId],
- [userId],
- [userGroupId],
- [deleted],
- [amendUserId],
- [amendDate]
- )
- VALUES (
- source.[userGroupReporterId],
- source.[userId],
- source.[userGroupId],
- source.[deleted],
- source.[amendUserId],
- source.[amendDate]
- );
- SET IDENTITY_INSERT [elfh].[userGroupReporterTBL] OFF;
- ALTER TABLE elfh.userGroupReporterTBL CHECK CONSTRAINT FK_userGroupReporterTBL_userGroupTBL;
-END
-GO
-
diff --git a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergeUserGroupTypeInputValidation.sql b/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergeUserGroupTypeInputValidation.sql
deleted file mode 100644
index 9ffedb0b1..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergeUserGroupTypeInputValidation.sql
+++ /dev/null
@@ -1,67 +0,0 @@
--------------------------------------------------------------------------------
--- Author Sarathlal
--- Created 04-11-2025
--- Purpose ELFH-LH Data sync
---
--- Modification History
---
--- 04-11-2025 Sarathlal Initial Revision
--------------------------------------------------------------------------------
-CREATE PROCEDURE [dbo].[AdfMergeUserGroupTypeInputValidation]
- @userGroupTypeInputValidationList dbo.UserGroupTypeInputValidation READONLY -- Table-valued parameter
-AS
-BEGIN
- SET NOCOUNT ON;
-
- -- Enable identity insert if userGroupTypeInputValidationId is an IDENTITY column
- SET IDENTITY_INSERT [elfh].[userGroupTypeInputValidationTBL] ON;
-
- MERGE [elfh].[userGroupTypeInputValidationTBL] AS target
- USING @userGroupTypeInputValidationList AS source
- ON target.userGroupTypeInputValidationId = source.userGroupTypeInputValidationId
-
- WHEN MATCHED THEN
- UPDATE SET
- userGroupId = source.userGroupId,
- userGroupTypePrefix = source.userGroupTypePrefix,
- userGroupTypeId = source.userGroupTypeId,
- validationTextValue = source.validationTextValue,
- validationMethod = source.validationMethod,
- deleted = source.deleted,
- amendUserId = source.amendUserId,
- amendDate = source.amendDate,
- createdUserId = source.createdUserId,
- createdDate = source.createdDate
-
- WHEN NOT MATCHED THEN
- INSERT (
- userGroupTypeInputValidationId,
- userGroupId,
- userGroupTypePrefix,
- userGroupTypeId,
- validationTextValue,
- validationMethod,
- deleted,
- amendUserId,
- amendDate,
- createdUserId,
- createdDate
- )
- VALUES (
- source.userGroupTypeInputValidationId,
- source.userGroupId,
- source.userGroupTypePrefix,
- source.userGroupTypeId,
- source.validationTextValue,
- source.validationMethod,
- source.deleted,
- source.amendUserId,
- source.amendDate,
- source.createdUserId,
- source.createdDate
- );
-
- -- Disable identity insert
- SET IDENTITY_INSERT [elfh].[userGroupTypeInputValidationTBL] OFF;
-END
-GO
diff --git a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergeUserHistory.sql b/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergeUserHistory.sql
deleted file mode 100644
index 7a53f6577..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergeUserHistory.sql
+++ /dev/null
@@ -1,49 +0,0 @@
--------------------------------------------------------------------------------
--- Author Sarathlal
--- Created 04-11-2025
--- Purpose ELFH-LH Data sync
---
--- Modification History
---
--- 04-11-2025 Sarathlal Initial Revision
--------------------------------------------------------------------------------
-CREATE PROCEDURE [dbo].[AdfMergeUserHistory]
- @userHistoryList dbo.UserHistory READONLY
-AS
-BEGIN
- SET NOCOUNT ON;
-
- -- Enable identity insert if userHistoryId is an IDENTITY column
- SET IDENTITY_INSERT [elfh].[userHistoryTBL] ON;
-
- MERGE [elfh].[userHistoryTBL] AS target
- USING @userHistoryList AS source
- ON target.[userHistoryId] = source.[userHistoryId]
-
- WHEN MATCHED THEN
- UPDATE SET
- [userHistoryTypeId] = source.[userHistoryTypeId],
- [userId] = source.[userId],
- [createdDate] = source.[createdDate],
- [tenantId] = source.[tenantId]
-
- WHEN NOT MATCHED THEN
- INSERT (
- [userHistoryId],
- [userHistoryTypeId],
- [userId],
- [createdDate],
- [tenantId]
- )
- VALUES (
- source.[userHistoryId],
- source.[userHistoryTypeId],
- source.[userId],
- source.[createdDate],
- source.[tenantId]
- );
-
- -- Disable identity insert
- SET IDENTITY_INSERT [elfh].[userHistoryTBL] OFF;
-END
-GO
diff --git a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergeUserHistoryType.sql b/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergeUserHistoryType.sql
deleted file mode 100644
index f7fc0d735..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergeUserHistoryType.sql
+++ /dev/null
@@ -1,35 +0,0 @@
--------------------------------------------------------------------------------
--- Author Sarathlal
--- Created 04-11-2025
--- Purpose ELFH-LH Data sync
---
--- Modification History
---
--- 04-11-2025 Sarathlal Initial Revision
--------------------------------------------------------------------------------
-CREATE PROCEDURE [dbo].[AdfMergeUserHistoryType]
- @userHistoryTypeList dbo.UserHistoryType READONLY
-AS
-BEGIN
- SET NOCOUNT ON;
-
- MERGE [ELFH].[userHistoryTypeTBL] AS target
- USING @userHistoryTypeList AS source
- ON target.UserHistoryTypeId = source.UserHistoryTypeId
-
- WHEN MATCHED THEN
- UPDATE SET
- [Description] = source.[Description]
-
- WHEN NOT MATCHED THEN
- INSERT (
- [UserHistoryTypeId],
- [Description]
- )
- VALUES (
- source.[UserHistoryTypeId],
- source.[Description]
- );
-
-END
-GO
diff --git a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergeUserPasswordValidationToke.sql b/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergeUserPasswordValidationToke.sql
deleted file mode 100644
index c37cbd567..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergeUserPasswordValidationToke.sql
+++ /dev/null
@@ -1,64 +0,0 @@
--------------------------------------------------------------------------------
--- Author Sarathlal
--- Created 04-11-2025
--- Purpose ELFH-LH Data sync
---
--- Modification History
---
--- 04-11-2025 Sarathlal Initial Revision
--------------------------------------------------------------------------------
-CREATE PROCEDURE [dbo].[AdfMergeUserPasswordValidationToken]
- @userPasswordValidationTokenList dbo.UserPasswordValidationToken READONLY
-AS
-BEGIN
- SET NOCOUNT ON;
-
- -- Enable identity insert if userPasswordValidationTokenId is an IDENTITY column
- SET IDENTITY_INSERT [elfh].[userPasswordValidationTokenTBL] ON;
- ALTER TABLE [elfh].[userPasswordValidationTokenTBL] NOCHECK CONSTRAINT ALL;
- ALTER TABLE [hub].[User] NOCHECK CONSTRAINT ALL;
- MERGE [elfh].[userPasswordValidationTokenTBL] AS target
- USING @userPasswordValidationTokenList AS source
- ON target.userPasswordValidationTokenId = source.userPasswordValidationTokenId
-
- WHEN MATCHED THEN
- UPDATE SET
- hashedToken = source.hashedToken,
- salt = source.salt,
- [lookup] = source.[lookup],
- expiry = source.expiry,
- tenantId = source.tenantId,
- userId = source.userId,
- createdUserId = source.createdUserId,
- createdDate = source.createdDate
-
- WHEN NOT MATCHED THEN
- INSERT (
- userPasswordValidationTokenId,
- hashedToken,
- salt,
- [lookup],
- expiry,
- tenantId,
- userId,
- createdUserId,
- createdDate
- )
- VALUES (
- source.userPasswordValidationTokenId,
- source.hashedToken,
- source.salt,
- source.[lookup],
- source.expiry,
- source.tenantId,
- source.userId,
- source.createdUserId,
- source.createdDate
- );
-
- -- Disable identity insert
- SET IDENTITY_INSERT [elfh].[userPasswordValidationTokenTBL] OFF;
- ALTER TABLE [hub].[User] CHECK CONSTRAINT ALL;
- ALTER TABLE [elfh].[userPasswordValidationTokenTBL] CHECK CONSTRAINT ALL;
-END
-GO
diff --git a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergeUserProfileData.sql b/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergeUserProfileData.sql
deleted file mode 100644
index d1e51c702..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergeUserProfileData.sql
+++ /dev/null
@@ -1,68 +0,0 @@
--------------------------------------------------------------------------------
--- Author Sarathlal
--- Created 04-11-2025
--- Purpose ELFH-LH Data sync
---
--- Modification History
---
--- 04-11-2025 Sarathlal Initial Revision
--------------------------------------------------------------------------------
-CREATE PROCEDURE [dbo].[AdfMergeUserProfileData]
- @UserProfileLists [dbo].[UserProfileType] READONLY
-AS
-BEGIN
- SET NOCOUNT ON;
-
- MERGE [hub].[UserProfile] AS target
- USING @UserProfileLists AS source
- ON target.[Id] = source.[Id]
-
- WHEN MATCHED THEN
- UPDATE SET
- target.[UserName] = source.[UserName],
- target.[EmailAddress] = source.[EmailAddress],
- target.[AltEmailAddress] = source.[AltEmailAddress],
- target.[FirstName] = source.[FirstName],
- target.[LastName] = source.[LastName],
- target.[PreferredName] = source.[PreferredName],
- target.[Active] = source.[Active],
- target.[AmendUserId] = source.[AmendUserId],
- target.[AmendDate] = source.[AmendDate],
- target.[Deleted] = source.[Deleted]
-
- WHEN NOT MATCHED BY TARGET THEN
- INSERT (
- [Id],
- [UserName],
- [EmailAddress],
- [AltEmailAddress],
- [FirstName],
- [LastName],
- [PreferredName],
- [Active],
- [CreateUserId],
- [CreateDate],
- [AmendUserId],
- [AmendDate],
- [Deleted]
- )
- VALUES (
- source.[Id],
- source.[UserName],
- source.[EmailAddress],
- source.[AltEmailAddress],
- source.[FirstName],
- source.[LastName],
- source.[PreferredName],
- source.[Active],
- 4,
- source.[CreateDate],
- source.[AmendUserId],
- source.[AmendDate],
- source.[Deleted]
- );
-
-
-
-END;
-GO
diff --git a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergeUserReportingUser.sql b/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergeUserReportingUser.sql
deleted file mode 100644
index e890b67cd..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergeUserReportingUser.sql
+++ /dev/null
@@ -1,52 +0,0 @@
--------------------------------------------------------------------------------
--- Author Sarathlal
--- Created 04-11-2025
--- Purpose ELFH-LH Data sync
---
--- Modification History
---
--- 04-11-2025 Sarathlal Initial Revision
--------------------------------------------------------------------------------
-CREATE PROCEDURE [AdfMergeUserReportingUser]
- @UserReportingUserList dbo.UserReportingUserType READONLY
-AS
-BEGIN
- SET NOCOUNT ON;
-
- SET IDENTITY_INSERT [elfh].[userReportingUserTBL] ON;
- MERGE [elfh].[userReportingUserTBL] AS target
- USING @UserReportingUserList AS source
- ON target.[userReportingUserId] = source.[userReportingUserId]
-
- WHEN MATCHED THEN
- UPDATE SET
- target.[userId] = source.[userId],
- target.[reportingUserId] = source.[reportingUserId],
- target.[reportable] = source.[reportable],
- target.[Deleted] = source.[Deleted],
- target.[AmendUserID] = source.[AmendUserID],
- target.[AmendDate] = source.[AmendDate]
-
- WHEN NOT MATCHED BY TARGET THEN
- INSERT (
- [userReportingUserId],
- [userId],
- [reportingUserId],
- [reportable],
- [Deleted],
- [AmendUserID],
- [AmendDate]
- )
- VALUES (
- source.[userReportingUserId],
- source.[userId],
- source.[reportingUserId],
- source.[reportable],
- source.[Deleted],
- source.[AmendUserID],
- source.[AmendDate]
- );
- SET IDENTITY_INSERT [elfh].[userReportingUserTBL] OFF;
- -- Optionally re-enable constraints
-END
-GO
diff --git a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergeUserRoleUpgrade.sql b/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergeUserRoleUpgrade.sql
deleted file mode 100644
index 256cac018..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergeUserRoleUpgrade.sql
+++ /dev/null
@@ -1,64 +0,0 @@
--------------------------------------------------------------------------------
--- Author Sarathlal
--- Created 04-11-2025
--- Purpose ELFH-LH Data sync
---
--- Modification History
---
--- 04-11-2025 Sarathlal Initial Revision
--------------------------------------------------------------------------------
-CREATE PROCEDURE [dbo].[AdfMergeUserRoleUpgrade]
- @userRoleUpgradeList dbo.UserRoleUpgrade READONLY
-AS
-BEGIN
- SET NOCOUNT ON;
-
- -- Enable identity insert if userRoleUpgradeId is an IDENTITY column
- SET IDENTITY_INSERT [elfh].[userRoleUpgradeTBL] ON;
-
- MERGE [elfh].[userRoleUpgradeTBL] AS target
- USING @userRoleUpgradeList AS source
- ON target.[userRoleUpgradeId] = source.[userRoleUpgradeId]
-
- WHEN MATCHED THEN
- UPDATE SET
- [userId] = source.[userId],
- [emailAddress] = source.[emailAddress],
- [upgradeDate] = source.[upgradeDate],
- [deleted] = source.[deleted],
- [createUserId] = source.[createUserId],
- [createDate] = source.[createDate],
- [amendUserId] = source.[amendUserId],
- [amendDate] = source.[amendDate],
- [userHistoryTypeId] = source.[userHistoryTypeId]
-
- WHEN NOT MATCHED THEN
- INSERT (
- [userRoleUpgradeId],
- [userId],
- [emailAddress],
- [upgradeDate],
- [deleted],
- [createUserId],
- [createDate],
- [amendUserId],
- [amendDate],
- [userHistoryTypeId]
- )
- VALUES (
- source.[userRoleUpgradeId],
- source.[userId],
- source.[emailAddress],
- source.[upgradeDate],
- source.[deleted],
- source.[createUserId],
- source.[createDate],
- source.[amendUserId],
- source.[amendDate],
- source.[userHistoryTypeId]
- );
-
- -- Disable identity insert
- SET IDENTITY_INSERT [elfh].[userRoleUpgradeTBL] OFF;
-END
-GO
diff --git a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergeattribute.sql b/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergeattribute.sql
deleted file mode 100644
index 33969535a..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergeattribute.sql
+++ /dev/null
@@ -1,629 +0,0 @@
--------------------------------------------------------------------------------
--- Author Sarathlal
--- Created 04-11-2025
--- Purpose ELFH-LH Data sync
---
--- Modification History
---
--- 04-11-2025 Sarathlal Initial Revision
--------------------------------------------------------------------------------
-CREATE TYPE [dbo].[EmailTemplate] AS TABLE
-(
- [emailTemplateId] INT,
- [emailTemplateTypeId] INT,
- [programmeComponentId] INT,
- [title] NVARCHAR(256),
- [subject] NVARCHAR(256),
- [body] ntext,
- [deleted] BIT,
- [amendUserID] INT,
- [amendDate] DATETIMEOFFSET,
- [tenantId] INT
-);
-GO
-CREATE TYPE dbo.UserReportingUserType AS TABLE
-(
- [userReportingUserId] INT,
- [userId] INT,
- [reportingUserId] INT,
- [reportable] BIT,
- [Deleted] BIT,
- [AmendUserID] INT,
- [AmendDate] DATETIMEOFFSET
-);
-GO
-CREATE TYPE UserEmploymentResponsibilityType AS TABLE
-(
- [userEmploymentResponsibilityId] INT,
- [userEmploymentId] INT,
- [additionalResponsibilityId] INT,
- [deleted] BIT,
- [amendUserId] INT
-);
-GO
-CREATE TYPE UserEmploymentReferenceType AS TABLE
-(
- [userEmploymentReferenceId] INT,
- [employmentReferenceTypeId] INT,
- [userEmploymentId] INT,
- [referenceValue] NVARCHAR(100),
- [deleted] BIT,
- [amendUserId] INT,
- [amendDate] DATETIMEOFFSET
-);
-GO
-CREATE TYPE dbo.UserAdminLocationType AS TABLE
-(
- [userId] INT,
- [adminLocationId] INT,
- [deleted] BIT,
- [amendUserId] INT,
- [amendDate] DATETIMEOFFSET,
- [createdUserId] INT,
- [createdDate] DATETIMEOFFSET
-);
-GO
-CREATE TYPE dbo.MergeUser AS TABLE
-(
- [mergeUserId] INT,
- [fromUserId] INT,
- [intoUserId] INT,
- [amendUserId] INT,
- [createdDatetime] DATETIMEOFFSET
-);
-GO
-CREATE TYPE dbo.EmploymentReferenceType AS TABLE
-(
- [EmploymentReferenceTypeId] INT,
- [Title] NVARCHAR(255),
- [RefAccess] NVARCHAR(255)
-);
-GO
-CREATE TYPE [dbo].[UserProfileType] AS TABLE
-(
- [Id] INT ,
- [UserName] NVARCHAR(255) ,
- [EmailAddress] NVARCHAR(255) ,
- [AltEmailAddress] NVARCHAR(255) ,
- [FirstName] NVARCHAR(255) ,
- [LastName] NVARCHAR(255) ,
- [PreferredName] NVARCHAR(255) ,
- [Active] BIT ,
- [CreateDate] DATETIMEOFFSET,
- [AmendUserId] INT ,
- [AmendDate] DATETIMEOFFSET,
- [Deleted] BIT
-);
-GO
-CREATE TYPE dbo.UserType_Hub AS TABLE
-(
- [Id] INT,
- [UserName] NVARCHAR(250),
- [countryId] INT,
- [registrationCode] NVARCHAR(100),
- [activeFromDate] DATETIMEOFFSET,
- [activeToDate] DATETIMEOFFSET,
- [passwordHash] NVARCHAR(500),
- [mustChangeNextLogin] BIT,
- [passwordLifeCounter] INT,
- [securityLifeCounter] INT,
- [RemoteLoginKey] NVARCHAR(250),
- [RemoteLoginGuid] UNIQUEIDENTIFIER,
- [RemoteLoginStart] DATETIMEOFFSET,
- [RestrictToSSO] BIT,
- [loginTimes] INT,
- [loginWizardInProgress] BIT,
- [lastLoginWizardCompleted] DATETIMEOFFSET,
- [primaryUserEmploymentId] INT,
- [regionId] INT,
- [preferredTenantId] INT,
- [CreateDate] DATETIMEOFFSET,
- [AmendUserId] INT,
- [AmendDate] DATETIMEOFFSET,
- [Deleted] BIT
-);
-GO
-CREATE TYPE dbo.UserTermsAndConditions AS TABLE
-(
- [userTermsAndConditionsId] INT,
- [termsAndConditionsId] INT,
- [userId] INT,
- [acceptanceDate] DATETIMEOFFSET,
- [deleted] BIT,
- [amendUserID] INT,
- [amendDate] DATETIMEOFFSET
-);
-GO
-CREATE TYPE dbo.UserRoleUpgrade AS TABLE
-(
- [userRoleUpgradeId] INT,
- [userId] INT,
- [emailAddress] NVARCHAR(100),
- [upgradeDate] DATETIMEOFFSET,
- [deleted] BIT,
- [createUserId] INT,
- [createDate] DATETIMEOFFSET,
- [amendUserId] INT,
- [amendDate] DATETIMEOFFSET,
- [userHistoryTypeId] INT
-);
-GO
-CREATE TYPE dbo.UserHistory AS TABLE
-(
- [userHistoryId] INT,
- [userHistoryTypeId] INT,
- [userId] INT,
- [createdDate] DATETIMEOFFSET,
- [tenantId] INT
-);
-GO
-CREATE TYPE dbo.UserHistoryType AS TABLE
-(
- UserHistoryTypeId INT,
- [Description] NVARCHAR(100)
-);
-GO
-CREATE TYPE dbo.UserPasswordValidationToken AS TABLE
-(
- userPasswordValidationTokenId INT,
- hashedToken NVARCHAR(128),
- salt NVARCHAR(128),
- [lookup] NVARCHAR(128),
- expiry DATETIMEOFFSET(7),
- tenantId INT,
- userId INT,
- createdUserId INT,
- createdDate DATETIMEOFFSET(7)
-);
-GO
-CREATE TYPE dbo.UserGroupTypeInputValidation AS TABLE
-(
- userGroupTypeInputValidationId INT,
- userGroupId INT,
- userGroupTypePrefix NVARCHAR(10),
- userGroupTypeId INT,
- validationTextValue NVARCHAR(1000),
- validationMethod INT,
- deleted BIT,
- amendUserId INT,
- amendDate DATETIMEOFFSET(7),
- createdUserId INT,
- createdDate DATETIMEOFFSET(7)
-);
-GO
-CREATE TYPE dbo.UserAttribute AS TABLE
-(
- userAttributeId INT,
- userId INT,
- attributeId INT,
- intValue INT,
- textValue NVARCHAR(255),
- booleanValue BIT,
- dateValue DATETIMEOFFSET(7),
- deleted BIT,
- amendUserId INT,
- amendDate DATETIMEOFFSET(7)
-);
-GO
-CREATE TYPE dbo.TermsAndConditions AS TABLE
-(
- termsAndConditionsId INT,
- createdDate DATETIMEOFFSET(7),
- description NVARCHAR(512),
- details ntext,
- tenantId INT,
- active BIT,
- reportable BIT,
- deleted BIT,
- amendUserID INT,
- amendDate DATETIMEOFFSET(7)
-);
-GO
-CREATE TYPE dbo.TenantUrl AS TABLE
-(
- tenantUrlId INT,
- tenantId INT,
- urlHostName NVARCHAR(128),
- useHostForAuth BIT,
- deleted BIT,
- amendUserID INT,
- amendDate DATETIMEOFFSET(7)
-);
-GO
-CREATE TYPE dbo.Tenant AS TABLE
-(
- tenantId INT,
- tenantCode NVARCHAR(100),
- tenantName NVARCHAR(250),
- tenantDescription NVARCHAR(1024),
- showFullCatalogInfoMessageInd BIT,
- catalogUrl NVARCHAR(500),
- quickStartGuideUrl NVARCHAR(1024),
- supportFormUrl NVARCHAR(500),
- liveChatStatus NVARCHAR(50),
- liveChatSnippet NVARCHAR(2048),
- myElearningDefaultView NVARCHAR(100),
- preLoginCatalogueDefaultView NVARCHAR(100),
- postLoginCatalogueDefaultView NVARCHAR(100),
- authSignInUrlRelative NVARCHAR(1024),
- authSignOutUrlRelative NVARCHAR(500),
- authSecret UNIQUEIDENTIFIER,
- deleted BIT,
- amendUserId INT,
- amendDate DATETIMEOFFSET(7)
-);
-GO
-CREATE TYPE dbo.TenantSmtp AS TABLE
-(
- tenantId INT,
- deliveryMethod NVARCHAR(128),
- pickupDirectoryLocation NVARCHAR(256),
- [from] NVARCHAR(256),
- userName NVARCHAR(256),
- [password] NVARCHAR(256),
- enableSsl BIT,
- host NVARCHAR(256),
- port INT,
- active BIT,
- deleted BIT,
- amendUserId INT,
- amendDate DATETIMEOFFSET(7)
-);
-GO
-CREATE TYPE dbo.SystemSetting AS TABLE
-(
- systemSettingId INT,
- systemSettingName NVARCHAR(50),
- intValue INT,
- textValue NVARCHAR(255),
- booleanValue BIT,
- dateValue DATETIMEOFFSET(7),
- deleted BIT,
- amendUserId INT,
- amendDate DATETIMEOFFSET(7)
-);
-GO
-CREATE TYPE dbo.LoginWizardStageActivity AS TABLE
-(
- loginWizardStageActivityId INT,
- loginWizardStageId INT,
- userId INT,
- activityDatetime DATETIMEOFFSET(7)
-);
-GO
-CREATE TYPE dbo.LoginWizardRule AS TABLE
-(
- loginWizardRuleId INT,
- loginWizardStageId INT,
- loginWizardRuleCategoryId INT,
- description NVARCHAR(128),
- reasonDisplayText NVARCHAR(1024),
- activationPeriod INT,
- required BIT,
- active BIT,
- deleted BIT,
- amendUserId INT,
- amendDate DATETIMEOFFSET(7)
-);
-GO
-CREATE TYPE dbo.LoginWizardStage AS TABLE
-(
- loginWizardStageId INT,
- description NVARCHAR(128),
- reasonDisplayText NVARCHAR(1024),
- deleted BIT,
- amendUserId INT,
- amendDate DATETIMEOFFSET(7)
-);
-GO
-CREATE TYPE dbo.IPCountryLookup AS TABLE
-(
- fromIP NVARCHAR(50),
- toIP NVARCHAR(50),
- country NVARCHAR(100),
- fromInt BIGINT,
- toInt BIGINT
-);
-GO
-CREATE TYPE dbo.EmailTemplateType AS TABLE
-(
- emailTemplateTypeId INT,
- emailTemplateTypeName NVARCHAR(250),
- availableTags NVARCHAR(MAX),
- deleted BIT,
- amendUserID INT,
- amendDate DATETIMEOFFSET(7)
-);
-GO
-CREATE TYPE dbo.Attribute AS TABLE
-(
- attributeId INT,
- attributeTypeId INT,
- attributeName NVARCHAR(250),
- attributeAccess NVARCHAR(100),
- attributeDescription NVARCHAR(500),
- deleted BIT,
- amendUserId INT,
- amendDate DATETIMEOFFSET(7)
-);
-GO
-CREATE TYPE dbo.AttributeType AS TABLE
-(
- attributeTypeId INT,
- attributeTypeName NVARCHAR(250),
- deleted BIT,
- amendUserId INT,
- amendDate DATETIMEOFFSET(7)
-);
-GO
-CREATE TYPE dbo.GDCRegister AS TABLE
-(
- reg_number NVARCHAR(50),
- Dentist bit,
- Title NVARCHAR(50),
- Surname NVARCHAR(200),
- Forenames NVARCHAR(200),
- honorifics NVARCHAR(200),
- house_name NVARCHAR(200),
- address_line1 NVARCHAR(200),
- address_line2 NVARCHAR(200),
- address_line3 NVARCHAR(200),
- address_line4 NVARCHAR(200),
- Town NVARCHAR(200),
- County NVARCHAR(200),
- PostCode NVARCHAR(50),
- Country NVARCHAR(100),
- regdate NVARCHAR(50),
- qualifications NVARCHAR(1000),
- dcp_titles NVARCHAR(500),
- specialties NVARCHAR(500),
- [condition] NVARCHAR(500),
- suspension NVARCHAR(500),
- dateProcessed DATETIMEOFFSET(7),
- action NVARCHAR(50)
-);
-GO
-
-CREATE TYPE dbo.GMCLRMP AS TABLE
-(
- GMC_Ref_No NVARCHAR(50),
- Surname NVARCHAR(200),
- Given_Name NVARCHAR(200),
- Year_Of_Qualification FLOAT,
- GP_Register_Date NVARCHAR(100),
- Registration_Status NVARCHAR(100),
- Other_Names NVARCHAR(200),
- dateProcessed DATETIME,
- action NVARCHAR(50)
-);
-GO
-CREATE TYPE dbo.Region AS TABLE
-(
- regionId INT,
- regionName NVARCHAR(250),
- displayOrder INT,
- deleted BIT,
- amendUserID INT,
- amendDate DATETIMEOFFSET(7)
-);
-GO
-CREATE TYPE dbo.UserEmployment AS TABLE
-(
- userEmploymentId INT,
- userId INT,
- jobRoleId INT,
- specialtyId INT,
- gradeId INT,
- schoolId INT,
- locationId INT,
- medicalCouncilId INT,
- medicalCouncilNo NVARCHAR(100),
- startDate DATETIMEOFFSET(7),
- endDate DATETIMEOFFSET(7),
- deleted BIT,
- archived BIT,
- amendUserId INT,
- amendDate DATETIMEOFFSET(7)
-);
-GO
-CREATE TYPE dbo.Location AS TABLE
-(
- locationId INT,
- locationCode NVARCHAR(50),
- locationName NVARCHAR(250),
- locationSubName NVARCHAR(250),
- locationTypeId INT,
- address1 NVARCHAR(250),
- address2 NVARCHAR(250),
- address3 NVARCHAR(250),
- address4 NVARCHAR(250),
- town NVARCHAR(250),
- county NVARCHAR(250),
- postCode NVARCHAR(50),
- telephone NVARCHAR(50),
- acute BIT,
- ambulance BIT,
- mental BIT,
- care BIT,
- mainHosp BIT,
- nhsCode NVARCHAR(50),
- parentId INT,
- dataSource NVARCHAR(250),
- active BIT,
- importExclusion BIT,
- depth INT,
- lineage NVARCHAR(MAX),
- created DATETIMEOFFSET(7),
- updated DATETIMEOFFSET(7),
- archivedDate DATETIMEOFFSET(7),
- countryId INT,
- iguId INT,
- letbId INT,
- ccgId INT,
- healthServiceId INT,
- healthBoardId INT,
- primaryTrustId INT,
- secondaryTrustId INT,
- islandId INT,
- otherNHSOrganisationId INT
-);
-GO
-CREATE TYPE dbo.LocationType AS TABLE
-(
- locationTypeID INT,
- locationType NVARCHAR(250),
- countryId INT,
- healthService NVARCHAR(250),
- healthBoard NVARCHAR(250),
- primaryTrust NVARCHAR(250),
- secondaryTrust NVARCHAR(250)
-);
-GO
-CREATE TYPE dbo.Country AS TABLE
-(
- countryId INT,
- countryName NVARCHAR(250),
- alpha2 NVARCHAR(10),
- alpha3 NVARCHAR(10),
- numeric NVARCHAR(10),
- EUVatRate DECIMAL(10,4),
- displayOrder INT,
- deleted BIT,
- amendUserId INT,
- amendDate DATETIMEOFFSET(7)
-);
-GO
-CREATE TYPE dbo.School AS TABLE
-(
- schoolId INT,
- deaneryId INT,
- specialtyId INT,
- schoolName NVARCHAR(250),
- displayOrder INT,
- deleted BIT,
- amendUserID INT,
- amendDate DATETIMEOFFSET(7)
-);
-GO
-CREATE TYPE dbo.Deanery AS TABLE
-(
- deaneryId INT,
- deaneryName NVARCHAR(250),
- displayOrder INT,
- deleted BIT,
- amendUserID INT,
- amendDate DATETIMEOFFSET(7)
-);
-GO
-CREATE TYPE dbo.Grade AS TABLE
-(
- gradeId INT,
- gradeName NVARCHAR(250),
- displayOrder INT,
- deleted BIT,
- amendUserID INT,
- amendDate DATETIMEOFFSET(7)
-);
-GO
-CREATE TYPE dbo.Specialty AS TABLE
-(
- specialtyId INT,
- specialtyName NVARCHAR(250),
- displayOrder INT,
- deleted BIT,
- amendUserID INT,
- amendDate DATETIMEOFFSET(7)
-);
-GO
-CREATE TYPE dbo.JobRole AS TABLE
-(
- jobRoleId INT,
- staffGroupId INT,
- jobRoleName NVARCHAR(250),
- medicalCouncilId INT,
- displayOrder INT,
- deleted BIT,
- amendUserID INT,
- amendDate DATETIMEOFFSET(7)
-);
-GO
-CREATE TYPE dbo.StaffGroup AS TABLE
-(
- staffGroupId INT,
- staffGroupName NVARCHAR(250),
- displayOrder INT,
- internalUsersOnly BIT,
- deleted BIT,
- amendUserID INT,
- amendDate DATETIMEOFFSET(7)
-);
-GO
-CREATE TYPE dbo.MedicalCouncil AS TABLE
-(
- medicalCouncilId int,
- medicalCouncilName nvarchar(50),
- medicalCouncilCode nvarchar(50),
- uploadPrefix nvarchar(3),
- includeOnCerts bit ,
- deleted bit,
- amendUserID int ,
- amendDate datetimeoffset(7)
-);
-GO
-CREATE TYPE [dbo].[UserGroupReporterType] AS TABLE
-(
- [userGroupReporterId] INT,
- [userId] INT,
- [userGroupId] INT,
- [deleted] BIT,
- [amendUserId] INT,
- [amendDate] DATETIMEOFFSET(7)
-);
-GO
-CREATE PROCEDURE [dbo].[AdfMergeattribute]
- @attributeList dbo.Attribute READONLY -- Table-valued parameter
-AS
-BEGIN
- SET NOCOUNT ON;
-
- SET IDENTITY_INSERT [elfh].[attributeTBL] ON;
-
- MERGE [elfh].[attributeTBL] AS target
- USING @attributeList AS source
- ON target.attributeId = source.attributeId
-
- WHEN MATCHED THEN
- UPDATE SET
- attributeTypeId = source.attributeTypeId,
- attributeName = source.attributeName,
- attributeAccess = source.attributeAccess,
- attributeDescription = source.attributeDescription,
- deleted = source.deleted,
- amendUserId = source.amendUserId,
- amendDate = source.amendDate
-
- WHEN NOT MATCHED THEN
- INSERT (
- attributeId,
- attributeTypeId,
- attributeName,
- attributeAccess,
- attributeDescription,
- deleted,
- amendUserId,
- amendDate
- )
- VALUES (
- source.attributeId,
- source.attributeTypeId,
- source.attributeName,
- source.attributeAccess,
- source.attributeDescription,
- source.deleted,
- source.amendUserId,
- source.amendDate
- );
-
- SET IDENTITY_INSERT [elfh].[attributeTBL] OFF;
-END
-GO
diff --git a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergeattributeType.sql b/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergeattributeType.sql
deleted file mode 100644
index 6b1930b57..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergeattributeType.sql
+++ /dev/null
@@ -1,45 +0,0 @@
--------------------------------------------------------------------------------
--- Author Sarathlal
--- Created 04-11-2025
--- Purpose ELFH-LH Data sync
---
--- Modification History
---
--- 04-11-2025 Sarathlal Initial Revision
--------------------------------------------------------------------------------
-CREATE PROCEDURE [dbo].[AdfMergeattributeType]
- @attributeTypeList dbo.AttributeType READONLY -- Table-valued parameter
-AS
-BEGIN
- SET NOCOUNT ON;
-
-
- MERGE [elfh].[attributeTypeTBL] AS target
- USING @attributeTypeList AS source
- ON target.attributeTypeId = source.attributeTypeId
-
- WHEN MATCHED THEN
- UPDATE SET
- attributeTypeName = source.attributeTypeName,
- deleted = source.deleted,
- amendUserId = source.amendUserId,
- amendDate = source.amendDate
-
- WHEN NOT MATCHED THEN
- INSERT (
- attributeTypeId,
- attributeTypeName,
- deleted,
- amendUserId,
- amendDate
- )
- VALUES (
- source.attributeTypeId,
- source.attributeTypeName,
- source.deleted,
- source.amendUserId,
- source.amendDate
- );
-
-END
-GO
diff --git a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergecountry.sql b/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergecountry.sql
deleted file mode 100644
index dbc50e13d..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergecountry.sql
+++ /dev/null
@@ -1,62 +0,0 @@
--------------------------------------------------------------------------------
--- Author Sarathlal
--- Created 04-11-2025
--- Purpose ELFH-LH Data sync
---
--- Modification History
---
--- 04-11-2025 Sarathlal Initial Revision
--------------------------------------------------------------------------------
-create PROCEDURE [dbo].[AdfMergecountry]
- @countryList dbo.Country READONLY -- Table-valued parameter type
-AS
-BEGIN
- SET NOCOUNT ON;
-
- SET IDENTITY_INSERT [elfh].[countryTBL] ON;
-
- MERGE [elfh].[countryTBL] AS target
- USING @countryList AS source
- ON target.countryId = source.countryId
-
- WHEN MATCHED THEN
- UPDATE SET
- countryName = source.countryName,
- alpha2 = source.alpha2,
- alpha3 = source.alpha3,
- numeric = source.numeric,
- EUVatRate = source.EUVatRate,
- displayOrder = source.displayOrder,
- deleted = source.deleted,
- amendUserId = source.amendUserId,
- amendDate = source.amendDate
-
- WHEN NOT MATCHED THEN
- INSERT (
- countryId,
- countryName,
- alpha2,
- alpha3,
- numeric,
- EUVatRate,
- displayOrder,
- deleted,
- amendUserId,
- amendDate
- )
- VALUES (
- source.countryId,
- source.countryName,
- source.alpha2,
- source.alpha3,
- source.numeric,
- source.EUVatRate,
- source.displayOrder,
- source.deleted,
- source.amendUserId,
- source.amendDate
- );
-
- SET IDENTITY_INSERT [elfh].[countryTBL] OFF;
-END
-GO
diff --git a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergedeanery.sql b/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergedeanery.sql
deleted file mode 100644
index 6121f1941..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergedeanery.sql
+++ /dev/null
@@ -1,47 +0,0 @@
--------------------------------------------------------------------------------
--- Author Sarathlal
--- Created 04-11-2025
--- Purpose ELFH-LH Data sync
---
--- Modification History
---
--- 04-11-2025 Sarathlal Initial Revision
--------------------------------------------------------------------------------
-CREATE PROCEDURE [dbo].[AdfMergedeanery]
- @deaneryList dbo.Deanery READONLY -- Table-valued parameter type
-AS
-BEGIN
- SET NOCOUNT ON;
- SET IDENTITY_INSERT [elfh].[deaneryTBL] ON;
- MERGE [elfh].[deaneryTBL] AS target
- USING @deaneryList AS source
- ON target.deaneryId = source.deaneryId
-
- WHEN MATCHED THEN
- UPDATE SET
- deaneryName = source.deaneryName,
- displayOrder = source.displayOrder,
- deleted = source.deleted,
- amendUserID = source.amendUserID,
- amendDate = source.amendDate
-
- WHEN NOT MATCHED THEN
- INSERT (
- deaneryId,
- deaneryName,
- displayOrder,
- deleted,
- amendUserID,
- amendDate
- )
- VALUES (
- source.deaneryId,
- source.deaneryName,
- source.displayOrder,
- source.deleted,
- source.amendUserID,
- source.amendDate
- );
- SET IDENTITY_INSERT [elfh].[deaneryTBL] OFF;
-END
-GO
diff --git a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergeemailTemplateType.sql b/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergeemailTemplateType.sql
deleted file mode 100644
index b59c16fbd..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergeemailTemplateType.sql
+++ /dev/null
@@ -1,47 +0,0 @@
--------------------------------------------------------------------------------
--- Author Sarathlal
--- Created 04-11-2025
--- Purpose ELFH-LH Data sync
---
--- Modification History
---
--- 04-11-2025 Sarathlal Initial Revision
--------------------------------------------------------------------------------
-CREATE PROCEDURE [dbo].[AdfMergeemailTemplateType]
- @emailTemplateTypeList dbo.EmailTemplateType READONLY -- Table-valued parameter
-AS
-BEGIN
- SET NOCOUNT ON;
-
- MERGE [elfh].[emailTemplateTypeTBL] AS target
- USING @emailTemplateTypeList AS source
- ON target.emailTemplateTypeId = source.emailTemplateTypeId
-
- WHEN MATCHED THEN
- UPDATE SET
- emailTemplateTypeName = source.emailTemplateTypeName,
- availableTags = source.availableTags,
- deleted = source.deleted,
- amendUserID = source.amendUserID,
- amendDate = source.amendDate
-
- WHEN NOT MATCHED THEN
- INSERT (
- emailTemplateTypeId,
- emailTemplateTypeName,
- availableTags,
- deleted,
- amendUserID,
- amendDate
- )
- VALUES (
- source.emailTemplateTypeId,
- source.emailTemplateTypeName,
- source.availableTags,
- source.deleted,
- source.amendUserID,
- source.amendDate
- );
-
-END
-GO
diff --git a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergegdcRegister.sql b/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergegdcRegister.sql
deleted file mode 100644
index e0878089a..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergegdcRegister.sql
+++ /dev/null
@@ -1,98 +0,0 @@
--------------------------------------------------------------------------------
--- Author Sarathlal
--- Created 04-11-2025
--- Purpose ELFH-LH Data sync
---
--- Modification History
---
--- 04-11-2025 Sarathlal Initial Revision
--------------------------------------------------------------------------------
-CREATE PROCEDURE [dbo].[AdfMergegdcRegister]
- @gdcRegisterList dbo.GDCRegister READONLY -- Table-valued parameter
-AS
-BEGIN
- SET NOCOUNT ON;
-
- MERGE [ELFH].[gdcRegisterTBL] AS target
- USING @gdcRegisterList AS source
- ON target.reg_number = source.reg_number
-
- WHEN MATCHED THEN
- UPDATE SET
- Dentist = source.Dentist,
- Title = source.Title,
- Surname = source.Surname,
- Forenames = source.Forenames,
- honorifics = source.honorifics,
- house_name = source.house_name,
- address_line1 = source.address_line1,
- address_line2 = source.address_line2,
- address_line3 = source.address_line3,
- address_line4 = source.address_line4,
- Town = source.Town,
- County = source.County,
- PostCode = source.PostCode,
- Country = source.Country,
- regdate = source.regdate,
- qualifications = source.qualifications,
- dcp_titles = source.dcp_titles,
- specialties = source.specialties,
- [condition] = source.[condition],
- suspension = source.suspension,
- dateProcessed = source.dateProcessed,
- action = source.action
-
- WHEN NOT MATCHED THEN
- INSERT (
- reg_number,
- Dentist,
- Title,
- Surname,
- Forenames,
- honorifics,
- house_name,
- address_line1,
- address_line2,
- address_line3,
- address_line4,
- Town,
- County,
- PostCode,
- Country,
- regdate,
- qualifications,
- dcp_titles,
- specialties,
- [condition],
- suspension,
- dateProcessed,
- action
- )
- VALUES (
- source.reg_number,
- source.Dentist,
- source.Title,
- source.Surname,
- source.Forenames,
- source.honorifics,
- source.house_name,
- source.address_line1,
- source.address_line2,
- source.address_line3,
- source.address_line4,
- source.Town,
- source.County,
- source.PostCode,
- source.Country,
- source.regdate,
- source.qualifications,
- source.dcp_titles,
- source.specialties,
- source.[condition],
- source.suspension,
- source.dateProcessed,
- source.action
- );
-
-END
-GO
diff --git a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergegmclrmp.sql b/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergegmclrmp.sql
deleted file mode 100644
index 4f94ad397..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergegmclrmp.sql
+++ /dev/null
@@ -1,56 +0,0 @@
--------------------------------------------------------------------------------
--- Author Sarathlal
--- Created 04-11-2025
--- Purpose ELFH-LH Data sync
---
--- Modification History
---
--- 04-11-2025 Sarathlal Initial Revision
--------------------------------------------------------------------------------
-CREATE PROCEDURE [dbo].[AdfMergegmclrmp]
- @gmclrmpList dbo.GMCLRMP READONLY -- Table-valued parameter type
-AS
-BEGIN
- SET NOCOUNT ON;
-
- MERGE [elfh].[gmclrmpTBL] AS target
- USING @gmclrmpList AS source
- ON target.GMC_Ref_No = source.GMC_Ref_No
-
- WHEN MATCHED THEN
- UPDATE SET
- Surname = source.Surname,
- Given_Name = source.Given_Name,
- Year_Of_Qualification = source.Year_Of_Qualification,
- GP_Register_Date = source.GP_Register_Date,
- Registration_Status = source.Registration_Status,
- Other_Names = source.Other_Names,
- dateProcessed = source.dateProcessed,
- action = source.action
-
- WHEN NOT MATCHED THEN
- INSERT (
- GMC_Ref_No,
- Surname,
- Given_Name,
- Year_Of_Qualification,
- GP_Register_Date,
- Registration_Status,
- Other_Names,
- dateProcessed,
- action
- )
- VALUES (
- source.GMC_Ref_No,
- source.Surname,
- source.Given_Name,
- source.Year_Of_Qualification,
- source.GP_Register_Date,
- source.Registration_Status,
- source.Other_Names,
- source.dateProcessed,
- source.action
- );
-
-END
-GO
diff --git a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergegrade.sql b/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergegrade.sql
deleted file mode 100644
index 8994639d9..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergegrade.sql
+++ /dev/null
@@ -1,47 +0,0 @@
--------------------------------------------------------------------------------
--- Author Sarathlal
--- Created 04-11-2025
--- Purpose ELFH-LH Data sync
---
--- Modification History
---
--- 04-11-2025 Sarathlal Initial Revision
--------------------------------------------------------------------------------
-CREATE PROCEDURE [dbo].[AdfMergegrade]
- @gradeList dbo.Grade READONLY -- Table-valued parameter type
-AS
-BEGIN
- SET NOCOUNT ON;
- SET IDENTITY_INSERT [elfh].[gradeTBL] ON;
- MERGE [elfh].[gradeTBL] AS target
- USING @gradeList AS source
- ON target.gradeId = source.gradeId
-
- WHEN MATCHED THEN
- UPDATE SET
- gradeName = source.gradeName
- , displayOrder = source.displayOrder
- , deleted = source.deleted
- , amendUserID = source.amendUserID
- , amendDate = source.amendDate
-
- WHEN NOT MATCHED THEN
- INSERT (
- gradeId
- , gradeName
- , displayOrder
- , deleted
- , amendUserID
- , amendDate
- )
- VALUES (
- source.gradeId
- , source.gradeName
- , source.displayOrder
- , source.deleted
- , source.amendUserID
- , source.amendDate
- );
- SET IDENTITY_INSERT [elfh].[gradeTBL] OFF;
-END
-GO
diff --git a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergeipCountryLookup.sql b/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergeipCountryLookup.sql
deleted file mode 100644
index bc982a2a8..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergeipCountryLookup.sql
+++ /dev/null
@@ -1,43 +0,0 @@
--------------------------------------------------------------------------------
--- Author Sarathlal
--- Created 04-11-2025
--- Purpose ELFH-LH Data sync
---
--- Modification History
---
--- 04-11-2025 Sarathlal Initial Revision
--------------------------------------------------------------------------------
-CREATE PROCEDURE [dbo].[AdfMergeipCountryLookup]
- @ipCountryLookupList dbo.IPCountryLookup READONLY -- Table-valued parameter
-AS
-BEGIN
- SET NOCOUNT ON;
-
- MERGE [elfh].[ipCountryLookupTBL] AS target
- USING @ipCountryLookupList AS source
- ON target.fromInt = source.fromInt AND target.toInt = source.toInt
-
- WHEN MATCHED THEN
- UPDATE SET
- fromIP = source.fromIP,
- toIP = source.toIP,
- country = source.country
-
- WHEN NOT MATCHED THEN
- INSERT (
- fromIP,
- toIP,
- country,
- fromInt,
- toInt
- )
- VALUES (
- source.fromIP,
- source.toIP,
- source.country,
- source.fromInt,
- source.toInt
- );
-
-END
-GO
diff --git a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergejobRole.sql b/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergejobRole.sql
deleted file mode 100644
index 8b36bf4e6..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergejobRole.sql
+++ /dev/null
@@ -1,53 +0,0 @@
--------------------------------------------------------------------------------
--- Author Sarathlal
--- Created 04-11-2025
--- Purpose ELFH-LH Data sync
---
--- Modification History
---
--- 04-11-2025 Sarathlal Initial Revision
--------------------------------------------------------------------------------
-CREATE PROCEDURE [dbo].[AdfMergejobRole]
- @jobRoleList dbo.JobRole READONLY -- table-valued parameter type
-AS
-BEGIN
- SET NOCOUNT ON;
- SET IDENTITY_INSERT [elfh].[jobRoleTBL] ON;
- MERGE [elfh].[jobRoleTBL] AS target
- USING @jobRoleList AS source
- ON target.jobRoleId = source.jobRoleId
-
- WHEN MATCHED THEN
- UPDATE SET
- staffGroupId = source.staffGroupId
- , jobRoleName = source.jobRoleName
- , medicalCouncilId = source.medicalCouncilId
- , displayOrder = source.displayOrder
- , deleted = source.deleted
- , amendUserID = source.amendUserID
- , amendDate = source.amendDate
-
- WHEN NOT MATCHED THEN
- INSERT (
- jobRoleId
- , staffGroupId
- , jobRoleName
- , medicalCouncilId
- , displayOrder
- , deleted
- , amendUserID
- , amendDate
- )
- VALUES (
- source.jobRoleId
- , source.staffGroupId
- , source.jobRoleName
- , source.medicalCouncilId
- , source.displayOrder
- , source.deleted
- , source.amendUserID
- , source.amendDate
- );
- SET IDENTITY_INSERT [elfh].[jobRoleTBL] OFF;
-END
-GO
diff --git a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergelocation.sql b/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergelocation.sql
deleted file mode 100644
index dda113cd5..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergelocation.sql
+++ /dev/null
@@ -1,142 +0,0 @@
--------------------------------------------------------------------------------
--- Author Sarathlal
--- Created 04-11-2025
--- Purpose ELFH-LH Data sync
---
--- Modification History
---
--- 04-11-2025 Sarathlal Initial Revision
--------------------------------------------------------------------------------
-CREATE PROCEDURE [dbo].[AdfMergelocation]
- @locationList dbo.Location READONLY -- Table-valued parameter type
-AS
-BEGIN
- SET NOCOUNT ON;
- MERGE [elfh].[locationTBL] AS target
- USING @locationList AS source
- ON target.locationId = source.locationId
-
- WHEN MATCHED THEN
- UPDATE SET
- locationCode = source.locationCode,
- locationName = source.locationName,
- locationSubName = source.locationSubName,
- locationTypeId = source.locationTypeId,
- address1 = source.address1,
- address2 = source.address2,
- address3 = source.address3,
- address4 = source.address4,
- town = source.town,
- county = source.county,
- postCode = source.postCode,
- telephone = source.telephone,
- acute = source.acute,
- ambulance = source.ambulance,
- mental = source.mental,
- care = source.care,
- mainHosp = source.mainHosp,
- nhsCode = source.nhsCode,
- parentId = source.parentId,
- dataSource = source.dataSource,
- active = source.active,
- importExclusion = source.importExclusion,
- depth = source.depth,
- lineage = source.lineage,
- created = source.created,
- updated = source.updated,
- archivedDate = source.archivedDate,
- countryId = source.countryId,
- iguId = source.iguId,
- letbId = source.letbId,
- ccgId = source.ccgId,
- healthServiceId = source.healthServiceId,
- healthBoardId = source.healthBoardId,
- primaryTrustId = source.primaryTrustId,
- secondaryTrustId = source.secondaryTrustId,
- islandId = source.islandId,
- otherNHSOrganisationId = source.otherNHSOrganisationId
-
- WHEN NOT MATCHED THEN
- INSERT (
- locationId,
- locationCode,
- locationName,
- locationSubName,
- locationTypeId,
- address1,
- address2,
- address3,
- address4,
- town,
- county,
- postCode,
- telephone,
- acute,
- ambulance,
- mental,
- care,
- mainHosp,
- nhsCode,
- parentId,
- dataSource,
- active,
- importExclusion,
- depth,
- lineage,
- created,
- updated,
- archivedDate,
- countryId,
- iguId,
- letbId,
- ccgId,
- healthServiceId,
- healthBoardId,
- primaryTrustId,
- secondaryTrustId,
- islandId,
- otherNHSOrganisationId
- )
- VALUES (
- source.locationId,
- source.locationCode,
- source.locationName,
- source.locationSubName,
- source.locationTypeId,
- source.address1,
- source.address2,
- source.address3,
- source.address4,
- source.town,
- source.county,
- source.postCode,
- source.telephone,
- source.acute,
- source.ambulance,
- source.mental,
- source.care,
- source.mainHosp,
- source.nhsCode,
- source.parentId,
- source.dataSource,
- source.active,
- source.importExclusion,
- source.depth,
- source.lineage,
- source.created,
- source.updated,
- source.archivedDate,
- source.countryId,
- source.iguId,
- source.letbId,
- source.ccgId,
- source.healthServiceId,
- source.healthBoardId,
- source.primaryTrustId,
- source.secondaryTrustId,
- source.islandId,
- source.otherNHSOrganisationId
- );
-
-END
-GO
diff --git a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergelocationType.sql b/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergelocationType.sql
deleted file mode 100644
index df660e586..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergelocationType.sql
+++ /dev/null
@@ -1,55 +0,0 @@
--------------------------------------------------------------------------------
--- Author Sarathlal
--- Created 04-11-2025
--- Purpose ELFH-LH Data sync
---
--- Modification History
---
--- 04-11-2025 Sarathlal Initial Revision
--------------------------------------------------------------------------------
-CREATE PROCEDURE [dbo].[AdfMergelocationType]
- @locationTypeList dbo.LocationType READONLY -- Table-valued parameter type
-AS
-BEGIN
- SET NOCOUNT ON;
-
- -- Enable explicit identity insert (if locationTypeID is an IDENTITY column)
- SET IDENTITY_INSERT [elfh].[locationTypeTBL] ON;
-
- MERGE [elfh].[locationTypeTBL] AS target
- USING @locationTypeList AS source
- ON target.locationTypeID = source.locationTypeID
-
- WHEN MATCHED THEN
- UPDATE SET
- locationType = source.locationType,
- countryId = source.countryId,
- healthService = source.healthService,
- healthBoard = source.healthBoard,
- primaryTrust = source.primaryTrust,
- secondaryTrust = source.secondaryTrust
-
- WHEN NOT MATCHED THEN
- INSERT (
- locationTypeID,
- locationType,
- countryId,
- healthService,
- healthBoard,
- primaryTrust,
- secondaryTrust
- )
- VALUES (
- source.locationTypeID,
- source.locationType,
- source.countryId,
- source.healthService,
- source.healthBoard,
- source.primaryTrust,
- source.secondaryTrust
- );
-
- -- Disable identity insert after operation
- SET IDENTITY_INSERT [elfh].[locationTypeTBL] OFF;
-END
-GO
diff --git a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergeloginWizardRule.sql b/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergeloginWizardRule.sql
deleted file mode 100644
index 53a4b8d44..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergeloginWizardRule.sql
+++ /dev/null
@@ -1,60 +0,0 @@
--------------------------------------------------------------------------------
--- Author Sarathlal
--- Created 04-11-2025
--- Purpose ELFH-LH Data sync
---
--- Modification History
---
--- 04-11-2025 Sarathlal Initial Revision
--------------------------------------------------------------------------------
-CREATE PROCEDURE [dbo].[AdfMergeloginWizardRule]
- @loginWizardRuleList dbo.LoginWizardRule READONLY -- Table-valued parameter
-AS
-BEGIN
- SET NOCOUNT ON;
- MERGE [elfh].[loginWizardRuleTBL] AS target
- USING @loginWizardRuleList AS source
- ON target.loginWizardRuleId = source.loginWizardRuleId
-
- WHEN MATCHED THEN
- UPDATE SET
- loginWizardStageId = source.loginWizardStageId,
- loginWizardRuleCategoryId = source.loginWizardRuleCategoryId,
- description = source.description,
- reasonDisplayText = source.reasonDisplayText,
- activationPeriod = source.activationPeriod,
- required = source.required,
- active = source.active,
- deleted = source.deleted,
- amendUserId = source.amendUserId,
- amendDate = source.amendDate
-
- WHEN NOT MATCHED THEN
- INSERT (
- loginWizardRuleId,
- loginWizardStageId,
- loginWizardRuleCategoryId,
- description,
- reasonDisplayText,
- activationPeriod,
- required,
- active,
- deleted,
- amendUserId,
- amendDate
- )
- VALUES (
- source.loginWizardRuleId,
- source.loginWizardStageId,
- source.loginWizardRuleCategoryId,
- source.description,
- source.reasonDisplayText,
- source.activationPeriod,
- source.required,
- source.active,
- source.deleted,
- source.amendUserId,
- source.amendDate
- );
-END
-GO
diff --git a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergeloginWizardStage.sql b/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergeloginWizardStage.sql
deleted file mode 100644
index bcf50762b..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergeloginWizardStage.sql
+++ /dev/null
@@ -1,46 +0,0 @@
--------------------------------------------------------------------------------
--- Author Sarathlal
--- Created 04-11-2025
--- Purpose ELFH-LH Data sync
---
--- Modification History
---
--- 04-11-2025 Sarathlal Initial Revision
--------------------------------------------------------------------------------
-CREATE PROCEDURE [dbo].[AdfMergeloginWizardStage]
- @loginWizardStageList dbo.LoginWizardStage READONLY -- Table-valued parameter
-AS
-BEGIN
- SET NOCOUNT ON;
- MERGE [elfh].[loginWizardStageTBL] AS target
- USING @loginWizardStageList AS source
- ON target.loginWizardStageId = source.loginWizardStageId
-
- WHEN MATCHED THEN
- UPDATE SET
- description = source.description,
- reasonDisplayText = source.reasonDisplayText,
- deleted = source.deleted,
- amendUserId = source.amendUserId,
- amendDate = source.amendDate
-
- WHEN NOT MATCHED THEN
- INSERT (
- loginWizardStageId,
- description,
- reasonDisplayText,
- deleted,
- amendUserId,
- amendDate
- )
- VALUES (
- source.loginWizardStageId,
- source.description,
- source.reasonDisplayText,
- source.deleted,
- source.amendUserId,
- source.amendDate
- );
-
-END
-GO
diff --git a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergeloginWizardStageActivity.sql b/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergeloginWizardStageActivity.sql
deleted file mode 100644
index ad1d56d86..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergeloginWizardStageActivity.sql
+++ /dev/null
@@ -1,43 +0,0 @@
--------------------------------------------------------------------------------
--- Author Sarathlal
--- Created 04-11-2025
--- Purpose ELFH-LH Data sync
---
--- Modification History
---
--- 04-11-2025 Sarathlal Initial Revision
--------------------------------------------------------------------------------
-CREATE PROCEDURE [dbo].[AdfMergeloginWizardStageActivity]
- @loginWizardStageActivityList dbo.LoginWizardStageActivity READONLY -- Table-valued parameter
-AS
-BEGIN
- SET NOCOUNT ON;
-
- SET IDENTITY_INSERT [elfh].[loginWizardStageActivityTBL] ON;
- MERGE [elfh].[loginWizardStageActivityTBL] AS target
- USING @loginWizardStageActivityList AS source
- ON target.loginWizardStageActivityId = source.loginWizardStageActivityId
-
- WHEN MATCHED THEN
- UPDATE SET
- loginWizardStageId = source.loginWizardStageId,
- userId = source.userId,
- activityDatetime = source.activityDatetime
-
- WHEN NOT MATCHED THEN
- INSERT (
- loginWizardStageActivityId,
- loginWizardStageId,
- userId,
- activityDatetime
- )
- VALUES (
- source.loginWizardStageActivityId,
- source.loginWizardStageId,
- source.userId,
- source.activityDatetime
- );
-
- SET IDENTITY_INSERT [elfh].[loginWizardStageActivityTBL] OFF;
-END
-GO
diff --git a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergemedicalCouncil.sql b/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergemedicalCouncil.sql
deleted file mode 100644
index 4f2575378..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergemedicalCouncil.sql
+++ /dev/null
@@ -1,50 +0,0 @@
--------------------------------------------------------------------------------
--- Author Sarathlal
--- Created 04-11-2025
--- Purpose ELFH-LH Data sync
---
--- Modification History
---
--- 04-11-2025 Sarathlal Initial Revision
--------------------------------------------------------------------------------
-CREATE PROCEDURE [dbo].[AdfMergemedicalCouncil]
- @medicalCouncilList dbo.MedicalCouncil READONLY
-AS
-BEGIN
- SET NOCOUNT ON;
- MERGE [elfh].[medicalCouncilTBL] AS target
- USING @medicalCouncilList AS source
- ON target.medicalCouncilId = source.medicalCouncilId
- WHEN MATCHED THEN
- UPDATE SET
- medicalCouncilName = source.medicalCouncilName
- ,medicalCouncilCode = source.medicalCouncilCode
- ,uploadPrefix = source.uploadPrefix
- ,includeOnCerts = source.includeOnCerts
- ,deleted = source.deleted
- ,amendUserID = source.amendUserID
- ,amendDate = source.amendDate
-
- WHEN NOT MATCHED THEN
- INSERT (
- medicalCouncilId
- ,medicalCouncilName
- ,medicalCouncilCode
- ,uploadPrefix
- ,includeOnCerts
- ,deleted
- ,amendUserID
- ,amendDate
- )
- VALUES (
- source.medicalCouncilId
- ,source.medicalCouncilName
- ,source.medicalCouncilCode
- ,source.uploadPrefix
- ,source.includeOnCerts
- ,source.deleted
- ,source.amendUserID
- ,source.amendDate
- );
-END
-GO
\ No newline at end of file
diff --git a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergeregion.sql b/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergeregion.sql
deleted file mode 100644
index 589f42112..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergeregion.sql
+++ /dev/null
@@ -1,47 +0,0 @@
--------------------------------------------------------------------------------
--- Author Sarathlal
--- Created 04-11-2025
--- Purpose ELFH-LH Data sync
---
--- Modification History
---
--- 04-11-2025 Sarathlal Initial Revision
--------------------------------------------------------------------------------
-CREATE PROCEDURE [dbo].[AdfMergeregion]
- @regionList dbo.Region READONLY -- Table-valued parameter type
-AS
-BEGIN
- SET NOCOUNT ON;
-
- MERGE [elfh].[regionTBL] AS target
- USING @regionList AS source
- ON target.regionId = source.regionId
-
- WHEN MATCHED THEN
- UPDATE SET
- regionName = source.regionName,
- displayOrder = source.displayOrder,
- deleted = source.deleted,
- amendUserID = source.amendUserID,
- amendDate = source.amendDate
-
- WHEN NOT MATCHED THEN
- INSERT (
- regionId,
- regionName,
- displayOrder,
- deleted,
- amendUserID,
- amendDate
- )
- VALUES (
- source.regionId,
- source.regionName,
- source.displayOrder,
- source.deleted,
- source.amendUserID,
- source.amendDate
- );
-
-END
-GO
diff --git a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergeschool.sql b/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergeschool.sql
deleted file mode 100644
index 3e6cd502f..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergeschool.sql
+++ /dev/null
@@ -1,53 +0,0 @@
--------------------------------------------------------------------------------
--- Author Sarathlal
--- Created 04-11-2025
--- Purpose ELFH-LH Data sync
---
--- Modification History
---
--- 04-11-2025 Sarathlal Initial Revision
--------------------------------------------------------------------------------
-CREATE PROCEDURE [dbo].[AdfMergeschool]
- @schoolList dbo.School READONLY -- Table-valued parameter type
-AS
-BEGIN
- SET NOCOUNT ON;
- SET IDENTITY_INSERT [elfh].[schoolTBL] ON;
- MERGE [elfh].[schoolTBL] AS target
- USING @schoolList AS source
- ON target.schoolId = source.schoolId
-
- WHEN MATCHED THEN
- UPDATE SET
- deaneryId = source.deaneryId,
- specialtyId = source.specialtyId,
- schoolName = source.schoolName,
- displayOrder = source.displayOrder,
- deleted = source.deleted,
- amendUserID = source.amendUserID,
- amendDate = source.amendDate
-
- WHEN NOT MATCHED THEN
- INSERT (
- schoolId,
- deaneryId,
- specialtyId,
- schoolName,
- displayOrder,
- deleted,
- amendUserID,
- amendDate
- )
- VALUES (
- source.schoolId,
- source.deaneryId,
- source.specialtyId,
- source.schoolName,
- source.displayOrder,
- source.deleted,
- source.amendUserID,
- source.amendDate
- );
- SET IDENTITY_INSERT [elfh].[schoolTBL] OFF;
-END
-GO
diff --git a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergespecialty.sql b/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergespecialty.sql
deleted file mode 100644
index 533476cdc..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergespecialty.sql
+++ /dev/null
@@ -1,47 +0,0 @@
--------------------------------------------------------------------------------
--- Author Sarathlal
--- Created 04-11-2025
--- Purpose ELFH-LH Data sync
---
--- Modification History
---
--- 04-11-2025 Sarathlal Initial Revision
--------------------------------------------------------------------------------
-CREATE PROCEDURE [dbo].[AdfMergespecialty]
- @specialtyList dbo.Specialty READONLY -- Table-valued parameter type
-AS
-BEGIN
- SET NOCOUNT ON;
- SET IDENTITY_INSERT [elfh].[specialtyTBL] ON;
- MERGE [elfh].[specialtyTBL] AS target
- USING @specialtyList AS source
- ON target.specialtyId = source.specialtyId
-
- WHEN MATCHED THEN
- UPDATE SET
- specialtyName = source.specialtyName
- , displayOrder = source.displayOrder
- , deleted = source.deleted
- , amendUserID = source.amendUserID
- , amendDate = source.amendDate
-
- WHEN NOT MATCHED THEN
- INSERT (
- specialtyId
- , specialtyName
- , displayOrder
- , deleted
- , amendUserID
- , amendDate
- )
- VALUES (
- source.specialtyId
- , source.specialtyName
- , source.displayOrder
- , source.deleted
- , source.amendUserID
- , source.amendDate
- );
- SET IDENTITY_INSERT [elfh].[specialtyTBL] OFF;
-END
-GO
diff --git a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergestaffGroup.sql b/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergestaffGroup.sql
deleted file mode 100644
index d40f91c31..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergestaffGroup.sql
+++ /dev/null
@@ -1,50 +0,0 @@
--------------------------------------------------------------------------------
--- Author Sarathlal
--- Created 04-11-2025
--- Purpose ELFH-LH Data sync
---
--- Modification History
---
--- 04-11-2025 Sarathlal Initial Revision
--------------------------------------------------------------------------------
-CREATE PROCEDURE [dbo].[AdfMergestaffGroup]
- @staffGroupList dbo.StaffGroup READONLY -- your table type must exist
-AS
-BEGIN
- SET NOCOUNT ON;
- SET IDENTITY_INSERT [elfh].[staffGroupTBL] ON;
- MERGE [elfh].[staffGroupTBL] AS target
- USING @staffGroupList AS source
- ON target.staffGroupId = source.staffGroupId
-
- WHEN MATCHED THEN
- UPDATE SET
- staffGroupName = source.staffGroupName
- , displayOrder = source.displayOrder
- , internalUsersOnly = source.internalUsersOnly
- , deleted = source.deleted
- , amendUserID = source.amendUserID
- , amendDate = source.amendDate
-
- WHEN NOT MATCHED THEN
- INSERT (
- staffGroupId
- , staffGroupName
- , displayOrder
- , internalUsersOnly
- , deleted
- , amendUserID
- , amendDate
- )
- VALUES (
- source.staffGroupId
- , source.staffGroupName
- , source.displayOrder
- , source.internalUsersOnly
- , source.deleted
- , source.amendUserID
- , source.amendDate
- );
- SET IDENTITY_INSERT [elfh].[staffGroupTBL] OFF;
-END
-GO
diff --git a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergesystemSetting.sql b/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergesystemSetting.sql
deleted file mode 100644
index 580e839fd..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergesystemSetting.sql
+++ /dev/null
@@ -1,56 +0,0 @@
--------------------------------------------------------------------------------
--- Author Sarathlal
--- Created 04-11-2025
--- Purpose ELFH-LH Data sync
---
--- Modification History
---
--- 04-11-2025 Sarathlal Initial Revision
--------------------------------------------------------------------------------
-CREATE PROCEDURE [dbo].[AdfMergesystemSetting]
- @systemSettingList dbo.SystemSetting READONLY -- Table-valued parameter
-AS
-BEGIN
- SET NOCOUNT ON;
-
- MERGE [ELFH].[systemSettingTBL] AS target
- USING @systemSettingList AS source
- ON target.systemSettingId = source.systemSettingId
-
- WHEN MATCHED THEN
- UPDATE SET
- systemSettingName = source.systemSettingName,
- intValue = source.intValue,
- textValue = source.textValue,
- booleanValue = source.booleanValue,
- dateValue = source.dateValue,
- deleted = source.deleted,
- amendUserId = source.amendUserId,
- amendDate = source.amendDate
-
- WHEN NOT MATCHED THEN
- INSERT (
- systemSettingId,
- systemSettingName,
- intValue,
- textValue,
- booleanValue,
- dateValue,
- deleted,
- amendUserId,
- amendDate
- )
- VALUES (
- source.systemSettingId,
- source.systemSettingName,
- source.intValue,
- source.textValue,
- source.booleanValue,
- source.dateValue,
- source.deleted,
- source.amendUserId,
- source.amendDate
- );
-
-END
-GO
diff --git a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergetenantSmtp.sql b/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergetenantSmtp.sql
deleted file mode 100644
index f6f44bc0e..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergetenantSmtp.sql
+++ /dev/null
@@ -1,68 +0,0 @@
--------------------------------------------------------------------------------
--- Author Sarathlal
--- Created 04-11-2025
--- Purpose ELFH-LH Data sync
---
--- Modification History
---
--- 04-11-2025 Sarathlal Initial Revision
--------------------------------------------------------------------------------
-CREATE PROCEDURE [dbo].[AdfMergetenantSmtp]
- @tenantSmtpList dbo.TenantSmtp READONLY -- Table-valued parameter
-AS
-BEGIN
- SET NOCOUNT ON;
-
- MERGE [elfh].[tenantSmtpTBL] AS target
- USING @tenantSmtpList AS source
- ON target.tenantId = source.tenantId
-
- WHEN MATCHED THEN
- UPDATE SET
- deliveryMethod = source.deliveryMethod,
- pickupDirectoryLocation = source.pickupDirectoryLocation,
- [from] = source.[from],
- userName = source.userName,
- [password] = source.[password],
- enableSsl = source.enableSsl,
- host = source.host,
- port = source.port,
- active = source.active,
- deleted = source.deleted,
- amendUserId = source.amendUserId,
- amendDate = source.amendDate
-
- WHEN NOT MATCHED THEN
- INSERT (
- tenantId,
- deliveryMethod,
- pickupDirectoryLocation,
- [from],
- userName,
- [password],
- enableSsl,
- host,
- port,
- active,
- deleted,
- amendUserId,
- amendDate
- )
- VALUES (
- source.tenantId,
- source.deliveryMethod,
- source.pickupDirectoryLocation,
- source.[from],
- source.userName,
- source.[password],
- source.enableSsl,
- source.host,
- source.port,
- source.active,
- source.deleted,
- source.amendUserId,
- source.amendDate
- );
-
-END
-GO
diff --git a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergetenants.sql b/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergetenants.sql
deleted file mode 100644
index 4dc91fb59..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergetenants.sql
+++ /dev/null
@@ -1,86 +0,0 @@
--------------------------------------------------------------------------------
--- Author Sarathlal
--- Created 04-11-2025
--- Purpose ELFH-LH Data sync
---
--- Modification History
---
--- 04-11-2025 Sarathlal Initial Revision
--------------------------------------------------------------------------------
-CREATE PROCEDURE [dbo].[AdfMergetenants]
- @tenantList dbo.Tenant READONLY -- Table-valued parameter
-AS
-BEGIN
- SET NOCOUNT ON;
-
- MERGE [elfh].[tenantTBL] AS target
- USING @tenantList AS source
- ON target.tenantId = source.tenantId
-
- WHEN MATCHED THEN
- UPDATE SET
- tenantCode = source.tenantCode,
- tenantName = source.tenantName,
- tenantDescription = source.tenantDescription,
- showFullCatalogInfoMessageInd = source.showFullCatalogInfoMessageInd,
- catalogUrl = source.catalogUrl,
- quickStartGuideUrl = source.quickStartGuideUrl,
- supportFormUrl = source.supportFormUrl,
- liveChatStatus = source.liveChatStatus,
- liveChatSnippet = source.liveChatSnippet,
- myElearningDefaultView = source.myElearningDefaultView,
- preLoginCatalogueDefaultView = source.preLoginCatalogueDefaultView,
- postLoginCatalogueDefaultView = source.postLoginCatalogueDefaultView,
- authSignInUrlRelative = source.authSignInUrlRelative,
- authSignOutUrlRelative = source.authSignOutUrlRelative,
- authSecret = source.authSecret,
- deleted = source.deleted,
- amendUserId = source.amendUserId,
- amendDate = source.amendDate
-
- WHEN NOT MATCHED THEN
- INSERT (
- tenantId,
- tenantCode,
- tenantName,
- tenantDescription,
- showFullCatalogInfoMessageInd,
- catalogUrl,
- quickStartGuideUrl,
- supportFormUrl,
- liveChatStatus,
- liveChatSnippet,
- myElearningDefaultView,
- preLoginCatalogueDefaultView,
- postLoginCatalogueDefaultView,
- authSignInUrlRelative,
- authSignOutUrlRelative,
- authSecret,
- deleted,
- amendUserId,
- amendDate
- )
- VALUES (
- source.tenantId,
- source.tenantCode,
- source.tenantName,
- source.tenantDescription,
- source.showFullCatalogInfoMessageInd,
- source.catalogUrl,
- source.quickStartGuideUrl,
- source.supportFormUrl,
- source.liveChatStatus,
- source.liveChatSnippet,
- source.myElearningDefaultView,
- source.preLoginCatalogueDefaultView,
- source.postLoginCatalogueDefaultView,
- source.authSignInUrlRelative,
- source.authSignOutUrlRelative,
- source.authSecret,
- source.deleted,
- source.amendUserId,
- source.amendDate
- );
-
-END
-GO
diff --git a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergetenantsUrl.sql b/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergetenantsUrl.sql
deleted file mode 100644
index 83408a426..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergetenantsUrl.sql
+++ /dev/null
@@ -1,55 +0,0 @@
--------------------------------------------------------------------------------
--- Author Sarathlal
--- Created 04-11-2025
--- Purpose ELFH-LH Data sync
---
--- Modification History
---
--- 04-11-2025 Sarathlal Initial Revision
--------------------------------------------------------------------------------
-CREATE PROCEDURE [dbo].[AdfMergetenantsUrl]
- @tenantUrlList dbo.TenantUrl READONLY -- Table-valued parameter
-AS
-BEGIN
- SET NOCOUNT ON;
-
- -- Enable identity insert if tenantUrlId is an IDENTITY column
- SET IDENTITY_INSERT [elfh].[tenantUrlTBL] ON;
-
- MERGE [elfh].[tenantUrlTBL] AS target
- USING @tenantUrlList AS source
- ON target.tenantUrlId = source.tenantUrlId
-
- WHEN MATCHED THEN
- UPDATE SET
- tenantId = source.tenantId,
- urlHostName = source.urlHostName,
- useHostForAuth = source.useHostForAuth,
- deleted = source.deleted,
- amendUserID = source.amendUserID,
- amendDate = source.amendDate
-
- WHEN NOT MATCHED THEN
- INSERT (
- tenantUrlId,
- tenantId,
- urlHostName,
- useHostForAuth,
- deleted,
- amendUserID,
- amendDate
- )
- VALUES (
- source.tenantUrlId,
- source.tenantId,
- source.urlHostName,
- source.useHostForAuth,
- source.deleted,
- source.amendUserID,
- source.amendDate
- );
-
- -- Disable identity insert
- SET IDENTITY_INSERT [elfh].[tenantUrlTBL] OFF;
-END
-GO
diff --git a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergetermsAndConditions.sql b/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergetermsAndConditions.sql
deleted file mode 100644
index b01ba6b4a..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergetermsAndConditions.sql
+++ /dev/null
@@ -1,64 +0,0 @@
--------------------------------------------------------------------------------
--- Author Sarathlal
--- Created 04-11-2025
--- Purpose ELFH-LH Data sync
---
--- Modification History
---
--- 04-11-2025 Sarathlal Initial Revision
--------------------------------------------------------------------------------
-CREATE PROCEDURE [dbo].[AdfMergetermsAndConditions]
- @termsAndConditionsList dbo.TermsAndConditions READONLY -- Table-valued parameter
-AS
-BEGIN
- SET NOCOUNT ON;
-
- -- Enable identity insert if termsAndConditionsId is an IDENTITY column
- SET IDENTITY_INSERT [elfh].[termsAndConditionsTBL] ON;
-
- MERGE [elfh].[termsAndConditionsTBL] AS target
- USING @termsAndConditionsList AS source
- ON target.termsAndConditionsId = source.termsAndConditionsId
-
- WHEN MATCHED THEN
- UPDATE SET
- createdDate = source.createdDate,
- description = source.description,
- details = source.details,
- tenantId = source.tenantId,
- active = source.active,
- reportable = source.reportable,
- deleted = source.deleted,
- amendUserID = source.amendUserID,
- amendDate = source.amendDate
-
- WHEN NOT MATCHED THEN
- INSERT (
- termsAndConditionsId,
- createdDate,
- description,
- details,
- tenantId,
- active,
- reportable,
- deleted,
- amendUserID,
- amendDate
- )
- VALUES (
- source.termsAndConditionsId,
- source.createdDate,
- source.description,
- source.details,
- source.tenantId,
- source.active,
- source.reportable,
- source.deleted,
- source.amendUserID,
- source.amendDate
- );
-
- -- Disable identity insert
- SET IDENTITY_INSERT [elfh].[termsAndConditionsTBL] OFF;
-END
-GO
diff --git a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergeuserEmployment.sql b/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergeuserEmployment.sql
deleted file mode 100644
index 5be94cd10..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergeuserEmployment.sql
+++ /dev/null
@@ -1,81 +0,0 @@
--------------------------------------------------------------------------------
--- Author Sarathlal
--- Created 04-11-2025
--- Purpose ELFH-LH Data sync
---
--- Modification History
---
--- 04-11-2025 Sarathlal Initial Revision
--------------------------------------------------------------------------------
-CREATE PROCEDURE [dbo].[AdfMergeuserEmployment]
- @userEmploymentList dbo.UserEmployment READONLY -- Table-valued parameter type
-AS
-BEGIN
- SET NOCOUNT ON;
-
- SET IDENTITY_INSERT [elfh].[userEmploymentTBL] ON;
- ALTER TABLE [elfh].[userEmploymentTBL] NOCHECK CONSTRAINT ALL;
- ALTER TABLE [hub].[User] NOCHECK CONSTRAINT ALL;
- MERGE [elfh].[userEmploymentTBL] AS target
- USING @userEmploymentList AS source
- ON target.userEmploymentId = source.userEmploymentId
-
- WHEN MATCHED THEN
- UPDATE SET
- userId = source.userId,
- jobRoleId = source.jobRoleId,
- specialtyId = source.specialtyId,
- gradeId = source.gradeId,
- schoolId = source.schoolId,
- locationId = source.locationId,
- medicalCouncilId = source.medicalCouncilId,
- medicalCouncilNo = source.medicalCouncilNo,
- startDate = source.startDate,
- endDate = source.endDate,
- deleted = source.deleted,
- archived = source.archived,
- amendUserId = source.amendUserId,
- amendDate = source.amendDate
-
- WHEN NOT MATCHED THEN
- INSERT (
- userEmploymentId,
- userId,
- jobRoleId,
- specialtyId,
- gradeId,
- schoolId,
- locationId,
- medicalCouncilId,
- medicalCouncilNo,
- startDate,
- endDate,
- deleted,
- archived,
- amendUserId,
- amendDate
- )
- VALUES (
- source.userEmploymentId,
- source.userId,
- source.jobRoleId,
- source.specialtyId,
- source.gradeId,
- source.schoolId,
- source.locationId,
- source.medicalCouncilId,
- source.medicalCouncilNo,
- source.startDate,
- source.endDate,
- source.deleted,
- source.archived,
- source.amendUserId,
- source.amendDate
- );
-
- -- Disable identity insert
- SET IDENTITY_INSERT [elfh].[userEmploymentTBL] OFF;
- ALTER TABLE [elfh].[userEmploymentTBL] NOCHECK CONSTRAINT ALL;
- ALTER TABLE [hub].[User] NOCHECK CONSTRAINT ALL;
-END
-GO
diff --git a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergeuserTermsAndConditions.sql b/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergeuserTermsAndConditions.sql
deleted file mode 100644
index 946e1bbb1..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/AdfMergeuserTermsAndConditions.sql
+++ /dev/null
@@ -1,54 +0,0 @@
--------------------------------------------------------------------------------
--- Author Sarathlal
--- Created 04-11-2025
--- Purpose ELFH-LH Data sync
---
--- Modification History
---
--- 04-11-2025 Sarathlal Initial Revision
--------------------------------------------------------------------------------
-CREATE PROCEDURE [dbo].[AdfMergeUserTermsAndConditions]
- @userTermsAndConditionsList dbo.UserTermsAndConditions READONLY
-AS
-BEGIN
- SET NOCOUNT ON;
-
- -- Enable identity insert if userTermsAndConditionsId is an IDENTITY column
- SET IDENTITY_INSERT [elfh].[userTermsAndConditionsTBL] ON;
- MERGE [elfh].[userTermsAndConditionsTBL] AS target
- USING @userTermsAndConditionsList AS source
- ON target.[userTermsAndConditionsId] = source.[userTermsAndConditionsId]
-
- WHEN MATCHED THEN
- UPDATE SET
- [termsAndConditionsId] = source.[termsAndConditionsId],
- [userId] = source.[userId],
- [acceptanceDate] = source.[acceptanceDate],
- [deleted] = source.[deleted],
- [amendUserID] = source.[amendUserID],
- [amendDate] = source.[amendDate]
-
- WHEN NOT MATCHED THEN
- INSERT (
- [userTermsAndConditionsId],
- [termsAndConditionsId],
- [userId],
- [acceptanceDate],
- [deleted],
- [amendUserID],
- [amendDate]
- )
- VALUES (
- source.[userTermsAndConditionsId],
- source.[termsAndConditionsId],
- source.[userId],
- source.[acceptanceDate],
- source.[deleted],
- source.[amendUserID],
- source.[amendDate]
- );
-
- -- Disable identity insert
- SET IDENTITY_INSERT [elfh].[userTermsAndConditionsTBL] OFF;
-END
-GO
diff --git a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/proc_UpdateLastSyncTimeAdf.sql b/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/proc_UpdateLastSyncTimeAdf.sql
deleted file mode 100644
index c7896b6b2..000000000
Binary files a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Adf/proc_UpdateLastSyncTimeAdf.sql and /dev/null differ
diff --git a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Elfh/GetUserByOpenAthensId.sql b/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Elfh/GetUserByOpenAthensId.sql
deleted file mode 100644
index bb0687719..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Elfh/GetUserByOpenAthensId.sql
+++ /dev/null
@@ -1,23 +0,0 @@
------------------------------------------------------------------------------------------------
--- Tobi Awe 31/10/2025 - Initial Version.
--- converted elfh efcore query to sp in LH database
-------------------------------------------------------------------------------------------------
-
-CREATE PROCEDURE elfh.proc_GetUserByOpenAthensId
- @OpenAthensId NVARCHAR(255)
-AS
-BEGIN
- SET NOCOUNT ON;
-
- SELECT
- u.Id,
- u.UserName,
- up.FirstName,
- up.LastName,
- up.EmailAddress,
- u.AmendDate AS LastUpdated
- FROM hub.[user] u
- INNER JOIN hub.userprofile up ON up.Id = u.Id
- INNER JOIN elfh.userAttributeTBL ua ON ua.UserId = u.Id
- WHERE ua.TextValue = @OpenAthensId AND u.deleted = 0 AND up.deleted = 0 AND ua.deleted = 0;
-END
diff --git a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Elfh/LinkEmploymentRecordToUser.sql b/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Elfh/LinkEmploymentRecordToUser.sql
deleted file mode 100644
index 0f4f670ba..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Elfh/LinkEmploymentRecordToUser.sql
+++ /dev/null
@@ -1,36 +0,0 @@
------------------------------------------------------------------------------------------------
--- Mark Avey 11/06/2020 - Initial Version.
--- Update the UserTBL record with the primaryUserEmploymentId from userEmploymentTBL
-------------------------------------------------------------------------------------------------
-CREATE PROCEDURE [elfh].[proc_LinkEmploymentRecordToUser]
-(
- @userId int
-)
-AS
-BEGIN
- BEGIN TRANSACTION
- BEGIN TRY
- SET NOCOUNT OFF
-
- UPDATE [hub].[User]
- SET primaryUserEmploymentId = (SELECT userEmploymentId FROM [elfh].[userEmploymentTBL] WHERE userId = @userId)
- WHERE Id = @userId
-
- END TRY
-
- BEGIN CATCH
- SELECT
- ERROR_NUMBER() AS ErrorNumber
- ,ERROR_SEVERITY() AS ErrorSeverity
- ,ERROR_STATE() AS ErrorState
- ,ERROR_PROCEDURE() AS ErrorProcedure
- ,ERROR_LINE() AS ErrorLine
- ,ERROR_MESSAGE() AS ErrorMessage;
-
- IF @@TRANCOUNT > 0 ROLLBACK TRANSACTION
- END CATCH
-
- IF @@TRANCOUNT > 0 COMMIT TRANSACTION
-
- RETURN @@ERROR
- END
\ No newline at end of file
diff --git a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Elfh/UserDetailForAuthenticationByUserName.sql b/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Elfh/UserDetailForAuthenticationByUserName.sql
deleted file mode 100644
index 70ecd918b..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Elfh/UserDetailForAuthenticationByUserName.sql
+++ /dev/null
@@ -1,49 +0,0 @@
--------------------------------------------------------------------------
--- Jignesh Jethwani 27 Sept 2023 - Initial version
--- Tobi Awe 24 Sept 2025 - swapped elfh user table to hub user table
---------------------------------------------------------------------------
-CREATE PROCEDURE [elfh].[proc_UserDetailForAuthenticationByUserName]
-(
- @userName varchar(100)
-)
-AS
-BEGIN
- SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED
- SET NOCOUNT ON
- DECLARE @Err int
- DECLARE @false bit
- SET @false = 0
- SELECT elfhuser.Id as Id,
- elfhuser.userName,
- ISNULL(elfhuser.passwordHash, '') AS 'passwordHash',
- elfhuser.RestrictToSSO,
- up.Active,
- elfhuser.activeFromDate,
- elfhuser.activeToDate,
- elfhuser.passwordLifeCounter,
- userAttribData.userAttributeId as OpenAthensUserAttributeId
- FROM
- [hub].[User] elfhuser
- INNER JOIN hub.UserProfile up
- ON elfhuser.Id = up.Id
- OUTER APPLY
- (
- SELECT
- TOP 1 userAttrib.userAttributeId
- FROM
- elfh.userAttributeTBL userAttrib
- INNER Join
- elfh.attributeTBL attrib ON userAttrib.attributeId = attrib.attributeId AND lower(attrib.attributeName) = 'openathens_userid' AND userAttrib.deleted = 0
- WHERE
- userAttrib.userId = elfhuser.Id
- ) userAttribData
- WHERE
- elfhuser.userName = @userName
- AND
- elfhuser.deleted = 0
- AND
- up.deleted = 0
-
- SET @Err = @@Error
- RETURN @Err
-END
\ No newline at end of file
diff --git a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Elfh/UserHistoryAttributeSave.sql b/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Elfh/UserHistoryAttributeSave.sql
deleted file mode 100644
index 7ecb39048..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Elfh/UserHistoryAttributeSave.sql
+++ /dev/null
@@ -1,89 +0,0 @@
-
---------------------------------------------------------------------------
--- Jignesh Jethwani 02-03-2018 Initial version
--- Jignesh Jethwani 02-10-2023 TD-2913, performance improvement, added no lock to select statement
--- Tobi Awe 24-09-2025 Updated table schema
---------------------------------------------------------------------------
-CREATE PROCEDURE [elfh].[proc_UserHistoryAttributeSave]
-(
- @userHistoryAttributeId int OUTPUT,
- @userHistoryId int,
- @attributeId int,
- @intValue int,
- @textValue nvarchar(255),
- @booleanValue bit,
- @dateValue datetimeoffset,
- @deleted bit,
- @amendUserId int,
- @amendDate datetimeoffset
-)
-AS
-BEGIN
- DECLARE @currentIntValue int
- DECLARE @currentTextValue nvarchar(255)
- DECLARE @currentBooleanValue bit
- DECLARE @currentDateValue datetimeoffset
- SELECT
- @userHistoryAttributeId = userHistoryAttributeId,
- @currentIntValue = intValue,
- @currentTextValue = textValue,
- @currentBooleanValue = booleanValue,
- @currentDateValue = dateValue
- FROM
- elfh.userHistoryAttributeTBL WITH (NOLOCK)
- WHERE
- userHistoryId = @userHistoryId
- AND
- attributeId = @attributeId
- IF @userHistoryAttributeId IS NULL
- BEGIN
- IF @intValue IS NOT NULL
- OR ISNULL(@textValue, '') != ''
- OR @booleanValue IS NOT NULL
- OR @dateValue IS NOT NULL
- BEGIN
- INSERT INTO elfh.userHistoryAttributeTBL(userHistoryId,
- attributeId,
- intValue,
- textValue,
- booleanValue,
- dateValue,
- deleted,
- amendUserId,
- amendDate)
- SELECT
- userHistoryId = @userHistoryId,
- attributeId = @attributeId,
- intValue = @intValue,
- textValue = @textValue,
- booleanValue = @booleanValue,
- dateValue = @dateValue,
- deleted = @deleted,
- amendUserId = @amendUserId,
- @amendDate
- SELECT @userHistoryAttributeId = SCOPE_IDENTITY()
- END
- END
- ELSE
- BEGIN
- -- Only update when an Attribute Value has changed
- IF (@intValue != @currentIntValue
- OR ISNULL(@textValue, '') != ISNULL(@currentTextValue,'')
- OR @booleanValue != @currentBooleanValue
- OR @dateValue != @currentDateValue)
- BEGIN
- UPDATE
- elfh.userHistoryAttributeTBL
- SET
- intValue = @intValue,
- textValue = @textValue,
- booleanValue = @booleanValue,
- dateValue = @dateValue,
- deleted = @deleted,
- amendUserId = @amendUserId,
- amendDate = @amendDate
- WHERE
- userHistoryAttributeId = @userHistoryAttributeId
- END
- END
-END
diff --git a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Elfh/UserHistoryInsert.sql b/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Elfh/UserHistoryInsert.sql
deleted file mode 100644
index f972aa05b..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Elfh/UserHistoryInsert.sql
+++ /dev/null
@@ -1,143 +0,0 @@
-
---------------------------------------------------------------------------
--- Chris Bain 08 Aug 2014 - Initial Build
--- Killian Davies 12 Aug 2015 - Added userAgent info (for Login history event)
--- Chris Bain 18 Nov 2016 - Added tenant Id
--- Jignesh Jethwani 02 Mar 2018 - Save details to User History Attribute, add url referer
---------------------------------------------------------------------------
-CREATE PROCEDURE [elfh].[proc_UserHistoryInsert]
- @userId int = 0,
- @historyTypeId int,
- @detailedInfo NVARCHAR(1000) = NULL,
- @userAgent NVARCHAR(1000) = NULL,
- @browserName NVARCHAR(1000) = NULL,
- @browserVersion NVARCHAR(1000) = NULL,
- @urlReferer NVARCHAR(1000) = NULL,
- @loginIP NVARCHAR(50) = NULL,
- @loginSuccessFul bit = NULL,
- @tenantId INT,
- @amendUserId INT,
- @amendDate DATETIMEOFFSET = NULL
-AS
-BEGIN
-
- DECLARE @UserHistoryId int
- DECLARE @detailInfoAttributeId int, @userAgentAttributeId int, @browserNameAttributeId int, @browserVersionAttributeId int, @urlRefererAttributeId int, @loginSuccessFulAttributeId int
- SET @amendDate = CoalEsce(@amendDate,SysDateTimeOffset())
-
- INSERT INTO userHistoryTBL (userId, userHistoryTypeId, tenantId,createdDate)
- VALUES (@userId, @historyTypeId, @tenantId, @amendDate)
-
-
- SET @UserHistoryId = CAST(SCOPE_IDENTITY() AS int)
-
- SELECT @detailInfoAttributeId = attributeId FROM [elfh].[attributeTBL] WHERE [attributeName] = 'UserHistory_DetailedInfo' AND deleted = 0
- SELECT @userAgentAttributeId = attributeId FROM [elfh].[attributeTBL] WHERE [attributeName] = 'UserHistory_UserAgent' AND deleted = 0
- SELECT @browserNameAttributeId = attributeId FROM [elfh].[attributeTBL] WHERE [attributeName] = 'UserHistory_BrowserName' AND deleted = 0
- SELECT @browserVersionAttributeId = attributeId FROM [elfh].[attributeTBL] WHERE [attributeName] = 'UserHistory_BrowserVersion' AND deleted = 0
- SELECT @urlRefererAttributeId = attributeId FROM [elfh].[attributeTBL] WHERE [attributeName] = 'UserHistory_UrlReferer' AND deleted = 0
- SELECT @loginSuccessFulAttributeId = attributeId FROM [elfh].[attributeTBL] WHERE [attributeName] = 'UserHistory_LoginSuccessful' AND deleted = 0
-
- -- DetailedInfo
- IF @detailInfoAttributeId > 0 AND @detailedInfo IS NOT NULL
- BEGIN
- EXECUTE [elfh].[proc_UserHistoryAttributeSave] null,
- @UserHistoryId,
- @detailInfoAttributeId,
- NULL,
- @detailedInfo, -- textValue,
- NULL, -- booleanValue,
- NULL, -- dateValue,
- 0, -- deleted
- @amendUserId,
- @amendDate
- END
-
- -- User Agent
- IF @userAgentAttributeId > 0 AND @userAgent IS NOT NULL
- BEGIN
-
- EXECUTE [elfh].[proc_UserHistoryAttributeSave] null,
- @UserHistoryId,
- @userAgentAttributeId,
- NULL, -- intValue
- @userAgent, -- textValue,
- NULL, -- booleanValue,
- NULL, -- dateValue,
- 0, -- deleted
- @amendUserId,
- @amendDate
- END
-
- -- Browser Name
- IF @browserNameAttributeId > 0 AND @browserName IS NOT NULL
- BEGIN
-
- EXECUTE [elfh].[proc_UserHistoryAttributeSave] null,
- @UserHistoryId,
- @browserNameAttributeId,
- NULL, -- intValue
- @browserName, -- textValue,
- NULL, -- booleanValue,
- NULL, -- dateValue,
- 0, -- deleted
- @amendUserId,
- @amendDate
-
- END
-
- -- Browser Version
- IF @browserVersionAttributeId > 0 AND @browserVersion IS NOT NULL
- BEGIN
-
-
- EXECUTE [elfh].[proc_UserHistoryAttributeSave] null,
- @UserHistoryId,
- @browserVersionAttributeId,
- NULL, -- intValue
- @browserVersion,
- NULL, -- booleanValue,
- NULL, -- dateValue,
- 0, -- deleted
- @amendUserId,
- @amendDate
- END
-
-
- -- Url Referer
- IF @urlRefererAttributeId > 0 AND @urlReferer IS NOT NULL
- BEGIN
-
- EXECUTE [elfh].[proc_UserHistoryAttributeSave] null,
- @UserHistoryId,
- @urlRefererAttributeId,
- NULL, -- intValue
- @urlReferer, -- textValue,
- NULL, -- booleanValue,
- NULL, -- dateValue,
- 0, -- deleted
- @amendUserId,
- @amendDate
-
- END
-
-
- -- Login SuccessFul
- IF @loginSuccessFulAttributeId > 0 AND @loginSuccessFul IS NOT NULL
- BEGIN
-
- EXECUTE [elfh].[proc_UserHistoryAttributeSave] null,
- @UserHistoryId,
- @loginSuccessFulAttributeId,
- NULL, -- intValue
- @loginIP, -- textValue,
- @loginSuccessFul, -- booleanValue,
- NULL, -- dateValue,
- 0, -- deleted
- @amendUserId,
- @amendDate
-
- END
-
-
-END
\ No newline at end of file
diff --git a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Elfh/UserHistoryLoadForLearningHubUser.sql b/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Elfh/UserHistoryLoadForLearningHubUser.sql
deleted file mode 100644
index 7889a609b..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Elfh/UserHistoryLoadForLearningHubUser.sql
+++ /dev/null
@@ -1,50 +0,0 @@
---------------------------------------------------------------------------------
--- Killian Davies 08-February-2021 Initial Revision - services LH user history
---------------------------------------------------------------------------------
-CREATE PROCEDURE [elfh].[proc_UserHistoryLoadForLearningHubUser]
- @userId int,
- @startPage int=1,
- @PageSize float=10.0,
- @TotalResults int output
-AS
- DECLARE @History Table(RowNumber int, userHistoryId int)
-
- DECLARE @ItemsReturned INT
- DECLARE @StartRow INT
- DECLARE @EndRow INT
- SET @StartRow = ((@startPage - 1) * @PageSize)
- SET @EndRow = (@startPage * @PageSize) + 1
-
- INSERT INTO @History
- SELECT
- ROW_NUMBER() OVER( ORDER BY [userHistoryId] DESC) as RowNumber,
- userHistoryId
- FROM
- userHistoryTBL
- WHERE
- userId = @userId
- ORDER BY
- createdDate DESC
-
- -- Determine the number of items in the search result set
- SELECT
- @TotalResults = Count(userHistoryId)
- FROM
- @History
-
- SELECT
- uh.*,
- uht.[Description],
- ISNULL(t.tenantName,'Unknown') as tenantName
- FROM userHistoryVW uh
- INNER JOIN @History h ON h.userHistoryId = uh.userHistoryId
- INNER JOIN userHistoryTypeTBL uht ON uht.UserHistoryTypeId = uh.userHistoryTypeId
- LEFT JOIN tenantTBL t ON t.tenantId = uh.tenantId
- WHERE
- h.RowNumber > @StartRow
- AND
- h.RowNumber < @EndRow
- ORDER BY
- h.RowNumber ASC
-
-RETURN 0
diff --git a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Elfh/UserHistoryLoadForUser.sql b/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Elfh/UserHistoryLoadForUser.sql
deleted file mode 100644
index 69e061a00..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Stored Procedures/Elfh/UserHistoryLoadForUser.sql
+++ /dev/null
@@ -1,55 +0,0 @@
---------------------------------------------------------------------------------
--- Jignesh Jethwani 05 Mar 2018 - Updated, moved userHistory to Attribute Table
--- Killian Davies 30 Oct 2019 - Perf improvement - modified to use table rather than view
---------------------------------------------------------------------------------
-
-CREATE PROCEDURE [elfh].[proc_UserHistoryLoadForUser]
- @userId int,
- @startPage int=1,
- @PageSize float=10.0,
- @PagesReturned int output
-AS
- DECLARE @History Table(RowNumber int, userHistoryId int)
-
- DECLARE @ItemsReturned INT
- DECLARE @StartRow INT
- DECLARE @EndRow INT
- SET @StartRow = ((@startPage - 1) * @PageSize)
- SET @EndRow = (@startPage * @PageSize) + 1
-
- INSERT INTO @History
- SELECT
- ROW_NUMBER() OVER( ORDER BY [userHistoryId] DESC) as RowNumber,
- userHistoryId
- FROM
- userHistoryTBL
- WHERE
- userId = @userId
- ORDER BY
- createdDate DESC
-
- -- Determine the number of items in the search result set
- SELECT
- @ItemsReturned = Count(userHistoryId)
- FROM
- @History
-
- SET @PagesReturned = CEILING(@ItemsReturned / @PageSize);
-
-
- SELECT
- uh.*,
- uht.[Description],
- ISNULL(t.tenantName,'Unknown') as tenantName
- FROM userHistoryVW uh
- INNER JOIN @History h ON h.userHistoryId = uh.userHistoryId
- INNER JOIN userHistoryTypeTBL uht ON uht.UserHistoryTypeId = uh.userHistoryTypeId
- LEFT JOIN tenantTBL t ON t.tenantId = uh.tenantId
- WHERE
- h.RowNumber > @StartRow
- AND
- h.RowNumber < @EndRow
- ORDER BY
- h.RowNumber ASC
-
-RETURN 0
diff --git a/WebAPI/LearningHub.Nhs.Database/Tables/Adf/ADFSyncMetadata.sql b/WebAPI/LearningHub.Nhs.Database/Tables/Adf/ADFSyncMetadata.sql
deleted file mode 100644
index c39c5980b..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Tables/Adf/ADFSyncMetadata.sql
+++ /dev/null
@@ -1,7 +0,0 @@
-CREATE TABLE ADFSyncMetadata (
- SyncDirection VARCHAR(50), -- e.g., 'ELFHtoLH' or 'LHtoELFH'
- TableName VARCHAR(100), -- e.g., 'userTBL_Test', 'departmentTBL'
- LastSyncTime DATETIME2,
- PRIMARY KEY (SyncDirection, TableName)
-);
-GO
diff --git a/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/AttributeTBL.sql b/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/AttributeTBL.sql
deleted file mode 100644
index 69fffa30b..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/AttributeTBL.sql
+++ /dev/null
@@ -1,31 +0,0 @@
-CREATE TABLE [elfh].[attributeTBL](
- [attributeId] [int] IDENTITY(1,1) NOT NULL,
- [attributeTypeId] [int] NOT NULL,
- [attributeName] [nvarchar](50) NOT NULL,
- [attributeAccess] [tinyint] NOT NULL,
- [attributeDescription] [nvarchar](400) NULL,
- [deleted] [bit] NOT NULL,
- [amendUserId] [int] NOT NULL,
- [amendDate] [datetimeoffset](7) NOT NULL,
- CONSTRAINT [PK_attributeTBL] PRIMARY KEY CLUSTERED
-(
- [attributeId] ASC
-)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 100) ON [PRIMARY]
-) ON [PRIMARY]
-GO
-
-ALTER TABLE [elfh].[attributeTBL] ADD DEFAULT ((0)) FOR [attributeAccess]
-GO
-
-ALTER TABLE [elfh].[attributeTBL] ADD DEFAULT ((0)) FOR [deleted]
-GO
-
-ALTER TABLE [elfh].[attributeTBL] ADD DEFAULT (sysdatetimeoffset()) FOR [amendDate]
-GO
-
-ALTER TABLE [elfh].[attributeTBL] WITH CHECK ADD CONSTRAINT [FK_attributeTBL_attributeTypeId] FOREIGN KEY([attributeTypeId])
-REFERENCES [elfh].[attributeTypeTBL] ([attributeTypeId])
-GO
-
-ALTER TABLE [elfh].[attributeTBL] CHECK CONSTRAINT [FK_attributeTBL_attributeTypeId]
-GO
\ No newline at end of file
diff --git a/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/AttributeTypeTBL.sql b/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/AttributeTypeTBL.sql
deleted file mode 100644
index 39a87b055..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/AttributeTypeTBL.sql
+++ /dev/null
@@ -1,18 +0,0 @@
-CREATE TABLE [elfh].[attributeTypeTBL](
- [attributeTypeId] [int] NOT NULL,
- [attributeTypeName] [nvarchar](50) NOT NULL,
- [deleted] [bit] NOT NULL,
- [amendUserId] [int] NOT NULL,
- [amendDate] [datetimeoffset](7) NOT NULL,
- CONSTRAINT [PK_attributeTypeTBL] PRIMARY KEY CLUSTERED
-(
- [attributeTypeId] ASC
-)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 100) ON [PRIMARY]
-) ON [PRIMARY]
-GO
-
-ALTER TABLE [elfh].[attributeTypeTBL] ADD DEFAULT ((0)) FOR [deleted]
-GO
-
-ALTER TABLE [elfh].[attributeTypeTBL] ADD DEFAULT (sysdatetimeoffset()) FOR [amendDate]
-GO
diff --git a/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/CountryTBL.sql b/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/CountryTBL.sql
deleted file mode 100644
index 2adf7cc35..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/CountryTBL.sql
+++ /dev/null
@@ -1,24 +0,0 @@
-CREATE TABLE [elfh].[countryTBL](
- [countryId] [int] IDENTITY(1,1) NOT NULL,
- [countryName] [nvarchar](50) NULL,
- [alpha2] [nvarchar](2) NULL,
- [alpha3] [nvarchar](3) NULL,
- [numeric] [nvarchar](3) NULL,
- [EUVatRate] [float] NOT NULL,
- [displayOrder] [int] NOT NULL,
- [deleted] [bit] NOT NULL,
- [amendUserId] [int] NOT NULL,
- [amendDate] [datetimeoffset](7) NOT NULL,
- CONSTRAINT [PK_countryTBL] PRIMARY KEY CLUSTERED
-(
- [countryId] ASC
-)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 100) ON [PRIMARY]
-) ON [PRIMARY]
-GO
-
-ALTER TABLE [elfh].[countryTBL] ADD DEFAULT ((0)) FOR [EUVatRate]
-GO
-
-ALTER TABLE [elfh].[countryTBL] ADD CONSTRAINT [DF_countryTBL_displayOrder] DEFAULT ((0)) FOR [displayOrder]
-GO
-
diff --git a/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/DeaneryTBL.sql b/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/DeaneryTBL.sql
deleted file mode 100644
index bc2f91bef..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/DeaneryTBL.sql
+++ /dev/null
@@ -1,13 +0,0 @@
-CREATE TABLE [elfh].[deaneryTBL](
- [deaneryId] [int] IDENTITY(1,1) NOT NULL,
- [deaneryName] [nvarchar](50) NOT NULL,
- [displayOrder] [int] NOT NULL,
- [deleted] [bit] NOT NULL,
- [amendUserID] [int] NOT NULL,
- [amendDate] [datetimeoffset](7) NOT NULL,
- CONSTRAINT [PK_deaneryTBL] PRIMARY KEY CLUSTERED
-(
- [deaneryId] ASC
-)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 100) ON [PRIMARY]
-) ON [PRIMARY]
-GO
diff --git a/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/EmailTemplateTBL.sql b/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/EmailTemplateTBL.sql
deleted file mode 100644
index 18210ed54..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/EmailTemplateTBL.sql
+++ /dev/null
@@ -1,30 +0,0 @@
-CREATE TABLE [elfh].[emailTemplateTBL](
- [emailTemplateId] [int] IDENTITY(1,1) NOT NULL,
- [emailTemplateTypeId] [int] NOT NULL,
- [programmeComponentId] [int] NOT NULL,
- [title] [nvarchar](256) NULL,
- [subject] [nvarchar](256) NOT NULL,
- [body] [ntext] NOT NULL,
- [deleted] [bit] NOT NULL,
- [amendUserID] [int] NOT NULL,
- [amendDate] [datetimeoffset](7) NOT NULL,
- [tenantId] [int] NULL,
- CONSTRAINT [PK_EmailTemplateTBL] PRIMARY KEY CLUSTERED
-(
- [emailTemplateId] ASC
-)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 100) ON [PRIMARY]
-) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
-GO
-
-ALTER TABLE [elfh].[emailTemplateTBL] ADD CONSTRAINT [DF_emailTemplateTBL_Deleted] DEFAULT ((0)) FOR [deleted]
-GO
-
-ALTER TABLE [elfh].[emailTemplateTBL] ADD CONSTRAINT [DF_EmailTemplate_AmendDate] DEFAULT (sysdatetimeoffset()) FOR [amendDate]
-GO
-
-ALTER TABLE [elfh].[emailTemplateTBL] WITH CHECK ADD CONSTRAINT [FK_emailTemplateTBL_emailTemplateTypeTBL] FOREIGN KEY([emailTemplateTypeId])
-REFERENCES [elfh].[emailTemplateTypeTBL] ([emailTemplateTypeId])
-GO
-
-ALTER TABLE [elfh].[emailTemplateTBL] CHECK CONSTRAINT [FK_emailTemplateTBL_emailTemplateTypeTBL]
-GO
\ No newline at end of file
diff --git a/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/EmailTemplateTypeTBL.sql b/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/EmailTemplateTypeTBL.sql
deleted file mode 100644
index d3b4764b8..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/EmailTemplateTypeTBL.sql
+++ /dev/null
@@ -1,19 +0,0 @@
-CREATE TABLE [elfh].[emailTemplateTypeTBL](
- [emailTemplateTypeId] [int] NOT NULL,
- [emailTemplateTypeName] [nvarchar](50) NOT NULL,
- [availableTags] [nvarchar](255) NULL,
- [deleted] [bit] NOT NULL,
- [amendUserID] [int] NOT NULL,
- [amendDate] [datetimeoffset](7) NOT NULL,
- CONSTRAINT [PK_emailTemplateTypeTBL] PRIMARY KEY CLUSTERED
-(
- [emailTemplateTypeId] ASC
-)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 100) ON [PRIMARY]
-) ON [PRIMARY]
-GO
-
-ALTER TABLE [elfh].[emailTemplateTypeTBL] ADD CONSTRAINT [DF_emailTemplateTypeTBL_Deleted] DEFAULT ((0)) FOR [deleted]
-GO
-
-ALTER TABLE [elfh].[emailTemplateTypeTBL] ADD CONSTRAINT [DF_emailTemplateTypeTBL_AmendDate] DEFAULT (sysdatetimeoffset()) FOR [amendDate]
-GO
\ No newline at end of file
diff --git a/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/EmploymentReferenceTypeTBL.sql b/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/EmploymentReferenceTypeTBL.sql
deleted file mode 100644
index be4a54abb..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/EmploymentReferenceTypeTBL.sql
+++ /dev/null
@@ -1,13 +0,0 @@
-CREATE TABLE [elfh].[employmentReferenceTypeTBL](
- [EmploymentReferenceTypeId] [int] NOT NULL,
- [Title] [nvarchar](50) NOT NULL,
- [RefAccess] [int] NOT NULL,
- CONSTRAINT [PK_EmploymentReferenceType] PRIMARY KEY CLUSTERED
-(
- [EmploymentReferenceTypeId] ASC
-)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 100, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
-) ON [PRIMARY]
-GO
-
-ALTER TABLE [elfh].[employmentReferenceTypeTBL] ADD CONSTRAINT [DF_employmentReferenceTypeTBL_RefAccess] DEFAULT ((0)) FOR [RefAccess]
-GO
diff --git a/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/GdcRegister.sql b/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/GdcRegister.sql
deleted file mode 100644
index 560d58995..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/GdcRegister.sql
+++ /dev/null
@@ -1,36 +0,0 @@
-CREATE TABLE [elfh].[gdcRegisterTBL](
- [reg_number] [nvarchar](50) NOT NULL,
- [Dentist] [bit] NOT NULL,
- [Title] [nvarchar](50) NULL,
- [Surname] [nvarchar](255) NULL,
- [Forenames] [nvarchar](255) NULL,
- [honorifics] [nvarchar](50) NULL,
- [house_name] [nvarchar](255) NULL,
- [address_line1] [nvarchar](255) NULL,
- [address_line2] [nvarchar](255) NULL,
- [address_line3] [nvarchar](255) NULL,
- [address_line4] [nvarchar](255) NULL,
- [Town] [nvarchar](50) NULL,
- [County] [nvarchar](50) NULL,
- [PostCode] [nvarchar](50) NULL,
- [Country] [nvarchar](50) NULL,
- [regdate] [nvarchar](50) NULL,
- [qualifications] [nvarchar](1000) NULL,
- [dcp_titles] [nvarchar](100) NULL,
- [specialties] [nvarchar](100) NULL,
- [condition] [nvarchar](50) NULL,
- [suspension] [nvarchar](50) NULL,
- [dateProcessed] [datetimeoffset](7) NOT NULL,
- [action] [nvarchar](1) NULL,
- CONSTRAINT [PK_gdcRegisterTBL] PRIMARY KEY CLUSTERED
-(
- [reg_number] ASC
-)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 100) ON [PRIMARY]
-) ON [PRIMARY]
-GO
-
-ALTER TABLE [elfh].[gdcRegisterTBL] ADD DEFAULT ((0)) FOR [Dentist]
-GO
-
-ALTER TABLE [elfh].[gdcRegisterTBL] ADD DEFAULT (sysdatetimeoffset()) FOR [dateProcessed]
-GO
\ No newline at end of file
diff --git a/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/GmcLrmp.sql b/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/GmcLrmp.sql
deleted file mode 100644
index 7d66d14c4..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/GmcLrmp.sql
+++ /dev/null
@@ -1,16 +0,0 @@
-CREATE TABLE [elfh].[gmclrmpTBL](
- [GMC_Ref_No] [nvarchar](50) NOT NULL,
- [Surname] [nvarchar](255) NULL,
- [Given_Name] [nvarchar](255) NULL,
- [Year_Of_Qualification] [float] NULL,
- [GP_Register_Date] [nvarchar](255) NULL,
- [Registration_Status] [nvarchar](255) NULL,
- [Other_Names] [nvarchar](255) NULL,
- [dateProcessed] [datetime] NULL,
- [action] [nchar](1) NULL,
- CONSTRAINT [PK_gmclrmpTBL] PRIMARY KEY CLUSTERED
-(
- [GMC_Ref_No] ASC
-)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 100) ON [PRIMARY]
-) ON [PRIMARY]
-GO
\ No newline at end of file
diff --git a/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/GradeTBL.sql b/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/GradeTBL.sql
deleted file mode 100644
index c9f7c47df..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/GradeTBL.sql
+++ /dev/null
@@ -1,20 +0,0 @@
-CREATE TABLE [elfh].[gradeTBL](
- [gradeId] [int] IDENTITY(1,1) NOT NULL,
- [gradeName] [nvarchar](50) NOT NULL,
- [displayOrder] [int] NOT NULL,
- [deleted] [bit] NOT NULL,
- [amendUserID] [int] NOT NULL,
- [amendDate] [datetimeoffset](7) NOT NULL,
- CONSTRAINT [PK_gradeTBL] PRIMARY KEY CLUSTERED
-(
- [gradeId] ASC
-)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 100) ON [PRIMARY]
-) ON [PRIMARY]
-GO
-
-ALTER TABLE [elfh].[gradeTBL] ADD CONSTRAINT [DF_gradeTBL_deleted] DEFAULT ((0)) FOR [deleted]
-GO
-
-ALTER TABLE [elfh].[gradeTBL] ADD CONSTRAINT [DF_gradeTBL_amendDate] DEFAULT (sysdatetimeoffset()) FOR [amendDate]
-GO
-
diff --git a/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/IpCountryLookupTBL.sql b/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/IpCountryLookupTBL.sql
deleted file mode 100644
index d5bc7f13b..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/IpCountryLookupTBL.sql
+++ /dev/null
@@ -1,8 +0,0 @@
-CREATE TABLE [elfh].[ipCountryLookupTBL](
- [fromIP] [varchar](20) NOT NULL,
- [toIP] [varchar](20) NOT NULL,
- [country] [varchar](10) NOT NULL,
- [fromInt] [bigint] NULL,
- [toInt] [bigint] NULL
-) ON [PRIMARY]
-GO
\ No newline at end of file
diff --git a/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/JobRoleTBL.sql b/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/JobRoleTBL.sql
deleted file mode 100644
index 7bb035683..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/JobRoleTBL.sql
+++ /dev/null
@@ -1,35 +0,0 @@
-CREATE TABLE [elfh].[jobRoleTBL](
- [jobRoleId] [int] IDENTITY(1,1) NOT NULL,
- [staffGroupId] [int] NULL,
- [jobRoleName] [nvarchar](100) NOT NULL,
- [medicalCouncilId] [int] NULL,
- [displayOrder] [int] NOT NULL,
- [deleted] [bit] NOT NULL,
- [amendUserID] [int] NOT NULL,
- [amendDate] [datetimeoffset](7) NOT NULL,
- CONSTRAINT [PK_jobRoleTBL] PRIMARY KEY CLUSTERED
-(
- [jobRoleId] ASC
-)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 100) ON [PRIMARY]
-) ON [PRIMARY]
-GO
-
-ALTER TABLE [elfh].[jobRoleTBL] ADD CONSTRAINT [DF_jobRoleTBL_deleted] DEFAULT ((0)) FOR [deleted]
-GO
-
-ALTER TABLE [elfh].[jobRoleTBL] ADD CONSTRAINT [DF_jobRoleTBL_amendDate] DEFAULT (sysdatetimeoffset()) FOR [amendDate]
-GO
-
-ALTER TABLE [elfh].[jobRoleTBL] WITH CHECK ADD CONSTRAINT [FK_jobRoleTBL_medicalCouncilTBL] FOREIGN KEY([medicalCouncilId])
-REFERENCES [elfh].[medicalCouncilTBL] ([medicalCouncilId])
-GO
-
-ALTER TABLE [elfh].[jobRoleTBL] CHECK CONSTRAINT [FK_jobRoleTBL_medicalCouncilTBL]
-GO
-
-ALTER TABLE [elfh].[jobRoleTBL] WITH CHECK ADD CONSTRAINT [FK_jobRoleTBL_staffGroupTBL] FOREIGN KEY([staffGroupId])
-REFERENCES [elfh].[staffGroupTBL] ([staffGroupId])
-GO
-
-ALTER TABLE [elfh].[jobRoleTBL] CHECK CONSTRAINT [FK_jobRoleTBL_staffGroupTBL]
-GO
diff --git a/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/Location.sql b/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/Location.sql
deleted file mode 100644
index 54a0bac86..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/Location.sql
+++ /dev/null
@@ -1,117 +0,0 @@
-
-CREATE TABLE [elfh].[locationTBL](
- [locationId] [int] NOT NULL,
- [locationCode] [nvarchar](50) NOT NULL,
- [locationName] [nvarchar](200) NOT NULL,
- [locationSubName] [nvarchar](200) NULL,
- [locationTypeId] [int] NOT NULL,
- [address1] [nvarchar](100) NULL,
- [address2] [nvarchar](100) NULL,
- [address3] [nvarchar](100) NULL,
- [address4] [nvarchar](100) NULL,
- [town] [nvarchar](100) NULL,
- [county] [nvarchar](100) NULL,
- [postCode] [nvarchar](8) NULL,
- [telephone] [nvarchar](50) NULL,
- [acute] [bit] NOT NULL,
- [ambulance] [bit] NOT NULL,
- [mental] [bit] NOT NULL,
- [care] [bit] NOT NULL,
- [mainHosp] [bit] NOT NULL,
- [nhsCode] [nvarchar](50) NULL,
- [parentId] [int] NOT NULL,
- [dataSource] [nvarchar](50) NOT NULL,
- [active] [bit] NOT NULL,
- [importExclusion] [bit] NOT NULL,
- [depth] [int] NULL,
- [lineage] [nvarchar](max) NULL,
- [created] [datetimeoffset](7) NOT NULL,
- [updated] [datetimeoffset](7) NOT NULL,
- [archivedDate] [datetimeoffset](7) NULL,
- [countryId] [int] NULL,
- [iguId] [int] NOT NULL,
- [letbId] [int] NOT NULL,
- [ccgId] [int] NOT NULL,
- [healthServiceId] [int] NOT NULL,
- [healthBoardId] [int] NOT NULL,
- [primaryTrustId] [int] NOT NULL,
- [secondaryTrustId] [int] NOT NULL,
- [islandId] [int] NOT NULL,
- [otherNHSOrganisationId] [int] NOT NULL,
- CONSTRAINT [PK_locationTBL] PRIMARY KEY CLUSTERED
-(
- [locationId] ASC
-)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 100) ON [PRIMARY]
-) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
-GO
-
-ALTER TABLE [elfh].[locationTBL] ADD DEFAULT ((0)) FOR [locationTypeId]
-GO
-
-ALTER TABLE [elfh].[locationTBL] ADD CONSTRAINT [DF_locationTBL_Acute] DEFAULT ((0)) FOR [acute]
-GO
-
-ALTER TABLE [elfh].[locationTBL] ADD CONSTRAINT [DF_locationTBL_Ambulance] DEFAULT ((0)) FOR [ambulance]
-GO
-
-ALTER TABLE [elfh].[locationTBL] ADD CONSTRAINT [DF_locationTBL_Mental] DEFAULT ((0)) FOR [mental]
-GO
-
-ALTER TABLE [elfh].[locationTBL] ADD CONSTRAINT [DF_locationTBL_Care] DEFAULT ((0)) FOR [care]
-GO
-
-ALTER TABLE [elfh].[locationTBL] ADD CONSTRAINT [DF_locationTBL_MainHosp] DEFAULT ((0)) FOR [mainHosp]
-GO
-
-ALTER TABLE [elfh].[locationTBL] ADD CONSTRAINT [DF_locationTBL_Active] DEFAULT ((1)) FOR [active]
-GO
-
-ALTER TABLE [elfh].[locationTBL] ADD CONSTRAINT [DF_locationTBL_ImportExclusion] DEFAULT ((0)) FOR [importExclusion]
-GO
-
-ALTER TABLE [elfh].[locationTBL] ADD CONSTRAINT [DF_locationTBL_created] DEFAULT (sysdatetimeoffset()) FOR [created]
-GO
-
-ALTER TABLE [elfh].[locationTBL] ADD CONSTRAINT [DF_locationTBL_updated] DEFAULT (sysdatetimeoffset()) FOR [updated]
-GO
-
-ALTER TABLE [elfh].[locationTBL] ADD DEFAULT ((0)) FOR [iguId]
-GO
-
-ALTER TABLE [elfh].[locationTBL] ADD DEFAULT ((0)) FOR [letbId]
-GO
-
-ALTER TABLE [elfh].[locationTBL] ADD DEFAULT ((0)) FOR [ccgId]
-GO
-
-ALTER TABLE [elfh].[locationTBL] ADD DEFAULT ((0)) FOR [healthServiceId]
-GO
-
-ALTER TABLE [elfh].[locationTBL] ADD DEFAULT ((0)) FOR [healthBoardId]
-GO
-
-ALTER TABLE [elfh].[locationTBL] ADD DEFAULT ((0)) FOR [primaryTrustId]
-GO
-
-ALTER TABLE [elfh].[locationTBL] ADD DEFAULT ((0)) FOR [secondaryTrustId]
-GO
-
-ALTER TABLE [elfh].[locationTBL] ADD DEFAULT ((0)) FOR [islandId]
-GO
-
-ALTER TABLE [elfh].[locationTBL] ADD DEFAULT ((0)) FOR [otherNHSOrganisationId]
-GO
-
-ALTER TABLE [elfh].[locationTBL] WITH CHECK ADD CONSTRAINT [FK_locationTBL_countryTBL] FOREIGN KEY([countryId])
-REFERENCES [elfh].[countryTBL] ([countryId])
-GO
-
-ALTER TABLE [elfh].[locationTBL] CHECK CONSTRAINT [FK_locationTBL_countryTBL]
-GO
-
-ALTER TABLE [elfh].[locationTBL] WITH CHECK ADD CONSTRAINT [FK_locationTBL_locationTypeTBL] FOREIGN KEY([locationTypeId])
-REFERENCES [elfh].[locationTypeTBL] ([locationTypeID])
-GO
-
-ALTER TABLE [elfh].[locationTBL] CHECK CONSTRAINT [FK_locationTBL_locationTypeTBL]
-GO
\ No newline at end of file
diff --git a/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/LoginWizardRuleTBL.sql b/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/LoginWizardRuleTBL.sql
deleted file mode 100644
index 536df2f89..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/LoginWizardRuleTBL.sql
+++ /dev/null
@@ -1,25 +0,0 @@
-CREATE TABLE [elfh].[loginWizardRuleTBL](
- [loginWizardRuleId] [int] NOT NULL,
- [loginWizardStageId] [int] NOT NULL,
- [loginWizardRuleCategoryId] [int] NOT NULL,
- [description] [nvarchar](128) NOT NULL,
- [reasonDisplayText] [nvarchar](1024) NOT NULL,
- [activationPeriod] [int] NULL,
- [required] [bit] NOT NULL,
- [active] [bit] NOT NULL,
- [deleted] [bit] NOT NULL,
- [amendUserId] [int] NOT NULL,
- [amendDate] [datetimeoffset](7) NOT NULL,
- CONSTRAINT [PK_loginWizardRule] PRIMARY KEY CLUSTERED
-(
- [loginWizardRuleId] ASC
-)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 100) ON [PRIMARY]
-) ON [PRIMARY]
-GO
-
-ALTER TABLE [elfh].[loginWizardRuleTBL] WITH CHECK ADD CONSTRAINT [FK_loginWizardRuleTBL_loginWizardStageTBL] FOREIGN KEY([loginWizardStageId])
-REFERENCES [elfh].[loginWizardStageTBL] ([loginWizardStageId])
-GO
-
-ALTER TABLE [elfh].[loginWizardRuleTBL] CHECK CONSTRAINT [FK_loginWizardRuleTBL_loginWizardStageTBL]
-GO
\ No newline at end of file
diff --git a/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/LoginWizardStageActivityTBL.sql b/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/LoginWizardStageActivityTBL.sql
deleted file mode 100644
index 5c8a60fc2..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/LoginWizardStageActivityTBL.sql
+++ /dev/null
@@ -1,25 +0,0 @@
-CREATE TABLE [elfh].[loginWizardStageActivityTBL](
- [loginWizardStageActivityId] [int] IDENTITY(1,1) NOT NULL,
- [loginWizardStageId] [int] NOT NULL,
- [userId] [int] NOT NULL,
- [activityDatetime] [datetimeoffset](7) NOT NULL,
- CONSTRAINT [PK_loginWizardStageActivityTBL] PRIMARY KEY CLUSTERED
-(
- [loginWizardStageActivityId] ASC
-)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 100) ON [PRIMARY]
-) ON [PRIMARY]
-GO
-
-ALTER TABLE [elfh].[loginWizardStageActivityTBL] WITH CHECK ADD CONSTRAINT [FK_loginWizardStageActivityTBL_loginWizardStageTBL] FOREIGN KEY([loginWizardStageId])
-REFERENCES [elfh].[loginWizardStageTBL] ([loginWizardStageId])
-GO
-
-ALTER TABLE [elfh].[loginWizardStageActivityTBL] CHECK CONSTRAINT [FK_loginWizardStageActivityTBL_loginWizardStageTBL]
-GO
-
-ALTER TABLE [elfh].[loginWizardStageActivityTBL] WITH CHECK ADD CONSTRAINT [FK_loginWizardStageActivityTBL_userTBL] FOREIGN KEY([userId])
-REFERENCES [hub].[User] ([Id])
-GO
-
-ALTER TABLE [elfh].[loginWizardStageActivityTBL] CHECK CONSTRAINT [FK_loginWizardStageActivityTBL_userTBL]
-GO
\ No newline at end of file
diff --git a/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/MedicalCouncilTBL.sql b/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/MedicalCouncilTBL.sql
deleted file mode 100644
index 1eee676b8..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/MedicalCouncilTBL.sql
+++ /dev/null
@@ -1,24 +0,0 @@
-CREATE TABLE [elfh].[medicalCouncilTBL](
- [medicalCouncilId] [int] NOT NULL,
- [medicalCouncilName] [nvarchar](50) NOT NULL,
- [medicalCouncilCode] [nvarchar](50) NOT NULL,
- [uploadPrefix] [nvarchar](3) NOT NULL,
- [includeOnCerts] [bit] NOT NULL,
- [deleted] [bit] NOT NULL,
- [amendUserID] [int] NOT NULL,
- [amendDate] [datetimeoffset](7) NOT NULL,
- CONSTRAINT [PK_medicalCouncilTBL] PRIMARY KEY CLUSTERED
-(
- [medicalCouncilId] ASC
-)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
-) ON [PRIMARY]
-GO
-
-ALTER TABLE [elfh].[medicalCouncilTBL] ADD CONSTRAINT [DF_medicalCouncilTBL_includeOnCerts] DEFAULT ((0)) FOR [includeOnCerts]
-GO
-
-ALTER TABLE [elfh].[medicalCouncilTBL] ADD CONSTRAINT [DF_medicalCouncilTBL_deleted] DEFAULT ((0)) FOR [deleted]
-GO
-
-ALTER TABLE [elfh].[medicalCouncilTBL] ADD CONSTRAINT [DF_medicalCouncilTBL_amendDate] DEFAULT (sysdatetimeoffset()) FOR [amendDate]
-GO
\ No newline at end of file
diff --git a/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/MergeUserTBL.sql b/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/MergeUserTBL.sql
deleted file mode 100644
index 510244acb..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/MergeUserTBL.sql
+++ /dev/null
@@ -1,12 +0,0 @@
-CREATE TABLE [elfh].[mergeUserTBL](
- [mergeUserId] [int] IDENTITY(1,1) NOT NULL,
- [fromUserId] [int] NOT NULL,
- [intoUserId] [int] NOT NULL,
- [amendUserId] [int] NOT NULL,
- [createdDatetime] [datetimeoffset](7) NOT NULL,
- CONSTRAINT [PK_mergeUserTBL] PRIMARY KEY CLUSTERED
-(
- [mergeUserId] ASC
-)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
-) ON [PRIMARY]
-GO
\ No newline at end of file
diff --git a/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/RegionTBL.sql b/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/RegionTBL.sql
deleted file mode 100644
index e3de79cde..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/RegionTBL.sql
+++ /dev/null
@@ -1,16 +0,0 @@
-CREATE TABLE [elfh].[regionTBL](
- [regionId] [int] NOT NULL,
- [regionName] [nvarchar](100) NOT NULL,
- [displayOrder] [int] NOT NULL,
- [deleted] [bit] NOT NULL,
- [amendUserID] [int] NOT NULL,
- [amendDate] [datetimeoffset](7) NOT NULL,
- CONSTRAINT [PK_regionTbl] PRIMARY KEY CLUSTERED
-(
- [regionId] ASC
-)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 100) ON [PRIMARY]
-) ON [PRIMARY]
-GO
-
-ALTER TABLE [elfh].[regionTBL] ADD CONSTRAINT [DF_regionTbl_deleted] DEFAULT ((0)) FOR [deleted]
-GO
\ No newline at end of file
diff --git a/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/SchoolTBL.sql b/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/SchoolTBL.sql
deleted file mode 100644
index b0ef70ea2..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/SchoolTBL.sql
+++ /dev/null
@@ -1,29 +0,0 @@
-CREATE TABLE [elfh].[schoolTBL](
- [schoolId] [int] IDENTITY(1,1) NOT NULL,
- [deaneryId] [int] NOT NULL,
- [specialtyId] [int] NOT NULL,
- [schoolName] [nvarchar](50) NOT NULL,
- [displayOrder] [int] NOT NULL,
- [deleted] [bit] NOT NULL,
- [amendUserID] [int] NOT NULL,
- [amendDate] [datetimeoffset](7) NOT NULL,
- CONSTRAINT [PK_schoolTBL] PRIMARY KEY CLUSTERED
-(
- [schoolId] ASC
-)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 100) ON [PRIMARY]
-) ON [PRIMARY]
-GO
-
-ALTER TABLE [elfh].[schoolTBL] WITH CHECK ADD CONSTRAINT [FK_schoolTBL_deaneryTBL] FOREIGN KEY([deaneryId])
-REFERENCES [elfh].[deaneryTBL] ([deaneryId])
-GO
-
-ALTER TABLE [elfh].[schoolTBL] CHECK CONSTRAINT [FK_schoolTBL_deaneryTBL]
-GO
-
-ALTER TABLE [elfh].[schoolTBL] WITH CHECK ADD CONSTRAINT [FK_schoolTBL_specialtyTBL] FOREIGN KEY([specialtyId])
-REFERENCES [elfh].[specialtyTBL] ([specialtyId])
-GO
-
-ALTER TABLE [elfh].[schoolTBL] CHECK CONSTRAINT [FK_schoolTBL_specialtyTBL]
-GO
\ No newline at end of file
diff --git a/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/SpecialtyTBL.sql b/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/SpecialtyTBL.sql
deleted file mode 100644
index dd2fcf677..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/SpecialtyTBL.sql
+++ /dev/null
@@ -1,19 +0,0 @@
-CREATE TABLE [elfh].[specialtyTBL](
- [specialtyId] [int] IDENTITY(1,1) NOT NULL,
- [specialtyName] [nvarchar](50) NOT NULL,
- [displayOrder] [int] NOT NULL,
- [deleted] [bit] NOT NULL,
- [amendUserID] [int] NOT NULL,
- [amendDate] [datetimeoffset](7) NOT NULL,
- CONSTRAINT [PK_specialtyTBL] PRIMARY KEY CLUSTERED
-(
- [specialtyId] ASC
-)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 100) ON [PRIMARY]
-) ON [PRIMARY]
-GO
-
-ALTER TABLE [elfh].[specialtyTBL] ADD CONSTRAINT [DF_specialty_deleted] DEFAULT ((0)) FOR [deleted]
-GO
-
-ALTER TABLE [elfh].[specialtyTBL] ADD CONSTRAINT [DF_specialtyTBL_amendDate] DEFAULT (sysdatetimeoffset()) FOR [amendDate]
-GO
\ No newline at end of file
diff --git a/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/StaffGroupTBL.sql b/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/StaffGroupTBL.sql
deleted file mode 100644
index e2ffb9bf0..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/StaffGroupTBL.sql
+++ /dev/null
@@ -1,17 +0,0 @@
-CREATE TABLE [elfh].[staffGroupTBL](
- [staffGroupId] [int] IDENTITY(1,1) NOT NULL,
- [staffGroupName] [nvarchar](50) NOT NULL,
- [displayOrder] [int] NOT NULL,
- [internalUsersOnly] [bit] NOT NULL,
- [deleted] [bit] NOT NULL,
- [amendUserID] [int] NOT NULL,
- [amendDate] [datetimeoffset](7) NOT NULL,
- CONSTRAINT [PK_staffGroupTBL] PRIMARY KEY CLUSTERED
-(
- [staffGroupId] ASC
-)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 100) ON [PRIMARY]
-) ON [PRIMARY]
-GO
-
-ALTER TABLE [elfh].[staffGroupTBL] ADD CONSTRAINT [DF_staffGroupTBL_internalUsersOnly] DEFAULT ((0)) FOR [internalUsersOnly]
-GO
\ No newline at end of file
diff --git a/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/SystemSettingTBL.sql b/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/SystemSettingTBL.sql
deleted file mode 100644
index 8ead0a47c..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/SystemSettingTBL.sql
+++ /dev/null
@@ -1,24 +0,0 @@
-CREATE TABLE [elfh].[systemSettingTBL](
- [systemSettingId] [int] NOT NULL,
- [systemSettingName] [nvarchar](50) NOT NULL,
- [intValue] [int] NULL,
- [textValue] [nvarchar](255) NULL,
- [booleanValue] [bit] NULL,
- [dateValue] [datetimeoffset](7) NULL,
- [deleted] [bit] NOT NULL,
- [amendUserId] [int] NOT NULL,
- [amendDate] [datetimeoffset](7) NOT NULL,
- CONSTRAINT [PK_systemSettingsTBL] PRIMARY KEY CLUSTERED
-(
- [systemSettingId] ASC
-)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 100) ON [PRIMARY]
-) ON [PRIMARY]
-GO
-
-ALTER TABLE [elfh].[systemSettingTBL] ADD DEFAULT ((0)) FOR [deleted]
-GO
-
-ALTER TABLE [elfh].[systemSettingTBL] ADD DEFAULT (sysdatetimeoffset()) FOR [amendDate]
-GO
-
-
diff --git a/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/TenantSmtpTBL.sql b/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/TenantSmtpTBL.sql
deleted file mode 100644
index 390c1a123..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/TenantSmtpTBL.sql
+++ /dev/null
@@ -1,16 +0,0 @@
-CREATE TABLE [elfh].[tenantSmtpTBL](
- [tenantId] [int] NOT NULL,
- [deliveryMethod] [nvarchar](128) NOT NULL,
- [pickupDirectoryLocation] [nvarchar](256) NULL,
- [from] [nvarchar](256) NULL,
- [userName] [nvarchar](256) NULL,
- [password] [nvarchar](256) NULL,
- [enableSsl] [bit] NULL,
- [host] [nvarchar](256) NULL,
- [port] [int] NULL,
- [active] [bit] NOT NULL,
- [deleted] [bit] NOT NULL,
- [amendUserId] [int] NOT NULL,
- [amendDate] [datetimeoffset](7) NOT NULL
-) ON [PRIMARY]
-GO
diff --git a/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/TenantTBL.sql b/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/TenantTBL.sql
deleted file mode 100644
index 47fb44f17..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/TenantTBL.sql
+++ /dev/null
@@ -1,43 +0,0 @@
-CREATE TABLE [elfh].[tenantTBL](
- [tenantId] [int] NOT NULL,
- [tenantCode] [nvarchar](20) NOT NULL,
- [tenantName] [nvarchar](64) NOT NULL,
- [tenantDescription] [nvarchar](1024) NOT NULL,
- [showFullCatalogInfoMessageInd] [bit] NOT NULL,
- [catalogUrl] [nvarchar](256) NOT NULL,
- [quickStartGuideUrl] [nvarchar](1024) NULL,
- [supportFormUrl] [nvarchar](1024) NULL,
- [liveChatStatus] [int] NOT NULL,
- [liveChatSnippet] [nvarchar](2048) NULL,
- [myElearningDefaultView] [int] NOT NULL,
- [preLoginCatalogueDefaultView] [int] NOT NULL,
- [postLoginCatalogueDefaultView] [int] NOT NULL,
- [authSignInUrlRelative] [nvarchar](1024) NULL,
- [authSignOutUrlRelative] [nvarchar](1024) NULL,
- [authSecret] [uniqueidentifier] NOT NULL,
- [deleted] [bit] NOT NULL,
- [amendUserId] [int] NOT NULL,
- [amendDate] [datetimeoffset](7) NOT NULL,
- CONSTRAINT [PK_tenantTBL] PRIMARY KEY CLUSTERED
-(
- [tenantId] ASC
-)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
-) ON [PRIMARY]
-GO
-
-ALTER TABLE [elfh].[tenantTBL] ADD DEFAULT ((0)) FOR [liveChatStatus]
-GO
-
-ALTER TABLE [elfh].[tenantTBL] ADD DEFAULT ((0)) FOR [myElearningDefaultView]
-GO
-
-ALTER TABLE [elfh].[tenantTBL] ADD DEFAULT ((0)) FOR [preLoginCatalogueDefaultView]
-GO
-
-ALTER TABLE [elfh].[tenantTBL] ADD DEFAULT ((0)) FOR [postLoginCatalogueDefaultView]
-GO
-
-ALTER TABLE [elfh].[tenantTBL] ADD DEFAULT (newid()) FOR [authSecret]
-GO
-
-
diff --git a/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/TenantUrlTBL.sql b/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/TenantUrlTBL.sql
deleted file mode 100644
index f1698eafa..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/TenantUrlTBL.sql
+++ /dev/null
@@ -1,24 +0,0 @@
-CREATE TABLE [elfh].[tenantUrlTBL](
- [tenantUrlId] [int] IDENTITY(1,1) NOT NULL,
- [tenantId] [int] NOT NULL,
- [urlHostName] [nvarchar](128) NOT NULL,
- [useHostForAuth] [bit] NOT NULL,
- [deleted] [bit] NOT NULL,
- [amendUserID] [int] NOT NULL,
- [amendDate] [datetimeoffset](7) NOT NULL,
- CONSTRAINT [PK_tenantUrlTBL] PRIMARY KEY CLUSTERED
-(
- [tenantUrlId] ASC
-)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
-) ON [PRIMARY]
-GO
-
-ALTER TABLE [elfh].[tenantUrlTBL] ADD DEFAULT ((0)) FOR [useHostForAuth]
-GO
-
-ALTER TABLE [elfh].[tenantUrlTBL] WITH CHECK ADD CONSTRAINT [FK_tenantUrlTBL_tenantTBL] FOREIGN KEY([tenantId])
-REFERENCES [elfh].[tenantTBL] ([tenantId])
-GO
-
-ALTER TABLE [elfh].[tenantUrlTBL] CHECK CONSTRAINT [FK_tenantUrlTBL_tenantTBL]
-GO
\ No newline at end of file
diff --git a/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/TermsAndConditionsTBL.sql b/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/TermsAndConditionsTBL.sql
deleted file mode 100644
index c2e581994..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/TermsAndConditionsTBL.sql
+++ /dev/null
@@ -1,27 +0,0 @@
-CREATE TABLE [elfh].[termsAndConditionsTBL](
- [termsAndConditionsId] [int] IDENTITY(1,1) NOT NULL,
- [createdDate] [datetimeoffset](7) NOT NULL,
- [description] [nvarchar](512) NOT NULL,
- [details] [ntext] NOT NULL,
- [tenantId] [int] NOT NULL,
- [active] [bit] NOT NULL,
- [reportable] [bit] NOT NULL,
- [deleted] [bit] NOT NULL,
- [amendUserID] [int] NOT NULL,
- [amendDate] [datetimeoffset](7) NOT NULL,
- CONSTRAINT [PK_termsAndConditions] PRIMARY KEY CLUSTERED
-(
- [termsAndConditionsId] ASC
-)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 100) ON [PRIMARY]
-) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
-GO
-
-ALTER TABLE [elfh].[termsAndConditionsTBL] ADD DEFAULT ((1)) FOR [reportable]
-GO
-
-ALTER TABLE [elfh].[termsAndConditionsTBL] WITH CHECK ADD CONSTRAINT [FK_termsAndConditionsTBL_tenantTBL] FOREIGN KEY([tenantId])
-REFERENCES [elfh].[tenantTBL] ([tenantId])
-GO
-
-ALTER TABLE [elfh].[termsAndConditionsTBL] CHECK CONSTRAINT [FK_termsAndConditionsTBL_tenantTBL]
-GO
\ No newline at end of file
diff --git a/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/UserAdminLocationTBL.sql b/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/UserAdminLocationTBL.sql
deleted file mode 100644
index 4c88913e6..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/UserAdminLocationTBL.sql
+++ /dev/null
@@ -1,42 +0,0 @@
-
-CREATE TABLE [elfh].[userAdminLocationTBL](
- [userId] [int] NOT NULL,
- [adminLocationId] [int] NOT NULL,
- [deleted] [bit] NOT NULL,
- [amendUserId] [int] NOT NULL,
- [amendDate] [datetimeoffset](7) NOT NULL,
- [createdUserId] [int] NOT NULL,
- [createdDate] [datetimeoffset](7) NOT NULL,
-PRIMARY KEY CLUSTERED
-(
- [adminLocationId] ASC,
- [userId] ASC,
- [deleted] ASC
-)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
-) ON [PRIMARY]
-GO
-
-ALTER TABLE [elfh].[userAdminLocationTBL] ADD DEFAULT ((0)) FOR [deleted]
-GO
-
-ALTER TABLE [elfh].[userAdminLocationTBL] ADD DEFAULT (sysdatetimeoffset()) FOR [amendDate]
-GO
-
-ALTER TABLE [elfh].[userAdminLocationTBL] ADD DEFAULT (sysdatetimeoffset()) FOR [createdDate]
-GO
-
-ALTER TABLE [elfh].[userAdminLocationTBL] WITH CHECK ADD CONSTRAINT [FK_userAdminLocationTBL_locationTBL] FOREIGN KEY([adminLocationId])
-REFERENCES [elfh].[locationTBL] ([locationId])
-GO
-
-ALTER TABLE [elfh].[userAdminLocationTBL] CHECK CONSTRAINT [FK_userAdminLocationTBL_locationTBL]
-GO
-
-ALTER TABLE [elfh].[userAdminLocationTBL] WITH CHECK ADD CONSTRAINT [FK_userAdminLocationTBL_userTBL] FOREIGN KEY([userId])
-REFERENCES [hub].[user] ([Id])
-GO
-
-ALTER TABLE [elfh].[userAdminLocationTBL] CHECK CONSTRAINT [FK_userAdminLocationTBL_userTBL]
-GO
-
-
diff --git a/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/UserAttributeTBL.sql b/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/UserAttributeTBL.sql
deleted file mode 100644
index bf9969af6..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/UserAttributeTBL.sql
+++ /dev/null
@@ -1,37 +0,0 @@
-CREATE TABLE [elfh].[userAttributeTBL](
- [userAttributeId] [int] IDENTITY(1,1) NOT NULL,
- [userId] [int] NOT NULL,
- [attributeId] [int] NOT NULL,
- [intValue] [int] NULL,
- [textValue] [nvarchar](255) NULL,
- [booleanValue] [bit] NULL,
- [dateValue] [datetimeoffset](7) NULL,
- [deleted] [bit] NOT NULL,
- [amendUserId] [int] NOT NULL,
- [amendDate] [datetimeoffset](7) NOT NULL,
- CONSTRAINT [PK_userAttributeTBL] PRIMARY KEY CLUSTERED
-(
- [userAttributeId] ASC
-)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 100) ON [PRIMARY]
-) ON [PRIMARY]
-GO
-
-ALTER TABLE [elfh].[userAttributeTBL] ADD DEFAULT ((0)) FOR [deleted]
-GO
-
-ALTER TABLE [elfh].[userAttributeTBL] ADD DEFAULT (sysdatetimeoffset()) FOR [amendDate]
-GO
-
-ALTER TABLE [elfh].[userAttributeTBL] WITH CHECK ADD CONSTRAINT [FK_userAttributeTBL_attributeId] FOREIGN KEY([attributeId])
-REFERENCES [elfh].[attributeTBL] ([attributeId])
-GO
-
-ALTER TABLE [elfh].[userAttributeTBL] CHECK CONSTRAINT [FK_userAttributeTBL_attributeId]
-GO
-
-ALTER TABLE [elfh].[userAttributeTBL] WITH CHECK ADD CONSTRAINT [FK_userAttributeTBL_userId] FOREIGN KEY([userId])
-REFERENCES [hub].[User] ([Id])
-GO
-
-ALTER TABLE [elfh].[userAttributeTBL] CHECK CONSTRAINT [FK_userAttributeTBL_userId]
-GO
\ No newline at end of file
diff --git a/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/UserEmploymentReferenceTBL.sql b/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/UserEmploymentReferenceTBL.sql
deleted file mode 100644
index 66bc74d7f..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/UserEmploymentReferenceTBL.sql
+++ /dev/null
@@ -1,31 +0,0 @@
-CREATE TABLE [elfh].[userEmploymentReferenceTBL](
- [userEmploymentReferenceId] [int] IDENTITY(1,1) NOT NULL,
- [employmentReferenceTypeId] [int] NOT NULL,
- [userEmploymentId] [int] NOT NULL,
- [referenceValue] [nvarchar](100) NOT NULL,
- [deleted] [bit] NOT NULL,
- [amendUserId] [int] NOT NULL,
- [amendDate] [datetimeoffset](7) NOT NULL,
- CONSTRAINT [PK_userEmploymentReferenceTBL] PRIMARY KEY CLUSTERED
-(
- [userEmploymentReferenceId] ASC
-)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
-) ON [PRIMARY]
-GO
-
-ALTER TABLE [elfh].[userEmploymentReferenceTBL] ADD CONSTRAINT [DF_userEmploymentReferenceTBL_deleted] DEFAULT ((0)) FOR [deleted]
-GO
-
-ALTER TABLE [elfh].[userEmploymentReferenceTBL] WITH CHECK ADD CONSTRAINT [FK_userEmploymentReferenceTBL_employmentReferenceTypeTBL] FOREIGN KEY([employmentReferenceTypeId])
-REFERENCES [elfh].[employmentReferenceTypeTBL] ([EmploymentReferenceTypeId])
-GO
-
-ALTER TABLE [elfh].[userEmploymentReferenceTBL] CHECK CONSTRAINT [FK_userEmploymentReferenceTBL_employmentReferenceTypeTBL]
-GO
-
-ALTER TABLE [elfh].[userEmploymentReferenceTBL] WITH CHECK ADD CONSTRAINT [FK_userEmploymentReferenceTBL_userEmploymentTBL] FOREIGN KEY([userEmploymentId])
-REFERENCES [elfh].[userEmploymentTBL] ([userEmploymentId])
-GO
-
-ALTER TABLE [elfh].[userEmploymentReferenceTBL] CHECK CONSTRAINT [FK_userEmploymentReferenceTBL_userEmploymentTBL]
-GO
\ No newline at end of file
diff --git a/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/UserEmploymentResponsibilityTBL.sql b/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/UserEmploymentResponsibilityTBL.sql
deleted file mode 100644
index 546aead55..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/UserEmploymentResponsibilityTBL.sql
+++ /dev/null
@@ -1,15 +0,0 @@
-CREATE TABLE [elfh].[userEmploymentResponsibilityTBL](
- [userEmploymentResponsibilityId] [int] IDENTITY(1,1) NOT NULL,
- [userEmploymentId] [int] NOT NULL,
- [additionalResponsibilityId] [int] NOT NULL,
- [deleted] [bit] NOT NULL,
- [amendUserId] [int] NOT NULL,
-PRIMARY KEY CLUSTERED
-(
- [userEmploymentResponsibilityId] ASC
-)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
-) ON [PRIMARY]
-GO
-
-ALTER TABLE [elfh].[userEmploymentResponsibilityTBL] ADD DEFAULT ((0)) FOR [deleted]
-GO
\ No newline at end of file
diff --git a/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/UserEmploymentTBL.sql b/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/UserEmploymentTBL.sql
deleted file mode 100644
index f43db0eec..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/UserEmploymentTBL.sql
+++ /dev/null
@@ -1,85 +0,0 @@
-
-CREATE TABLE [elfh].[userEmploymentTBL](
- [userEmploymentId] [int] IDENTITY(1,1) NOT NULL,
- [userId] [int] NOT NULL,
- [jobRoleId] [int] NULL,
- [specialtyId] [int] NULL,
- [gradeId] [int] NULL,
- [schoolId] [int] NULL,
- [locationId] [int] NOT NULL,
- [medicalCouncilId] [int] NULL,
- [medicalCouncilNo] [nvarchar](50) NULL,
- [startDate] [datetimeoffset](7) NULL,
- [endDate] [datetimeoffset](7) NULL,
- [deleted] [bit] NOT NULL,
- [archived] [bit] NOT NULL,
- [amendUserId] [int] NOT NULL,
- [amendDate] [datetimeoffset](7) NOT NULL,
- CONSTRAINT [PK_userEmploymentTBL] PRIMARY KEY CLUSTERED
-(
- [userEmploymentId] ASC
-)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 100) ON [PRIMARY]
-) ON [PRIMARY]
-GO
-
-ALTER TABLE [elfh].[userEmploymentTBL] ADD CONSTRAINT [DF_userEmploymentTBL_deleted] DEFAULT ((0)) FOR [deleted]
-GO
-
-ALTER TABLE [elfh].[userEmploymentTBL] ADD CONSTRAINT [DF_userEmploymentTBL_archived] DEFAULT ((0)) FOR [archived]
-GO
-
-ALTER TABLE [elfh].[userEmploymentTBL] WITH CHECK ADD CONSTRAINT [FK_userEmploymentTBL_gradeTBL] FOREIGN KEY([gradeId])
-REFERENCES [elfh].[gradeTBL] ([gradeId])
-GO
-
-ALTER TABLE [elfh].[userEmploymentTBL] CHECK CONSTRAINT [FK_userEmploymentTBL_gradeTBL]
-GO
-
-ALTER TABLE [elfh].[userEmploymentTBL] WITH CHECK ADD CONSTRAINT [FK_userEmploymentTBL_jobRoleTBL] FOREIGN KEY([jobRoleId])
-REFERENCES [elfh].[jobRoleTBL] ([jobRoleId])
-GO
-
-ALTER TABLE [elfh].[userEmploymentTBL] CHECK CONSTRAINT [FK_userEmploymentTBL_jobRoleTBL]
-GO
-
-ALTER TABLE [elfh].[userEmploymentTBL] WITH CHECK ADD CONSTRAINT [FK_userEmploymentTBL_locationTBL] FOREIGN KEY([locationId])
-REFERENCES [elfh].[locationTBL] ([locationId])
-GO
-
-ALTER TABLE [elfh].[userEmploymentTBL] CHECK CONSTRAINT [FK_userEmploymentTBL_locationTBL]
-GO
-
-ALTER TABLE [elfh].[userEmploymentTBL] WITH CHECK ADD CONSTRAINT [FK_userEmploymentTBL_medicalCouncilTBL] FOREIGN KEY([medicalCouncilId])
-REFERENCES [elfh].[medicalCouncilTBL] ([medicalCouncilId])
-GO
-
-ALTER TABLE [elfh].[userEmploymentTBL] CHECK CONSTRAINT [FK_userEmploymentTBL_medicalCouncilTBL]
-GO
-
-ALTER TABLE [elfh].[userEmploymentTBL] WITH CHECK ADD CONSTRAINT [FK_userEmploymentTBL_schoolTBL] FOREIGN KEY([schoolId])
-REFERENCES [elfh].[schoolTBL] ([schoolId])
-GO
-
-ALTER TABLE [elfh].[userEmploymentTBL] CHECK CONSTRAINT [FK_userEmploymentTBL_schoolTBL]
-GO
-
-ALTER TABLE [elfh].[userEmploymentTBL] WITH CHECK ADD CONSTRAINT [FK_userEmploymentTBL_specialtyTBL] FOREIGN KEY([specialtyId])
-REFERENCES [elfh].[specialtyTBL] ([specialtyId])
-GO
-
-ALTER TABLE [elfh].[userEmploymentTBL] CHECK CONSTRAINT [FK_userEmploymentTBL_specialtyTBL]
-GO
-
-ALTER TABLE [elfh].[userEmploymentTBL] WITH CHECK ADD CONSTRAINT [FK_userEmploymentTBL_userTBL] FOREIGN KEY([userId])
-REFERENCES [hub].[User] ([Id])
-GO
-
-ALTER TABLE [elfh].[userEmploymentTBL] CHECK CONSTRAINT [FK_userEmploymentTBL_userTBL]
-GO
-
-ALTER TABLE [elfh].[userEmploymentTBL] WITH CHECK ADD CONSTRAINT [FK_userEmploymentTBL_userTBL_AmendUser] FOREIGN KEY([amendUserId])
-REFERENCES [hub].[User] ([Id])
-GO
-
-ALTER TABLE [elfh].[userEmploymentTBL] CHECK CONSTRAINT [FK_userEmploymentTBL_userTBL_AmendUser]
-GO
\ No newline at end of file
diff --git a/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/UserGroupReporterTBL.sql b/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/UserGroupReporterTBL.sql
deleted file mode 100644
index 8794a0a64..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/UserGroupReporterTBL.sql
+++ /dev/null
@@ -1,30 +0,0 @@
-CREATE TABLE [elfh].[userGroupReporterTBL](
- [userGroupReporterId] [int] IDENTITY(1,1) NOT FOR REPLICATION NOT NULL,
- [userId] [int] NOT NULL,
- [userGroupId] [int] NOT NULL,
- [deleted] [bit] NOT NULL,
- [amendUserId] [int] NOT NULL,
- [amendDate] [datetimeoffset](7) NOT NULL,
- CONSTRAINT [PK_userGroupReporterTBL] PRIMARY KEY CLUSTERED
-(
- [userGroupReporterId] ASC
-)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 100) ON [PRIMARY]
-) ON [PRIMARY]
-GO
-
-ALTER TABLE [elfh].[userGroupReporterTBL] ADD DEFAULT (sysdatetimeoffset()) FOR [amendDate]
-GO
-
-ALTER TABLE [elfh].[userGroupReporterTBL] WITH CHECK ADD CONSTRAINT [FK_userGroupReporterTBL_userGroupTBL] FOREIGN KEY([userGroupId])
-REFERENCES [hub].[userGroup] ([Id])
-GO
-
-ALTER TABLE [elfh].[userGroupReporterTBL] CHECK CONSTRAINT [FK_userGroupReporterTBL_userGroupTBL]
-GO
-
-ALTER TABLE [elfh].[userGroupReporterTBL] WITH CHECK ADD CONSTRAINT [FK_userGroupReporterTBL_userTBL] FOREIGN KEY([userId])
-REFERENCES [hub].[user] ([Id])
-GO
-
-ALTER TABLE [elfh].[userGroupReporterTBL] CHECK CONSTRAINT [FK_userGroupReporterTBL_userTBL]
-GO
\ No newline at end of file
diff --git a/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/UserGroupTypeInputValidationTBL.sql b/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/UserGroupTypeInputValidationTBL.sql
deleted file mode 100644
index dc2fd76dd..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/UserGroupTypeInputValidationTBL.sql
+++ /dev/null
@@ -1,39 +0,0 @@
-CREATE TABLE [elfh].[userGroupTypeInputValidationTBL](
- [userGroupTypeInputValidationId] [int] IDENTITY(1,1) NOT NULL,
- [userGroupId] [int] NOT NULL,
- [userGroupTypePrefix] [nvarchar](10) NOT NULL,
- [userGroupTypeId] [int] NOT NULL,
- [validationTextValue] [nvarchar](1000) NOT NULL,
- [validationMethod] [int] NOT NULL,
- [deleted] [bit] NOT NULL,
- [amendUserId] [int] NOT NULL,
- [amendDate] [datetimeoffset](7) NOT NULL,
- [createdUserId] [int] NOT NULL,
- [createdDate] [datetimeoffset](7) NOT NULL,
-PRIMARY KEY CLUSTERED
-(
- [userGroupTypeInputValidationId] ASC
-)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY],
- CONSTRAINT [UQ_userGroupTypeInputValidationTBL_userGroupId_validationTextValue] UNIQUE NONCLUSTERED
-(
- [userGroupId] ASC,
- [validationTextValue] ASC
-)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
-) ON [PRIMARY]
-GO
-
-ALTER TABLE [elfh].[userGroupTypeInputValidationTBL] ADD DEFAULT (N'USR TYP:') FOR [userGroupTypePrefix]
-GO
-
-ALTER TABLE [elfh].[userGroupTypeInputValidationTBL] ADD DEFAULT ((0)) FOR [deleted]
-GO
-
-ALTER TABLE [elfh].[userGroupTypeInputValidationTBL] ADD DEFAULT (sysdatetimeoffset()) FOR [amendDate]
-GO
-
-ALTER TABLE [elfh].[userGroupTypeInputValidationTBL] ADD DEFAULT (sysdatetimeoffset()) FOR [createdDate]
-GO
-
-ALTER TABLE [elfh].[userGroupTypeInputValidationTBL] WITH CHECK ADD CONSTRAINT [FK_userGroupTypeInputValidationTBL_amendUserTBL] FOREIGN KEY([amendUserId])
-REFERENCES [hub].[User] ([Id])
-GO
\ No newline at end of file
diff --git a/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/UserHistoryTBL.sql b/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/UserHistoryTBL.sql
deleted file mode 100644
index 12a25fc81..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/UserHistoryTBL.sql
+++ /dev/null
@@ -1,25 +0,0 @@
-CREATE TABLE [elfh].[userHistoryTBL](
- [userHistoryId] [int] IDENTITY(1,1) NOT NULL,
- [userHistoryTypeId] [int] NOT NULL,
- [userId] [int] NOT NULL,
- [createdDate] [datetimeoffset](7) NOT NULL,
- [tenantId] [int] NOT NULL,
-PRIMARY KEY CLUSTERED
-(
- [userHistoryId] ASC
-)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 100) ON [PRIMARY]
-) ON [PRIMARY]
-GO
-
-ALTER TABLE [elfh].[userHistoryTBL] ADD DEFAULT (sysdatetimeoffset()) FOR [createdDate]
-GO
-
-ALTER TABLE [elfh].[userHistoryTBL] ADD DEFAULT ((0)) FOR [tenantId]
-GO
-
-ALTER TABLE [elfh].[userHistoryTBL] WITH CHECK ADD CONSTRAINT [FK_userHistoryTBL_userHistoryTypeTBL] FOREIGN KEY([userHistoryTypeId])
-REFERENCES [elfh].[userHistoryTypeTBL] ([UserHistoryTypeId])
-GO
-
-ALTER TABLE [elfh].[userHistoryTBL] CHECK CONSTRAINT [FK_userHistoryTBL_userHistoryTypeTBL]
-GO
\ No newline at end of file
diff --git a/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/UserPasswordValidationTokenTBL.sql b/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/UserPasswordValidationTokenTBL.sql
deleted file mode 100644
index 7beed21ce..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/UserPasswordValidationTokenTBL.sql
+++ /dev/null
@@ -1,33 +0,0 @@
-CREATE TABLE [elfh].[userPasswordValidationTokenTBL](
- [userPasswordValidationTokenId] [int] IDENTITY(1,1) NOT NULL,
- [hashedToken] [nvarchar](128) NOT NULL,
- [salt] [nvarchar](128) NOT NULL,
- [lookup] [nvarchar](128) NOT NULL,
- [expiry] [datetimeoffset](7) NOT NULL,
- [tenantId] [int] NOT NULL,
- [userId] [int] NOT NULL,
- [createdUserId] [int] NOT NULL,
- [createdDate] [datetimeoffset](7) NOT NULL,
-PRIMARY KEY CLUSTERED
-(
- [userPasswordValidationTokenId] ASC
-)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
-) ON [PRIMARY]
-GO
-
-ALTER TABLE [elfh].[userPasswordValidationTokenTBL] ADD DEFAULT (sysdatetimeoffset()) FOR [createdDate]
-GO
-
-ALTER TABLE [elfh].[userPasswordValidationTokenTBL] WITH CHECK ADD CONSTRAINT [FK_userPasswordValidationTokenTBL_tenantTBL] FOREIGN KEY([tenantId])
-REFERENCES [elfh].[tenantTBL] ([tenantId])
-GO
-
-ALTER TABLE [elfh].[userPasswordValidationTokenTBL] CHECK CONSTRAINT [FK_userPasswordValidationTokenTBL_tenantTBL]
-GO
-
-ALTER TABLE [elfh].[userPasswordValidationTokenTBL] WITH CHECK ADD CONSTRAINT [FK_userPasswordValidationTokenTBL_userTBL] FOREIGN KEY([userId])
-REFERENCES [hub].[User] ([Id])
-GO
-
-ALTER TABLE [elfh].[userPasswordValidationTokenTBL] CHECK CONSTRAINT [FK_userPasswordValidationTokenTBL_userTBL]
-GO
\ No newline at end of file
diff --git a/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/UserReportingUserTBL.sql b/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/UserReportingUserTBL.sql
deleted file mode 100644
index a96df3713..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/UserReportingUserTBL.sql
+++ /dev/null
@@ -1,31 +0,0 @@
-CREATE TABLE [elfh].[userReportingUserTBL](
- [userReportingUserId] [int] IDENTITY(1,1) NOT NULL,
- [userId] [int] NOT NULL,
- [reportingUserId] [int] NOT NULL,
- [reportable] [bit] NOT NULL,
- [Deleted] [bit] NOT NULL,
- [AmendUserID] [int] NOT NULL,
- [AmendDate] [datetimeoffset](7) NOT NULL,
- CONSTRAINT [PK_userReportingUser] PRIMARY KEY CLUSTERED
-(
- [userReportingUserId] ASC
-)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
-) ON [PRIMARY]
-GO
-
-ALTER TABLE [elfh].[userReportingUserTBL] ADD DEFAULT ((1)) FOR [reportable]
-GO
-
-ALTER TABLE [elfh].[userReportingUserTBL] WITH CHECK ADD CONSTRAINT [FK_userReportingUser_reportingUser] FOREIGN KEY([reportingUserId])
-REFERENCES [hub].[user] ([Id])
-GO
-
-ALTER TABLE [elfh].[userReportingUserTBL] CHECK CONSTRAINT [FK_userReportingUser_reportingUser]
-GO
-
-ALTER TABLE [elfh].[userReportingUserTBL] WITH CHECK ADD CONSTRAINT [FK_userReportingUser_user] FOREIGN KEY([userId])
-REFERENCES [hub].[user] ([Id])
-GO
-
-ALTER TABLE [elfh].[userReportingUserTBL] CHECK CONSTRAINT [FK_userReportingUser_user]
-GO
\ No newline at end of file
diff --git a/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/UserRoleUpgradeTBL.sql b/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/UserRoleUpgradeTBL.sql
deleted file mode 100644
index c5f00d25d..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/UserRoleUpgradeTBL.sql
+++ /dev/null
@@ -1,35 +0,0 @@
-CREATE TABLE [elfh].[userRoleUpgradeTBL](
- [userRoleUpgradeId] [int] IDENTITY(1,1) NOT NULL,
- [userId] [int] NOT NULL,
- [emailAddress] [nvarchar](100) NOT NULL,
- [upgradeDate] [datetimeoffset](7) NULL,
- [deleted] [bit] NOT NULL,
- [createUserId] [int] NOT NULL,
- [createDate] [datetimeoffset](7) NOT NULL,
- [amendUserId] [int] NOT NULL,
- [amendDate] [datetimeoffset](7) NOT NULL,
- [userHistoryTypeId] [int] NOT NULL,
- CONSTRAINT [PK_userRoleUpgrade] PRIMARY KEY CLUSTERED
-(
- [userRoleUpgradeId] ASC
-)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
-) ON [PRIMARY]
-GO
-
-ALTER TABLE [elfh].[userRoleUpgradeTBL] ADD DEFAULT ((12)) FOR [userHistoryTypeId]
-GO
-
-ALTER TABLE [elfh].[userRoleUpgradeTBL] WITH CHECK ADD CONSTRAINT [FK_userRoleUpgradeTBL_userHistoryTypeTBL] FOREIGN KEY([userHistoryTypeId])
-REFERENCES [elfh].[userHistoryTypeTBL] ([UserHistoryTypeId])
-GO
-
-ALTER TABLE [elfh].[userRoleUpgradeTBL] CHECK CONSTRAINT [FK_userRoleUpgradeTBL_userHistoryTypeTBL]
-GO
-
-ALTER TABLE [elfh].[userRoleUpgradeTBL] WITH CHECK ADD CONSTRAINT [FK_userRoleUpgradeTbl_userTbl] FOREIGN KEY([userId])
-REFERENCES [hub].[User] ([Id])
-GO
-
-ALTER TABLE [elfh].[userRoleUpgradeTBL] CHECK CONSTRAINT [FK_userRoleUpgradeTbl_userTbl]
-GO
-
diff --git a/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/UserTermsAndConditionsTBL.sql b/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/UserTermsAndConditionsTBL.sql
deleted file mode 100644
index 66e86902d..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/UserTermsAndConditionsTBL.sql
+++ /dev/null
@@ -1,28 +0,0 @@
-CREATE TABLE [elfh].[userTermsAndConditionsTBL](
- [userTermsAndConditionsId] [int] IDENTITY(1,1) NOT NULL,
- [termsAndConditionsId] [int] NOT NULL,
- [userId] [int] NOT NULL,
- [acceptanceDate] [datetimeoffset](7) NOT NULL,
- [deleted] [bit] NOT NULL,
- [amendUserID] [int] NOT NULL,
- [amendDate] [datetimeoffset](7) NOT NULL,
- CONSTRAINT [PK_userTermsAndConditions] PRIMARY KEY CLUSTERED
-(
- [userTermsAndConditionsId] ASC
-)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 100) ON [PRIMARY]
-) ON [PRIMARY]
-GO
-
-ALTER TABLE [elfh].[userTermsAndConditionsTBL] WITH CHECK ADD CONSTRAINT [FK_userTermsAndConditionsTBL_portalUserTBL] FOREIGN KEY([userId])
-REFERENCES [hub].[User] ([Id])
-GO
-
-ALTER TABLE [elfh].[userTermsAndConditionsTBL] CHECK CONSTRAINT [FK_userTermsAndConditionsTBL_portalUserTBL]
-GO
-
-ALTER TABLE [elfh].[userTermsAndConditionsTBL] WITH CHECK ADD CONSTRAINT [FK_userTermsAndConditionsTBL_termsAndConditionsTBL] FOREIGN KEY([termsAndConditionsId])
-REFERENCES [elfh].[termsAndConditionsTBL] ([termsAndConditionsId])
-GO
-
-ALTER TABLE [elfh].[userTermsAndConditionsTBL] CHECK CONSTRAINT [FK_userTermsAndConditionsTBL_termsAndConditionsTBL]
-GO
\ No newline at end of file
diff --git a/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/locationTypeTBL.sql b/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/locationTypeTBL.sql
deleted file mode 100644
index cf10e09b5..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/locationTypeTBL.sql
+++ /dev/null
@@ -1,34 +0,0 @@
-CREATE TABLE [elfh].[locationTypeTBL](
- [locationTypeID] [int] IDENTITY(1,1) NOT NULL,
- [locationType] [nvarchar](50) NOT NULL,
- [countryId] [int] NULL,
- [healthService] [bit] NOT NULL,
- [healthBoard] [bit] NOT NULL,
- [primaryTrust] [bit] NOT NULL,
- [secondaryTrust] [bit] NOT NULL,
- CONSTRAINT [PK_locationType] PRIMARY KEY CLUSTERED
-(
- [locationTypeID] ASC
-)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 100) ON [PRIMARY]
-) ON [PRIMARY]
-GO
-
-ALTER TABLE [elfh].[locationTypeTBL] ADD DEFAULT ((0)) FOR [healthService]
-GO
-
-ALTER TABLE [elfh].[locationTypeTBL] ADD DEFAULT ((0)) FOR [healthBoard]
-GO
-
-ALTER TABLE [elfh].[locationTypeTBL] ADD DEFAULT ((0)) FOR [primaryTrust]
-GO
-
-ALTER TABLE [elfh].[locationTypeTBL] ADD DEFAULT ((0)) FOR [secondaryTrust]
-GO
-
-ALTER TABLE [elfh].[locationTypeTBL] WITH CHECK ADD CONSTRAINT [FK_locationTypeTBL_countryTBL] FOREIGN KEY([countryId])
-REFERENCES [elfh].[countryTBL] ([countryId])
-GO
-
-ALTER TABLE [elfh].[locationTypeTBL] CHECK CONSTRAINT [FK_locationTypeTBL_countryTBL]
-GO
-
diff --git a/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/loginWizardStageTBL.sql b/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/loginWizardStageTBL.sql
deleted file mode 100644
index ae704a35d..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/loginWizardStageTBL.sql
+++ /dev/null
@@ -1,13 +0,0 @@
-CREATE TABLE [elfh].[loginWizardStageTBL](
- [loginWizardStageId] [int] NOT NULL,
- [description] [nvarchar](128) NOT NULL,
- [reasonDisplayText] [nvarchar](1024) NOT NULL,
- [deleted] [bit] NOT NULL,
- [amendUserId] [int] NOT NULL,
- [amendDate] [datetimeoffset](7) NOT NULL,
- CONSTRAINT [PK_loginWizardStageTBL] PRIMARY KEY CLUSTERED
-(
- [loginWizardStageId] ASC
-)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 100) ON [PRIMARY]
-) ON [PRIMARY]
-GO
diff --git a/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/userHistoryTypeTBL.sql b/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/userHistoryTypeTBL.sql
deleted file mode 100644
index 95e58af92..000000000
--- a/WebAPI/LearningHub.Nhs.Database/Tables/Elfh/userHistoryTypeTBL.sql
+++ /dev/null
@@ -1,9 +0,0 @@
-CREATE TABLE [elfh].[userHistoryTypeTBL](
- [UserHistoryTypeId] [int] NOT NULL,
- [Description] [nvarchar](100) NOT NULL,
-PRIMARY KEY CLUSTERED
-(
- [UserHistoryTypeId] ASC
-)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 100, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
-) ON [PRIMARY]
-GO
\ No newline at end of file
diff --git a/WebAPI/LearningHub.Nhs.Database/Tables/Hub/User.sql b/WebAPI/LearningHub.Nhs.Database/Tables/Hub/User.sql
index 3af869df7..353e78f2b 100644
--- a/WebAPI/LearningHub.Nhs.Database/Tables/Hub/User.sql
+++ b/WebAPI/LearningHub.Nhs.Database/Tables/Hub/User.sql
@@ -1,24 +1,6 @@
CREATE TABLE [hub].[User](
[Id] [int] NOT NULL,
[UserName] [nvarchar](50) NOT NULL,
- [countryId] [int] NULL,
- [registrationCode] [nvarchar](50) NULL,
- [activeFromDate] [datetimeoffset](7) NULL,
- [activeToDate] [datetimeoffset](7) NULL,
- [passwordHash] [nvarchar](255) NULL,
- [mustChangeNextLogin] [bit] NULL,
- [passwordLifeCounter] [int] NULL,
- [securityLifeCounter] [int] NULL,
- [RemoteLoginKey] [nvarchar](50) NULL,
- [RemoteLoginGuid] [uniqueidentifier] NULL,
- [RemoteLoginStart] [datetimeoffset](7) NULL,
- [RestrictToSSO] [bit] NULL,
- [loginTimes] [int] NULL,
- [loginWizardInProgress] [bit] NULL,
- [lastLoginWizardCompleted] [datetimeoffset](7) NULL,
- [primaryUserEmploymentId] [int] NULL,
- [regionId] [int] NULL,
- [preferredTenantId] [int] NULL,
[CreateUserId] [int] NOT NULL,
[CreateDate] [datetimeoffset](7) NOT NULL,
[AmendUserId] [int] NOT NULL,
@@ -40,37 +22,6 @@ GO
ALTER TABLE [hub].[User] ADD DEFAULT (CONVERT([datetime2],'9999-12-31 23:59:59.9999999')) FOR [VersionEndTime]
GO
-
-ALTER TABLE [hub].[User] ADD CONSTRAINT [DF_userTBL_passwordLifeCounter] DEFAULT ((0)) FOR [passwordLifeCounter]
-GO
-
-ALTER TABLE [hub].[User] ADD CONSTRAINT [DF_userTBL_securityLifeCounter] DEFAULT ((0)) FOR [securityLifeCounter]
-GO
-
-ALTER TABLE [hub].[User] ADD CONSTRAINT [DF_userTBL_RestrictToSSO] DEFAULT ((0)) FOR [RestrictToSSO]
-GO
-
-ALTER TABLE [hub].[User] WITH CHECK ADD CONSTRAINT [FK_userTBL_countryTBL] FOREIGN KEY([countryId])
-REFERENCES [elfh].[countryTBL] ([countryId])
-GO
-
-ALTER TABLE [hub].[User] CHECK CONSTRAINT [FK_userTBL_countryTBL]
-GO
-
-ALTER TABLE [hub].[User] WITH CHECK ADD CONSTRAINT [FK_userTBL_regionTBL] FOREIGN KEY([regionId])
-REFERENCES [elfh].[regionTBL] ([regionId])
-GO
-
-ALTER TABLE [hub].[User] CHECK CONSTRAINT [FK_userTBL_regionTBL]
-GO
-
-ALTER TABLE [hub].[User] WITH CHECK ADD CONSTRAINT [FK_userTBL_userEmploymentTBL] FOREIGN KEY([primaryUserEmploymentId])
-REFERENCES [elfh].[userEmploymentTBL] ([userEmploymentId])
-GO
-
-ALTER TABLE [hub].[User] CHECK CONSTRAINT [FK_userTBL_userEmploymentTBL]
-GO
-
CREATE INDEX idx_User_Deleted ON hub.[User] (Deleted) include (UserName) WITH (FILLFACTOR = 95);
GO
diff --git a/WebAPI/LearningHub.Nhs.Database/Tables/Hub/UserProfile.sql b/WebAPI/LearningHub.Nhs.Database/Tables/Hub/UserProfile.sql
index 61c95a2f5..0b13ebfd8 100644
--- a/WebAPI/LearningHub.Nhs.Database/Tables/Hub/UserProfile.sql
+++ b/WebAPI/LearningHub.Nhs.Database/Tables/Hub/UserProfile.sql
@@ -2,10 +2,8 @@
[Id] [int] NOT NULL,
[UserName] [nvarchar](50) NOT NULL,
[EmailAddress] [nvarchar](100) NOT NULL,
- [AltEmailAddress] [nvarchar](100) NULL,
[FirstName] [nvarchar](50) NOT NULL,
[LastName] [nvarchar](50) NOT NULL,
- [PreferredName] [nvarchar](50) NULL,
[Active] [bit] NOT NULL,
[CreateUserId] [int] NOT NULL,
[CreateDate] [datetimeoffset](7) NOT NULL,