-
Notifications
You must be signed in to change notification settings - Fork 2
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
ORV2 2299 LOA #1486
ORV2 2299 LOA #1486
Changes from 33 commits
8e683c6
ba240d8
13efc5e
73cf742
34ffda3
74f0c63
e679aa8
0d8b96b
b66a891
4030bd6
cfe4fe7
5bc8c31
d6024fc
bf0f6e1
c31febe
5c9449c
188a19d
12852eb
fd1c6bf
85ced97
d8c6d2c
6129d06
5e55dff
fb1f70e
b917af5
f0334e4
8eb0387
ff20d60
87761a4
7955be4
5609297
f412e66
a49483d
0658f96
2d47b45
2b26a93
a42ac51
7c6a93d
e478f6a
457b5ce
c5c252e
d171ca3
396e2db
a681cd3
6d345e1
560706a
241ac6b
e582e71
17839c2
e81f7f0
451fdd2
c125a54
343d794
5012daf
f886a7b
85a6eff
fda4c54
b1ab4ea
29e0a31
23f0102
5e78a61
16d5068
eea9c40
3b3d6ae
72d617d
1b81873
f3b64b7
33480c8
5899dc5
5f13164
cbb53b2
f226f21
91e63ab
767857b
ad26eb8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
SET ANSI_NULLS ON | ||
GO | ||
SET QUOTED_IDENTIFIER ON | ||
GO | ||
SET NOCOUNT ON | ||
GO | ||
|
||
SET XACT_ABORT ON | ||
|
||
BEGIN TRY | ||
BEGIN TRANSACTION | ||
DROP TABLE [permit].[ORBC_LOA_PERMIT_TYPE_DETAILS] | ||
DROP TABLE [permit].[ORBC_LOA_VEHICLES] | ||
DROP TABLE [permit].[ORBC_LOA_DETAILS] | ||
DROP SEQUENCE [permit].[ORBC_LOA_NUMBER_SEQ] | ||
COMMIT | ||
END TRY | ||
|
||
BEGIN CATCH | ||
IF @@TRANCOUNT > 0 | ||
ROLLBACK; | ||
THROW | ||
END CATCH | ||
|
||
DECLARE @VersionDescription VARCHAR(255) | ||
SET @VersionDescription = 'Reverting initial creation of LOA tables.' | ||
|
||
INSERT [dbo].[ORBC_SYS_VERSION] ([VERSION_ID], [DESCRIPTION], [RELEASE_DATE]) VALUES (31, @VersionDescription, getutcdate()) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,213 @@ | ||
SET ANSI_NULLS ON | ||
GO | ||
|
||
SET QUOTED_IDENTIFIER ON | ||
GO | ||
|
||
SET NOCOUNT ON | ||
GO | ||
|
||
SET XACT_ABORT ON | ||
GO | ||
|
||
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE | ||
GO | ||
|
||
BEGIN TRANSACTION | ||
GO | ||
|
||
IF @@ERROR <> 0 | ||
SET NOEXEC ON | ||
GO | ||
CREATE SEQUENCE permit.ORBC_LOA_NUMBER_SEQ | ||
START WITH 100000 | ||
INCREMENT BY 1 ; | ||
GO | ||
|
||
CREATE TABLE [permit].[ORBC_LOA_DETAILS] ( | ||
LOA_ID [bigint] IDENTITY(1,1) NOT NULL, | ||
LOA_NUMBER [bigint] NOT NULL DEFAULT (NEXT VALUE FOR permit.ORBC_LOA_NUMBER_SEQ), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How many digits would a LOA_NUMBER be? If its a small number, please change to int |
||
[COMPANY_ID] [int] NULL, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add FK on company Id |
||
START_DATE [varchar](10) NOT NULL, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Type should be Date instead of varchar There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The LOA start and expiry date should be string instead of datetime, since we are not accounting for time (same as permit) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It can be of type DATE instead of DATETIMESTAMP. |
||
EXPIRY_DATE [varchar](10), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Type should be Date instead of varchar There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @praju-aot The LOA start and expiry date should be string instead of datetime, since we are not accounting for time (same as permit) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It can be of type DATE instead of DATETIMESTAMP |
||
DOCUMENT_ID [bigint], | ||
praju-aot marked this conversation as resolved.
Show resolved
Hide resolved
|
||
COMMENTS [nvarchar](4000), | ||
[IS_ACTIVE] [bit] NOT NULL DEFAULT(1), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please change to Y or N to be consistent with other IS_ACTIVE/IS_SUSPEND flags is in the system |
||
[APP_CREATE_TIMESTAMP] [datetime2](7) DEFAULT(getutcdate()), | ||
[APP_CREATE_USERID] [nvarchar](30) DEFAULT(user_name()), | ||
[APP_CREATE_USER_GUID] [char](32) NULL, | ||
[APP_CREATE_USER_DIRECTORY] [nvarchar](30) DEFAULT(user_name()), | ||
[APP_LAST_UPDATE_TIMESTAMP] [datetime2](7) DEFAULT(getutcdate()), | ||
[APP_LAST_UPDATE_USERID] [nvarchar](30) DEFAULT(user_name()), | ||
[APP_LAST_UPDATE_USER_GUID] [char](32) NULL, | ||
[APP_LAST_UPDATE_USER_DIRECTORY] [nvarchar](30) DEFAULT(user_name()), | ||
[CONCURRENCY_CONTROL_NUMBER] [int] NULL, | ||
[DB_CREATE_USERID] [varchar](63) NOT NULL, | ||
[DB_CREATE_TIMESTAMP] [datetime2](7) NOT NULL, | ||
[DB_LAST_UPDATE_USERID] [varchar](63) NOT NULL, | ||
[DB_LAST_UPDATE_TIMESTAMP] [datetime2](7) NOT NULL, | ||
CONSTRAINT [PK_ORBC_LOA_DETAILS] PRIMARY KEY CLUSTERED ([LOA_ID] ASC) WITH ( | ||
PAD_INDEX = OFF, | ||
STATISTICS_NORECOMPUTE = OFF, | ||
IGNORE_DUP_KEY = OFF, | ||
ALLOW_ROW_LOCKS = ON, | ||
ALLOW_PAGE_LOCKS = ON | ||
) ON [PRIMARY] | ||
) ON [PRIMARY]; | ||
|
||
CREATE TABLE [permit].[ORBC_LOA_PERMIT_TYPE_DETAILS] ( | ||
LOA_PERMIT_TYPE_ID [bigint] IDENTITY(1,1) NOT NULL, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we use an int instead of bigint? Please confirm with @john-fletcher-aot |
||
LOA_ID [bigint] NOT NULL, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we use an int instead of bigint? Please confirm with @john-fletcher-aot |
||
PERMIT_TYPE_ID [varchar](10) NOT NULL, | ||
[APP_CREATE_TIMESTAMP] [datetime2](7) DEFAULT(getutcdate()), | ||
[APP_CREATE_USERID] [nvarchar](30) DEFAULT(user_name()), | ||
[APP_CREATE_USER_GUID] [char](32) NULL, | ||
[APP_CREATE_USER_DIRECTORY] [nvarchar](30) DEFAULT(user_name()), | ||
[APP_LAST_UPDATE_TIMESTAMP] [datetime2](7) DEFAULT(getutcdate()), | ||
[APP_LAST_UPDATE_USERID] [nvarchar](30) DEFAULT(user_name()), | ||
[APP_LAST_UPDATE_USER_GUID] [char](32) NULL, | ||
[APP_LAST_UPDATE_USER_DIRECTORY] [nvarchar](30) DEFAULT(user_name()), | ||
[CONCURRENCY_CONTROL_NUMBER] [int] NULL, | ||
[DB_CREATE_USERID] [varchar](63) NOT NULL, | ||
[DB_CREATE_TIMESTAMP] [datetime2](7) NOT NULL, | ||
[DB_LAST_UPDATE_USERID] [varchar](63) NOT NULL, | ||
[DB_LAST_UPDATE_TIMESTAMP] [datetime2](7) NOT NULL, | ||
CONSTRAINT [PK_ORBC_LOA_PERMIT_TYPE_DETAILS] PRIMARY KEY CLUSTERED ([LOA_PERMIT_TYPE_ID] ASC) WITH ( | ||
PAD_INDEX = OFF, | ||
STATISTICS_NORECOMPUTE = OFF, | ||
IGNORE_DUP_KEY = OFF, | ||
ALLOW_ROW_LOCKS = ON, | ||
ALLOW_PAGE_LOCKS = ON | ||
) ON [PRIMARY] | ||
) ON [PRIMARY]; | ||
|
||
CREATE TABLE [permit].[ORBC_LOA_VEHICLES] ( | ||
LOA_VEHICLE_ID [bigint] IDENTITY(1,1) NOT NULL, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we use an int instead of bigint? Please confirm with @john-fletcher-aot |
||
LOA_ID [bigint] NOT NULL, | ||
POWER_UNIT_ID [bigint], | ||
TRAILER_ID [bigint], | ||
[APP_CREATE_TIMESTAMP] [datetime2](7) DEFAULT(getutcdate()), | ||
[APP_CREATE_USERID] [nvarchar](30) DEFAULT(user_name()), | ||
[APP_CREATE_USER_GUID] [char](32) NULL, | ||
[APP_CREATE_USER_DIRECTORY] [nvarchar](30) DEFAULT(user_name()), | ||
[APP_LAST_UPDATE_TIMESTAMP] [datetime2](7) DEFAULT(getutcdate()), | ||
[APP_LAST_UPDATE_USERID] [nvarchar](30) DEFAULT(user_name()), | ||
[APP_LAST_UPDATE_USER_GUID] [char](32) NULL, | ||
[APP_LAST_UPDATE_USER_DIRECTORY] [nvarchar](30) DEFAULT(user_name()), | ||
[CONCURRENCY_CONTROL_NUMBER] [int] NULL, | ||
[DB_CREATE_USERID] [varchar](63) NOT NULL, | ||
[DB_CREATE_TIMESTAMP] [datetime2](7) NOT NULL, | ||
[DB_LAST_UPDATE_USERID] [varchar](63) NOT NULL, | ||
[DB_LAST_UPDATE_TIMESTAMP] [datetime2](7) NOT NULL, | ||
CONSTRAINT [PK_ORBC_LOA_VEHICLES] PRIMARY KEY CLUSTERED ([LOA_VEHICLE_ID] ASC) WITH ( | ||
PAD_INDEX = OFF, | ||
STATISTICS_NORECOMPUTE = OFF, | ||
IGNORE_DUP_KEY = OFF, | ||
ALLOW_ROW_LOCKS = ON, | ||
ALLOW_PAGE_LOCKS = ON | ||
) ON [PRIMARY] | ||
) ON [PRIMARY]; | ||
|
||
ALTER TABLE [permit].[ORBC_LOA_DETAILS] ADD CONSTRAINT [DF_ORBC_LOA_DETAILS_DB_CREATE_USERID] DEFAULT(user_name()) | ||
FOR [DB_CREATE_USERID] | ||
|
||
ALTER TABLE [permit].[ORBC_LOA_DETAILS] ADD CONSTRAINT [DF_ORBC_LOA_DETAILS_DB_CREATE_TIMESTAMP] DEFAULT(getutcdate()) | ||
FOR [DB_CREATE_TIMESTAMP] | ||
|
||
ALTER TABLE [permit].[ORBC_LOA_DETAILS] ADD CONSTRAINT [DF_ORBC_LOA_DETAILS_DB_LAST_UPDATE_USERID] DEFAULT(user_name()) | ||
FOR [DB_LAST_UPDATE_USERID] | ||
|
||
ALTER TABLE [permit].[ORBC_LOA_DETAILS] ADD CONSTRAINT [DF_ORBC_LOA_DETAILS_DB_LAST_UPDATE_TIMESTAMP] DEFAULT(getutcdate()) | ||
FOR [DB_LAST_UPDATE_TIMESTAMP] | ||
|
||
ALTER TABLE [permit].[ORBC_LOA_PERMIT_TYPE_DETAILS] ADD CONSTRAINT [DF_ORBC_LOA_PERMIT_TYPE_DETAILS_DB_CREATE_USERID] DEFAULT(user_name()) | ||
FOR [DB_CREATE_USERID] | ||
|
||
ALTER TABLE [permit].[ORBC_LOA_PERMIT_TYPE_DETAILS] ADD CONSTRAINT [DF_ORBC_LOA_PERMIT_TYPE_DETAILS_DB_CREATE_TIMESTAMP] DEFAULT(getutcdate()) | ||
FOR [DB_CREATE_TIMESTAMP] | ||
|
||
ALTER TABLE [permit].[ORBC_LOA_PERMIT_TYPE_DETAILS] ADD CONSTRAINT [DF_ORBC_LOA_PERMIT_TYPE_DETAILS_DB_LAST_UPDATE_USERID] DEFAULT(user_name()) | ||
FOR [DB_LAST_UPDATE_USERID] | ||
|
||
ALTER TABLE [permit].[ORBC_LOA_PERMIT_TYPE_DETAILS] ADD CONSTRAINT [DF_ORBC_LOA_PERMIT_TYPE_DETAILS_DB_LAST_UPDATE_TIMESTAMP] DEFAULT(getutcdate()) | ||
FOR [DB_LAST_UPDATE_TIMESTAMP] | ||
|
||
ALTER TABLE [permit].[ORBC_LOA_VEHICLES] ADD CONSTRAINT [DF_ORBC_LOA_VEHICLES_DB_CREATE_USERID] DEFAULT(user_name()) | ||
FOR [DB_CREATE_USERID] | ||
|
||
ALTER TABLE [permit].[ORBC_LOA_VEHICLES] ADD CONSTRAINT [DF_ORBC_LOA_VEHICLES_DB_CREATE_TIMESTAMP] DEFAULT(getutcdate()) | ||
FOR [DB_CREATE_TIMESTAMP] | ||
|
||
ALTER TABLE [permit].[ORBC_LOA_VEHICLES] ADD CONSTRAINT [DF_ORBC_LOA_VEHICLES_DB_LAST_UPDATE_USERID] DEFAULT(user_name()) | ||
FOR [DB_LAST_UPDATE_USERID] | ||
|
||
ALTER TABLE [permit].[ORBC_LOA_VEHICLES] ADD CONSTRAINT [DF_ORBC_LOA_VEHICLES_DB_LAST_UPDATE_TIMESTAMP] DEFAULT(getutcdate()) | ||
FOR [DB_LAST_UPDATE_TIMESTAMP] | ||
|
||
ALTER TABLE [permit].[ORBC_LOA_VEHICLES] | ||
WITH CHECK ADD CONSTRAINT [ORBC_LOA_VEHICLES_LOA_ID_FK] FOREIGN KEY ([LOA_ID]) REFERENCES [permit].[ORBC_LOA_DETAILS]([LOA_ID]) ON DELETE CASCADE | ||
|
||
ALTER TABLE [permit].[ORBC_LOA_VEHICLES] | ||
WITH CHECK ADD CONSTRAINT [ORBC_LOA_VEHICLES_POWER_UNIT_ID_FK] FOREIGN KEY ([POWER_UNIT_ID]) REFERENCES [dbo].[ORBC_POWER_UNIT]([POWER_UNIT_ID]) | ||
|
||
ALTER TABLE [permit].[ORBC_LOA_VEHICLES] | ||
WITH CHECK ADD CONSTRAINT [ORBC_LOA_VEHICLES_TRAILER_ID_FK] FOREIGN KEY ([TRAILER_ID]) REFERENCES [dbo].[ORBC_TRAILER]([TRAILER_ID]) | ||
|
||
ALTER TABLE [permit].[ORBC_LOA_PERMIT_TYPE_DETAILS] | ||
WITH CHECK ADD CONSTRAINT [ORBC_LOA_PERMIT_TYPES_PERMIT_TYPE_ID_FK] FOREIGN KEY ([PERMIT_TYPE_ID]) REFERENCES [permit].[ORBC_PERMIT_TYPE]([PERMIT_TYPE]) | ||
|
||
ALTER TABLE [permit].[ORBC_LOA_PERMIT_TYPE_DETAILS] | ||
WITH CHECK ADD CONSTRAINT [ORBC_LOA_PERMIT_TYPE_LOA_ID_FK] FOREIGN KEY ([LOA_ID]) REFERENCES [permit].[ORBC_LOA_DETAILS]([LOA_ID]) ON DELETE CASCADE | ||
|
||
ALTER TABLE [permit].[ORBC_LOA_DETAILS] | ||
WITH CHECK ADD CONSTRAINT [ORBC_LOA_DETAILS_DOCUMENT_ID_FK] FOREIGN KEY ([DOCUMENT_ID]) REFERENCES [dops].[ORBC_DOCUMENT]([ID]) | ||
|
||
IF @@ERROR <> 0 | ||
SET NOEXEC ON | ||
GO | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add col descriptions for the tables |
||
DECLARE @VersionDescription VARCHAR(255) | ||
|
||
SET @VersionDescription = '-- Add Serive Account diretory type to ORBC_DIRECTORY_TYPE' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Update the comment |
||
|
||
INSERT [dbo].[ORBC_SYS_VERSION] ( | ||
[VERSION_ID], | ||
[DESCRIPTION], | ||
[UPDATE_SCRIPT], | ||
[REVERT_SCRIPT], | ||
[RELEASE_DATE] | ||
) | ||
VALUES ( | ||
31, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should be 32 |
||
@VersionDescription, | ||
'$(UPDATE_SCRIPT)', | ||
'$(REVERT_SCRIPT)', | ||
getutcdate() | ||
) | ||
|
||
IF @@ERROR <> 0 | ||
SET NOEXEC ON | ||
GO | ||
|
||
COMMIT TRANSACTION | ||
GO | ||
|
||
IF @@ERROR <> 0 | ||
SET NOEXEC ON | ||
GO | ||
|
||
DECLARE @Success AS BIT | ||
|
||
SET @Success = 1 | ||
SET NOEXEC OFF | ||
|
||
IF (@Success = 1) | ||
PRINT 'The database update succeeded' | ||
ELSE | ||
BEGIN | ||
IF @@TRANCOUNT > 0 | ||
ROLLBACK TRANSACTION | ||
|
||
PRINT 'The database update failed' | ||
END | ||
GO |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
SET NOCOUNT ON | ||
IF OBJECT_ID('[$(DB_NAME)].[permit].[ORBC_LOA_PERMIT_TYPE_DETAILS]', 'U') IS NOT NULL | ||
AND OBJECT_ID('[$(DB_NAME)].[permit].[ORBC_LOA_VEHICLES]', 'U') IS NOT NULL | ||
AND OBJECT_ID('[$(DB_NAME)].[permit].[ORBC_LOA_DETAILS]', 'U') IS NOT NULL | ||
SELECT 1 | ||
ELSE | ||
SELECT 0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/bash | ||
|
||
# Retrieve arguments | ||
source ${SCRIPT_DIR}/utility/getopt.sh | ||
USAGE="-u USER -p PASS -s SERVER -d DATABASE" | ||
parse_options "${USAGE}" ${@} | ||
|
||
# All database tests for database version 32 are run from this shell script. | ||
# TESTS_DIR variable set by the calling test-runner script. | ||
|
||
TEST_32_1_RESULT=$(/opt/mssql-tools/bin/sqlcmd -U ${USER} -P "${PASS}" -S ${SERVER} -v DB_NAME=${DATABASE} -h -1 -i ${TESTS_DIR}/v_32_1_test.sql | xargs) | ||
if [[ $TEST_32_1_RESULT -eq 1 ]]; then | ||
echo "Test 32.1 passed: LOA tables are created correctly" | ||
else | ||
echo "******** Test 32.1 failed: LOA tables are created correctly" | ||
fi | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { Response } from 'express'; | ||
import { ClsServiceManager } from 'nestjs-cls'; | ||
|
||
/** | ||
* Sets the 'x-correlation-id' header in the response if it is not already set. | ||
* | ||
* @param {Response} response - The HTTP response object. | ||
*/ | ||
export const setResHeaderCorrelationId = (response: Response) => { | ||
const cls = ClsServiceManager.getClsService(); | ||
const correlationId = cls.getId(); | ||
if (!response.getHeader('x-correlation-id') && correlationId) { | ||
response.setHeader('x-correlation-id', correlationId); | ||
} | ||
}; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { Response } from 'express'; | ||
import { ClsServiceManager } from 'nestjs-cls'; | ||
|
||
/** | ||
* Sets the 'x-correlation-id' header in the response if it is not already set. | ||
* | ||
* @param {Response} response - The HTTP response object. | ||
*/ | ||
export const setResHeaderCorrelationId = (response: Response) => { | ||
const cls = ClsServiceManager.getClsService(); | ||
const correlationId = cls.getId(); | ||
if (!response.getHeader('x-correlation-id') && correlationId) { | ||
response.setHeader('x-correlation-id', correlationId); | ||
} | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can be an int instead of bigint. Please confirm with @john-fletcher-aot