Skip to content

Commit 09f926d

Browse files
authored
Merge pull request #1563 from TechnologyEnhancedLearning/TD-6625-AddtionalTable&CDC
TD-6625-Additional Table from ELFH to LH & Removal of Unused Table
2 parents d33eb31 + 4668c06 commit 09f926d

File tree

4 files changed

+43
-42
lines changed

4 files changed

+43
-42
lines changed

WebAPI/LearningHub.Nhs.Database/LearningHub.Nhs.Database.sqlproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,6 @@
578578
<Build Include="Tables\Elfh\UserAttributeTBL.sql" />
579579
<Build Include="Tables\Elfh\UserEmploymentTBL.sql" />
580580
<Build Include="Tables\Elfh\UserGroupTypeInputValidationTBL.sql" />
581-
<Build Include="Tables\Elfh\UserHistoryAttributeTBL.sql" />
582581
<Build Include="Tables\Elfh\UserHistoryTBL.sql" />
583582
<Build Include="Tables\Elfh\userHistoryTypeTBL.sql" />
584583
<Build Include="Tables\Elfh\UserPasswordValidationTokenTBL.sql" />
@@ -623,7 +622,6 @@
623622
<Build Include="Tables\Elfh\UserAttributeTBL.sql" />
624623
<Build Include="Tables\Elfh\UserEmploymentTBL.sql" />
625624
<Build Include="Tables\Elfh\UserGroupTypeInputValidationTBL.sql" />
626-
<Build Include="Tables\Elfh\UserHistoryAttributeTBL.sql" />
627625
<Build Include="Tables\Elfh\UserHistoryTBL.sql" />
628626
<Build Include="Tables\Elfh\userHistoryTypeTBL.sql" />
629627
<Build Include="Tables\Elfh\UserPasswordValidationTokenTBL.sql" />
@@ -693,6 +691,8 @@
693691
<Build Include="Tables\Adf\ADFSyncMetadata.sql" />
694692
<Build Include="Stored Procedures\Adf\proc_UpdateLastSyncTimeAdf.sql" />
695693
<Build Include="Tables\Databricks\ReportHistory.sql" />
694+
<Build Include="Tables\Elfh\UserGroupReporterTBL.sql" />
695+
<None Include="Scripts\Post-Deploy\Scripts\TD-6625-AddtionalTable-CDC.sql" />
696696
</ItemGroup>
697697
<ItemGroup>
698698
<None Include="Scripts\Pre-Deploy\Scripts\Card5766_AuthorTableChanges.PreDeployment.sql" />
@@ -763,4 +763,4 @@
763763
<ItemGroup>
764764
<None Include="Scripts\Post-Deploy\Scripts\ElfhExternalSystemsImport.sql" />
765765
</ItemGroup>
766-
</Project>
766+
</Project>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
-- DROP NodeEditor table
2+
DROP TABLE elfh.userHistoryAttributeTBL
3+
4+
--Enable CDC
5+
EXEC sys.sp_cdc_enable_table
6+
@source_schema = N'elfh',
7+
@source_name = N'userReportingUserTBL',
8+
@role_name = NULL,
9+
@supports_net_changes = 0;
10+
GO
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
CREATE TABLE [elfh].[userGroupReporterTBL](
2+
[userGroupReporterId] [int] IDENTITY(1,1) NOT FOR REPLICATION NOT NULL,
3+
[userId] [int] NOT NULL,
4+
[userGroupId] [int] NOT NULL,
5+
[deleted] [bit] NOT NULL,
6+
[amendUserId] [int] NOT NULL,
7+
[amendDate] [datetimeoffset](7) NOT NULL,
8+
CONSTRAINT [PK_userGroupReporterTBL] PRIMARY KEY CLUSTERED
9+
(
10+
[userGroupReporterId] ASC
11+
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 100) ON [PRIMARY]
12+
) ON [PRIMARY]
13+
GO
14+
15+
ALTER TABLE [elfh].[userGroupReporterTBL] ADD DEFAULT (sysdatetimeoffset()) FOR [amendDate]
16+
GO
17+
18+
ALTER TABLE [elfh].[userGroupReporterTBL] WITH CHECK ADD CONSTRAINT [FK_userGroupReporterTBL_userGroupTBL] FOREIGN KEY([userGroupId])
19+
REFERENCES [hub].[userGroup] ([Id])
20+
GO
21+
22+
ALTER TABLE [elfh].[userGroupReporterTBL] CHECK CONSTRAINT [FK_userGroupReporterTBL_userGroupTBL]
23+
GO
24+
25+
ALTER TABLE [elfh].[userGroupReporterTBL] WITH CHECK ADD CONSTRAINT [FK_userGroupReporterTBL_userTBL] FOREIGN KEY([userId])
26+
REFERENCES [hub].[user] ([Id])
27+
GO
28+
29+
ALTER TABLE [elfh].[userGroupReporterTBL] CHECK CONSTRAINT [FK_userGroupReporterTBL_userTBL]
30+
GO

WebAPI/LearningHub.Nhs.Database/Tables/Elfh/UserHistoryAttributeTBL.sql

Lines changed: 0 additions & 39 deletions
This file was deleted.

0 commit comments

Comments
 (0)