diff --git a/WebAPI/LearningHub.Nhs.Database/LearningHub.Nhs.Database.sqlproj b/WebAPI/LearningHub.Nhs.Database/LearningHub.Nhs.Database.sqlproj index 705fc366..f9b533c1 100644 --- a/WebAPI/LearningHub.Nhs.Database/LearningHub.Nhs.Database.sqlproj +++ b/WebAPI/LearningHub.Nhs.Database/LearningHub.Nhs.Database.sqlproj @@ -568,6 +568,7 @@ + diff --git a/WebAPI/LearningHub.Nhs.Database/Scripts/Post-Deploy/Script.PostDeployment.sql b/WebAPI/LearningHub.Nhs.Database/Scripts/Post-Deploy/Script.PostDeployment.sql index 672b5785..2b2bcda6 100644 --- a/WebAPI/LearningHub.Nhs.Database/Scripts/Post-Deploy/Script.PostDeployment.sql +++ b/WebAPI/LearningHub.Nhs.Database/Scripts/Post-Deploy/Script.PostDeployment.sql @@ -87,4 +87,4 @@ UPDATE [resources].[ResourceVersion] SET CertificateEnabled = 0 WHERE VersionSta :r .\Scripts\PPSXFileType.sql :r .\Scripts\UpdateFileTypes.sql :r .\Scripts\TD-7116-mib_new_env.sql - +:r .\Scripts\TD-7106-Resume-Databricks-Ingestion.sql diff --git a/WebAPI/LearningHub.Nhs.Database/Scripts/Post-Deploy/Scripts/TD-7106-Resume-Databricks-Ingestion.sql b/WebAPI/LearningHub.Nhs.Database/Scripts/Post-Deploy/Scripts/TD-7106-Resume-Databricks-Ingestion.sql new file mode 100644 index 00000000..710a7f89 --- /dev/null +++ b/WebAPI/LearningHub.Nhs.Database/Scripts/Post-Deploy/Scripts/TD-7106-Resume-Databricks-Ingestion.sql @@ -0,0 +1,17 @@ +IF EXISTS ( + SELECT 1 + FROM sys.change_tracking_databases + WHERE database_id = DB_ID() +) +BEGIN + PRINT 'Change Tracking is enabled. Executing setup...'; + + EXEC dbo.lakeflowSetupChangeTracking + @Tables = 'activity.ResourceActivity', --(to include all other tables with CT enabled) + @User = 'Elfhadmin', + @Retention = '2 DAYS'; +END +ELSE +BEGIN + PRINT 'Change Tracking is NOT enabled on this database. Skipping execution.'; +END \ No newline at end of file