Skip to content

Commit

Permalink
ORV2-1496-V1: Changes For ORBC_PAYMENT_CARD_TYPE Table (#687)
Browse files Browse the repository at this point in the history
  • Loading branch information
gchauhan-aot authored Oct 26, 2023
1 parent 40f393a commit ff451dc
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 4 deletions.
1 change: 1 addition & 0 deletions database/mssql/scripts/versions/revert/v_7_ddl_revert.sql
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ BEGIN TRY
DROP TABLE [permit].[ORBC_TRANSACTION]
DROP TABLE [permit].[ORBC_TRANSACTION_TYPE]
DROP TABLE [permit].[ORBC_PAYMENT_METHOD_TYPE]
DROP TABLE [permit].[ORBC_PAYMENT_CARD_TYPE]
DROP SEQUENCE [permit].[ORBC_RECEIPT_NUMBER_SEQ]
DROP SEQUENCE [permit].[ORBC_TRANSACTION_NUMBER_SEQ]
COMMIT
Expand Down
48 changes: 44 additions & 4 deletions database/mssql/scripts/versions/v_7_ddl.sql
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ CREATE TABLE [permit].[ORBC_PAYMENT_METHOD_TYPE](
[PAYMENT_METHOD_TYPE] [int] IDENTITY(1,1) NOT NULL,
[NAME] [varchar] (20) NOT NULL,
[DESCRIPTION] [varchar] (50) NULL,
[PAYMENT_CARD_TYPE] [int] NOT NULL,
[APP_CREATE_TIMESTAMP] [datetime2](7) DEFAULT (getutcdate()),
[APP_CREATE_USERID] [nvarchar](30) DEFAULT (user_name()),
[APP_CREATE_USER_GUID] [char](32) NULL,
Expand All @@ -65,11 +66,30 @@ CREATE TABLE [permit].[ORBC_PAYMENT_METHOD_TYPE](
) ON [PRIMARY]
GO

SET IDENTITY_INSERT [permit].[ORBC_PAYMENT_METHOD_TYPE] ON
INSERT [permit].[ORBC_PAYMENT_METHOD_TYPE] ([PAYMENT_METHOD_TYPE], [NAME], [DESCRIPTION], [DB_CREATE_USERID], [DB_CREATE_TIMESTAMP], [DB_LAST_UPDATE_USERID], [DB_LAST_UPDATE_TIMESTAMP]) VALUES (1, N'Web', N'Web', N'dbo', GETUTCDATE(), N'dbo', GETUTCDATE())
INSERT [permit].[ORBC_PAYMENT_METHOD_TYPE] ([PAYMENT_METHOD_TYPE], [NAME], [DESCRIPTION], [DB_CREATE_USERID], [DB_CREATE_TIMESTAMP], [DB_LAST_UPDATE_USERID], [DB_LAST_UPDATE_TIMESTAMP]) VALUES (2, N'Icepay', N'Ice Pay', N'dbo', GETUTCDATE(), N'dbo', GETUTCDATE())
CREATE TABLE [permit].[ORBC_PAYMENT_CARD_TYPE](
[PAYMENT_CARD_TYPE] [int] IDENTITY(1,1) NOT NULL,
[PAYMENT_CARD_CODE] [varchar] (20) NOT NULL,
[NAME] [varchar] (20) NOT NULL,
[DESCRIPTION] [varchar] (50) 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) NULL,
[DB_CREATE_TIMESTAMP] [datetime2](7) NULL,
[DB_LAST_UPDATE_USERID] [varchar](63) NULL,
[DB_LAST_UPDATE_TIMESTAMP] [datetime2](7) NULL,
CONSTRAINT [ORBC_PAYMENT_CARD_TYPE_PK] PRIMARY KEY CLUSTERED
(
[PAYMENT_CARD_TYPE] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET IDENTITY_INSERT [permit].[ORBC_PAYMENT_METHOD_TYPE] OFF

CREATE TABLE [permit].[ORBC_TRANSACTION](
[TRANSACTION_ID] [bigint] IDENTITY(20000000,1) NOT NULL,
Expand Down Expand Up @@ -164,6 +184,26 @@ CREATE TABLE [permit].[ORBC_PERMIT_TRANSACTION](
) ON [PRIMARY]
GO

ALTER TABLE [permit].[ORBC_PAYMENT_METHOD_TYPE] WITH CHECK ADD CONSTRAINT [ORBC_PAYMENT_METHOD_PAYMENT_CARD_FK] FOREIGN KEY([PAYMENT_CARD_TYPE])
REFERENCES [permit].[ORBC_PAYMENT_CARD_TYPE] ([PAYMENT_CARD_TYPE])
GO

SET IDENTITY_INSERT [permit].[ORBC_PAYMENT_CARD_TYPE] ON
INSERT [permit].[ORBC_PAYMENT_CARD_TYPE] ([PAYMENT_CARD_TYPE], [PAYMENT_CARD_CODE], [NAME], [DESCRIPTION], [DB_CREATE_USERID], [DB_CREATE_TIMESTAMP], [DB_LAST_UPDATE_USERID], [DB_LAST_UPDATE_TIMESTAMP]) VALUES (1, N'Unknown', N'Unknown', N'Unknown', N'dbo', GETUTCDATE(), N'dbo', GETUTCDATE())
INSERT [permit].[ORBC_PAYMENT_CARD_TYPE] ([PAYMENT_CARD_TYPE], [PAYMENT_CARD_CODE], [NAME], [DESCRIPTION], [DB_CREATE_USERID], [DB_CREATE_TIMESTAMP], [DB_LAST_UPDATE_USERID], [DB_LAST_UPDATE_TIMESTAMP]) VALUES (2, N'VI', N'VISA', N'VISA', N'dbo', GETUTCDATE(), N'dbo', GETUTCDATE())
INSERT [permit].[ORBC_PAYMENT_CARD_TYPE] ([PAYMENT_CARD_TYPE], [PAYMENT_CARD_CODE], [NAME], [DESCRIPTION], [DB_CREATE_USERID], [DB_CREATE_TIMESTAMP], [DB_LAST_UPDATE_USERID], [DB_LAST_UPDATE_TIMESTAMP]) VALUES (3, N'MC', N'MasterCard', N'MasterCard', N'dbo', GETUTCDATE(), N'dbo', GETUTCDATE())
INSERT [permit].[ORBC_PAYMENT_CARD_TYPE] ([PAYMENT_CARD_TYPE], [PAYMENT_CARD_CODE], [NAME], [DESCRIPTION], [DB_CREATE_USERID], [DB_CREATE_TIMESTAMP], [DB_LAST_UPDATE_USERID], [DB_LAST_UPDATE_TIMESTAMP]) VALUES (4, N'AM', N'AMEX', N'AMEX', N'dbo', GETUTCDATE(), N'dbo', GETUTCDATE())
GO
SET IDENTITY_INSERT [permit].[ORBC_PAYMENT_CARD_TYPE] OFF

SET IDENTITY_INSERT [permit].[ORBC_PAYMENT_METHOD_TYPE] ON
INSERT [permit].[ORBC_PAYMENT_METHOD_TYPE] ([PAYMENT_METHOD_TYPE], [NAME], [DESCRIPTION], [PAYMENT_CARD_TYPE], [DB_CREATE_USERID], [DB_CREATE_TIMESTAMP], [DB_LAST_UPDATE_USERID], [DB_LAST_UPDATE_TIMESTAMP]) VALUES (1, N'Web', N'Web', 1, N'dbo', GETUTCDATE(), N'dbo', GETUTCDATE())
INSERT [permit].[ORBC_PAYMENT_METHOD_TYPE] ([PAYMENT_METHOD_TYPE], [NAME], [DESCRIPTION], [PAYMENT_CARD_TYPE], [DB_CREATE_USERID], [DB_CREATE_TIMESTAMP], [DB_LAST_UPDATE_USERID], [DB_LAST_UPDATE_TIMESTAMP]) VALUES (2, N'Web', N'Web', 2, N'dbo', GETUTCDATE(), N'dbo', GETUTCDATE())
INSERT [permit].[ORBC_PAYMENT_METHOD_TYPE] ([PAYMENT_METHOD_TYPE], [NAME], [DESCRIPTION], [PAYMENT_CARD_TYPE], [DB_CREATE_USERID], [DB_CREATE_TIMESTAMP], [DB_LAST_UPDATE_USERID], [DB_LAST_UPDATE_TIMESTAMP]) VALUES (3, N'Web', N'Web', 3, N'dbo', GETUTCDATE(), N'dbo', GETUTCDATE())
INSERT [permit].[ORBC_PAYMENT_METHOD_TYPE] ([PAYMENT_METHOD_TYPE], [NAME], [DESCRIPTION], [PAYMENT_CARD_TYPE], [DB_CREATE_USERID], [DB_CREATE_TIMESTAMP], [DB_LAST_UPDATE_USERID], [DB_LAST_UPDATE_TIMESTAMP]) VALUES (4, N'Web', N'Web', 4, N'dbo', GETUTCDATE(), N'dbo', GETUTCDATE())
INSERT [permit].[ORBC_PAYMENT_METHOD_TYPE] ([PAYMENT_METHOD_TYPE], [NAME], [DESCRIPTION], [PAYMENT_CARD_TYPE], [DB_CREATE_USERID], [DB_CREATE_TIMESTAMP], [DB_LAST_UPDATE_USERID], [DB_LAST_UPDATE_TIMESTAMP]) VALUES (5, N'Icepay', N'Ice Pay', 1, N'dbo', GETUTCDATE(), N'dbo', GETUTCDATE())
GO
SET IDENTITY_INSERT [permit].[ORBC_PAYMENT_METHOD_TYPE] OFF
ALTER TABLE [permit].[ORBC_PERMIT_TRANSACTION] ADD CONSTRAINT [ORBC_PERMIT_TRANSACTION_DB_CREATE_USERID_DEF] DEFAULT (user_name()) FOR [DB_CREATE_USERID]
ALTER TABLE [permit].[ORBC_PERMIT_TRANSACTION] ADD CONSTRAINT [ORBC_PERMIT_TRANSACTION_DB_CREATE_TIMESTAMP_DEF] DEFAULT (getutcdate()) FOR [DB_CREATE_TIMESTAMP]
ALTER TABLE [permit].[ORBC_PERMIT_TRANSACTION] ADD CONSTRAINT [ORBC_PERMIT_TRANSACTION_DB_LAST_UPDATE_USERID_DEF] DEFAULT (user_name()) FOR [DB_LAST_UPDATE_USERID]
Expand Down
1 change: 1 addition & 0 deletions database/mssql/test/versions/v_7_1_test.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ IF OBJECT_ID('[$(DB_NAME)].[permit].[ORBC_TRANSACTION]', 'U') IS NOT NULL
AND OBJECT_ID('[$(DB_NAME)].[permit].[ORBC_PERMIT_TRANSACTION]', 'U') IS NOT NULL
AND OBJECT_ID('[$(DB_NAME)].[permit].[ORBC_RECEIPT]', 'U') IS NOT NULL
AND OBJECT_ID('[$(DB_NAME)].[permit].[ORBC_PAYMENT_METHOD_TYPE]', 'U') IS NOT NULL
AND OBJECT_ID('[$(DB_NAME)].[permit].[ORBC_PAYMENT_CARD_TYPE]', 'U') IS NOT NULL
SELECT 1
ELSE
SELECT 0

0 comments on commit ff451dc

Please sign in to comment.