generated from CDCgov/template
-
Notifications
You must be signed in to change notification settings - Fork 7
Mp/app 340/image update #684
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
75ad97c
Use published Wildfly container
mpeels a9e5c16
Remove Dockerfile for database. Remove initialize script and replace …
mpeels 1fb1dae
Remove some unnecessary changes
mpeels 814f7a3
Fix file name. Match database and wildfly versions
mpeels 4ce43cd
Update compatability level command. remove duplicate code
mpeels 30bf7c4
Separate DB initialization password and liquibase password
mpeels 7c6b7b7
Update elr docs
mpeels File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| USE [master]; | ||
|
|
||
| --------------------------------------------------------------------------------------------------- | ||
| -- RDB_MODERN (Copy of RDB) | ||
| --------------------------------------------------------------------------------------------------- | ||
|
|
||
| IF DB_ID('rdb_modern') IS NULL | ||
| BEGIN | ||
| -- Create backup of RDB | ||
| BACKUP DATABASE RDB TO DISK = '/tmp/RDB.bak' WITH COMPRESSION; | ||
|
|
||
| -- Restore backup to rdb_modern | ||
| RESTORE DATABASE [RDB_MODERN] FROM DISK = N'/tmp/RDB.bak' WITH FILE = 1, | ||
| MOVE N'RDB' TO N'/var/opt/mssql/data/rdb_modern_data.mdf', | ||
| MOVE N'RDB_log' TO N'/var/opt/mssql/data/rdb_modern_log.ldf', NOUNLOAD, STATS = 10 | ||
|
|
||
|
|
||
| ALTER DATABASE [RDB_MODERN] SET COMPATIBILITY_LEVEL = 120; | ||
| END |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| USE [NBS_ODSE]; | ||
| -- Insert into NBS_ODSE.NBS_Configuration to flag use of RDB_MODERN | ||
| IF (SELECT config_value FROM NBS_configuration WHERE config_key = 'ENV') IS NULL | ||
| BEGIN | ||
| INSERT INTO | ||
| NBS_configuration ( | ||
| config_key, | ||
| config_value, | ||
| version_ctrl_nbr, | ||
| add_user_id, | ||
| add_time, | ||
| last_chg_user_id, | ||
| last_chg_time, | ||
| status_cd, | ||
| status_time | ||
| ) | ||
| VALUES | ||
| ('ENV', 'UAT', 1, 99999999, GETDATE(), 99999999, GETDATE(), 'A', GETDATE()); | ||
| END |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
containers/db/initialize/04-nbs_odse-change-data-capture.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| --------------------------------------------------------------------------------------------------- | ||
| -- Enable CDC for NBS_ODSE | ||
| --------------------------------------------------------------------------------------------------- | ||
| USE NBS_ODSE; | ||
|
|
||
| EXEC sp_changedbowner 'sa'; | ||
|
|
||
| -- Enable at database level | ||
| IF (SELECT is_cdc_enabled FROM sys.databases WHERE name = 'NBS_ODSE') = 0 | ||
| BEGIN | ||
| PRINT 'Enabling CDC for NBS_ODSE'; | ||
| EXEC sys.sp_cdc_enable_db; | ||
| END | ||
|
|
||
| -- Enable for tables | ||
| DECLARE @tableName NVARCHAR(128); | ||
| DECLARE @enableCDCSQL NVARCHAR(MAX); | ||
|
|
||
| DECLARE @tablesToEnable TABLE ( | ||
| TableName NVARCHAR(128) | ||
| ); | ||
|
|
||
| INSERT INTO @tablesToEnable (TableName) VALUES | ||
| ('Person'), | ||
| ('Organization'), | ||
| ('Observation'), | ||
| ('Public_health_case'), | ||
| ('Treatment'), | ||
| ('state_defined_field_data'), | ||
| ('Notification'), | ||
| ('Interview'), | ||
| ('Place'), | ||
| ('CT_contact'), | ||
| ('Auth_user'), | ||
| ('Intervention'), | ||
| ('Act_relationship') | ||
| ; | ||
|
|
||
| DECLARE cur CURSOR FOR SELECT TableName FROM @tablesToEnable; | ||
| OPEN cur; | ||
| FETCH NEXT FROM cur INTO @tableName; | ||
|
|
||
| WHILE @@FETCH_STATUS = 0 | ||
| BEGIN | ||
| IF (SELECT is_tracked_by_cdc FROM sys.tables WHERE name = @tableName) = 0 | ||
| BEGIN | ||
| PRINT 'Enabling CDC for table ' + @tableName; | ||
| EXEC sys.sp_cdc_enable_table @source_schema = 'dbo', @source_name = @tableName, @role_name = NULL; | ||
| END | ||
|
|
||
| FETCH NEXT FROM cur INTO @tableName; | ||
| END | ||
|
|
||
| CLOSE cur; | ||
| DEALLOCATE cur; |
86 changes: 86 additions & 0 deletions
86
containers/db/initialize/05-nbs_srte-change-data-capture.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,86 @@ | ||
| --------------------------------------------------------------------------------------------------- | ||
| -- Enable CDC for NBS_SRTE | ||
| --------------------------------------------------------------------------------------------------- | ||
| USE NBS_SRTE; | ||
|
|
||
| -- Enable at database level | ||
| IF (SELECT is_cdc_enabled FROM sys.databases WHERE name = 'NBS_SRTE') = 0 | ||
| BEGIN | ||
| PRINT 'Enabling CDC for NBS_SRTE'; | ||
| EXEC sys.sp_cdc_enable_db; | ||
| END | ||
|
|
||
| -- Enable for tables | ||
| DECLARE @tableName NVARCHAR(128); | ||
| DECLARE @enableCDCSQL NVARCHAR(MAX); | ||
|
|
||
| DECLARE @tablesToEnable TABLE ( | ||
| TableName NVARCHAR(128) | ||
| ); | ||
|
|
||
| INSERT INTO @tablesToEnable (TableName) VALUES | ||
| ('Condition_code'), | ||
ericbuckley marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ('Program_area_code'), | ||
| ('Language_code'), | ||
| ('State_code'), | ||
| ('Unit_code'), | ||
| ('Cntycity_code_value'), | ||
| ('Lab_result'), | ||
| ('Country_code'), | ||
| ('Labtest_loinc'), | ||
| ('ELR_XREF'), | ||
| ('Loinc_condition'), | ||
| ('Loinc_snomed_condition'), | ||
| ('Lab_test'), | ||
| ('Zip_code_value'), | ||
| ('Zipcnty_code_value'), | ||
| ('Lab_result_Snomed'), | ||
| ('Investigation_code'), | ||
| ('TotalIDM'), | ||
| ('IMRDBMapping'), | ||
| ('Anatomic_site_code'), | ||
| ('Jurisdiction_code'), | ||
| ('Lab_coding_system'), | ||
| ('City_code_value'), | ||
| ('LDF_page_set'), | ||
| ('LOINC_code'), | ||
| ('NAICS_Industry_code'), | ||
| ('Codeset_Group_Metadata'), | ||
| ('Country_Code_ISO'), | ||
| ('Occupation_code'), | ||
| ('Country_XREF'), | ||
| ('Standard_XREF'), | ||
| ('Code_value_clinical'), | ||
| ('Code_value_general'), | ||
| ('Race_code'), | ||
| ('Participation_type'), | ||
| ('Specimen_source_code'), | ||
| ('Snomed_code'), | ||
| ('State_county_code_value'), | ||
| ('State_model'), | ||
| ('Codeset'), | ||
| ('Jurisdiction_participation'), | ||
| ('Labtest_Progarea_Mapping'), | ||
| ('Treatment_code'), | ||
| ('Snomed_condition'); | ||
|
|
||
| DECLARE cur CURSOR FOR SELECT TableName FROM @tablesToEnable; | ||
| OPEN cur; | ||
| FETCH NEXT FROM cur INTO @tableName; | ||
|
|
||
| WHILE @@FETCH_STATUS = 0 | ||
| BEGIN | ||
| IF (SELECT is_tracked_by_cdc FROM sys.tables WHERE name = @tableName) = 0 | ||
| BEGIN | ||
| PRINT 'Enabling CDC for table ' + @tableName; | ||
| EXEC sys.sp_cdc_enable_table @source_schema = 'dbo', @source_name = @tableName, @role_name = NULL; | ||
| END | ||
|
|
||
| FETCH NEXT FROM cur INTO @tableName; | ||
| END | ||
|
|
||
| CLOSE cur; | ||
| DEALLOCATE cur; | ||
|
|
||
|
|
||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.