generated from CDCgov/template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
da889bc
commit 1b69d25
Showing
6 changed files
with
62 additions
and
50 deletions.
There are no files selected for viewing
This file contains 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
26 changes: 15 additions & 11 deletions
26
db/upgrade/rdb_modern/tables/022-create_nrt_interview_key.sql
This file contains 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 |
---|---|---|
@@ -1,13 +1,17 @@ | ||
DROP TABLE IF EXISTS dbo.nrt_interview_key; | ||
-- table is not dropped and recreated, as D_INTERVIEW_KEY does not retain the key-uid relationship | ||
|
||
CREATE TABLE dbo.nrt_interview_key ( | ||
d_interview_key bigint IDENTITY(1,1) NOT NULL, | ||
interview_uid bigint NULL | ||
); | ||
IF NOT EXISTS (SELECT 1 FROM sysobjects WHERE name = 'nrt_interview_key' and xtype = 'U') | ||
BEGIN | ||
|
||
declare @max bigint; | ||
select @max=max(D_INTERVIEW_KEY)+1 from dbo.D_INTERVIEW; | ||
select @max; | ||
if @max IS NULL --check when max is returned as null | ||
SET @max = 1; | ||
DBCC CHECKIDENT ('dbo.nrt_interview_key', RESEED, @max); | ||
CREATE TABLE dbo.nrt_interview_key ( | ||
d_interview_key bigint IDENTITY (1,1) NOT NULL, | ||
interview_uid bigint NULL | ||
); | ||
declare @max bigint; | ||
select @max=max(d_interview_key)+1 from dbo.D_INTERVIEW ; | ||
select @max; | ||
if @max IS NULL --check when max is returned as null | ||
SET @max = 2; -- default to 2, as default record with key = 1 is not stored in D_INTERVIEW | ||
DBCC CHECKIDENT ('dbo.nrt_interview_key', RESEED, @max); | ||
|
||
END |
28 changes: 16 additions & 12 deletions
28
db/upgrade/rdb_modern/tables/022-create_nrt_interview_note_key.sql
This file contains 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 |
---|---|---|
@@ -1,14 +1,18 @@ | ||
DROP TABLE IF EXISTS dbo.nrt_interview_note_key; | ||
-- table is not dropped and recreated so as to stay consistent with the design of nrt_interview_key | ||
|
||
CREATE TABLE dbo.nrt_interview_note_key ( | ||
d_interview_note_key bigint IDENTITY(1,1) NOT NULL, | ||
d_interview_key bigint NOT NULL, | ||
nbs_answer_uid bigint NULL | ||
); | ||
IF NOT EXISTS (SELECT 1 FROM sysobjects WHERE name = 'nrt_interview_note_key' and xtype = 'U') | ||
BEGIN | ||
|
||
declare @max bigint; | ||
select @max=max(D_INTERVIEW_NOTE_KEY)+1 from dbo.D_INTERVIEW_NOTE; | ||
select @max; | ||
if @max IS NULL --check when max is returned as null | ||
SET @max = 1; | ||
DBCC CHECKIDENT ('dbo.nrt_interview_note_key', RESEED, @max); | ||
CREATE TABLE dbo.nrt_interview_note_key ( | ||
d_interview_note_key bigint IDENTITY(1,1) NOT NULL, | ||
d_interview_key bigint NOT NULL, | ||
nbs_answer_uid bigint NULL | ||
); | ||
declare @max bigint; | ||
select @max=max(d_interview_note_key)+1 from dbo.D_INTERVIEW_NOTE ; | ||
select @max; | ||
if @max IS NULL --check when max is returned as null | ||
SET @max = 2; -- default to 2, as default record with key = 1 is not stored in D_INTERVIEW_NOTE | ||
DBCC CHECKIDENT ('dbo.nrt_interview_note_key', RESEED, @max); | ||
|
||
END |
This file contains 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
26 changes: 15 additions & 11 deletions
26
...base-service/src/main/resources/db/rdb_modern/tables/022-create_nrt_interview_key-001.sql
This file contains 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 |
---|---|---|
@@ -1,13 +1,17 @@ | ||
DROP TABLE IF EXISTS dbo.nrt_interview_key; | ||
-- table is not dropped and recreated, as D_INTERVIEW_KEY does not retain the key-uid relationship | ||
|
||
CREATE TABLE dbo.nrt_interview_key ( | ||
d_interview_key bigint IDENTITY(1,1) NOT NULL, | ||
interview_uid bigint NULL | ||
); | ||
IF NOT EXISTS (SELECT 1 FROM sysobjects WHERE name = 'nrt_interview_key' and xtype = 'U') | ||
BEGIN | ||
|
||
declare @max bigint; | ||
select @max=max(D_INTERVIEW_KEY)+1 from dbo.D_INTERVIEW; | ||
select @max; | ||
if @max IS NULL --check when max is returned as null | ||
SET @max = 1; | ||
DBCC CHECKIDENT ('dbo.nrt_interview_key', RESEED, @max); | ||
CREATE TABLE dbo.nrt_interview_key ( | ||
d_interview_key bigint IDENTITY (1,1) NOT NULL, | ||
interview_uid bigint NULL | ||
); | ||
declare @max bigint; | ||
select @max=max(d_interview_key)+1 from dbo.D_INTERVIEW ; | ||
select @max; | ||
if @max IS NULL --check when max is returned as null | ||
SET @max = 2; -- default to 2, as default record with key = 1 is not stored in D_INTERVIEW | ||
DBCC CHECKIDENT ('dbo.nrt_interview_key', RESEED, @max); | ||
|
||
END |
28 changes: 16 additions & 12 deletions
28
...service/src/main/resources/db/rdb_modern/tables/022-create_nrt_interview_note_key-001.sql
This file contains 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 |
---|---|---|
@@ -1,14 +1,18 @@ | ||
DROP TABLE IF EXISTS dbo.nrt_interview_note_key; | ||
-- table is not dropped and recreated so as to stay consistent with the design of nrt_interview_key | ||
|
||
CREATE TABLE dbo.nrt_interview_note_key ( | ||
d_interview_note_key bigint IDENTITY(1,1) NOT NULL, | ||
d_interview_key bigint NOT NULL, | ||
nbs_answer_uid bigint NULL | ||
); | ||
IF NOT EXISTS (SELECT 1 FROM sysobjects WHERE name = 'nrt_interview_note_key' and xtype = 'U') | ||
BEGIN | ||
|
||
declare @max bigint; | ||
select @max=max(D_INTERVIEW_NOTE_KEY)+1 from dbo.D_INTERVIEW_NOTE; | ||
select @max; | ||
if @max IS NULL --check when max is returned as null | ||
SET @max = 1; | ||
DBCC CHECKIDENT ('dbo.nrt_interview_note_key', RESEED, @max); | ||
CREATE TABLE dbo.nrt_interview_note_key ( | ||
d_interview_note_key bigint IDENTITY(1,1) NOT NULL, | ||
d_interview_key bigint NOT NULL, | ||
nbs_answer_uid bigint NULL | ||
); | ||
declare @max bigint; | ||
select @max=max(d_interview_note_key)+1 from dbo.D_INTERVIEW_NOTE ; | ||
select @max; | ||
if @max IS NULL --check when max is returned as null | ||
SET @max = 2; -- default to 2, as default record with key = 1 is not stored in D_INTERVIEW_NOTE | ||
DBCC CHECKIDENT ('dbo.nrt_interview_note_key', RESEED, @max); | ||
|
||
END |