Skip to content

Commit

Permalink
Merge pull request #26 from imesh94/fix/opensource/account-metadata-d…
Browse files Browse the repository at this point in the history
…bscript

Fix account metadata dbscript issues
  • Loading branch information
SachiniSiriwardene authored Oct 11, 2023
2 parents e8e49bd + 2192630 commit 72fa47c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,15 @@
*/

--For account metadata feature run the following queries against the openbank_openbankingdb--
CREATE TABLE IF NOT EXISTS OB_ACCOUNT_METADATA (
ACCOUNT_ID VARCHAR(100) NOT NULL,
USER_ID VARCHAR(100) NOT NULL,
METADATA_KEY VARCHAR(100) NOT NULL,
METADATA_VALUE VARCHAR(100) NOT NULL,
LAST_UPDATE_TIMESTAMP DATETIME NOT NULL DEFAULT getdate(),
PRIMARY KEY (USER_ID,ACCOUNT_ID,METADATA_KEY)
);
IF OBJECT_ID('dbo.OB_ACCOUNT_METADATA', 'U') IS NULL
BEGIN
CREATE TABLE dbo.OB_ACCOUNT_METADATA
(
ACCOUNT_ID varchar(100) NOT NULL,
USER_ID varchar(100) NOT NULL,
METADATA_KEY varchar(100) NOT NULL,
METADATA_VALUE varchar(100) NOT NULL,
LAST_UPDATED_TIMESTAMP timestamp NOT NULL,
CONSTRAINT OB_ACCOUNT_USER_ATTRIBUTE_PK PRIMARY KEY (USER_ID,ACCOUNT_ID,METADATA_KEY)
)
END;
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ CREATE TABLE IF NOT EXISTS OB_ACCOUNT_METADATA (
USER_ID varchar(100) NOT NULL,
METADATA_KEY varchar(100) NOT NULL,
METADATA_VALUE varchar(100) NOT NULL,
LAST_UPDATE_TIMESTAMP timestamp DEFAULT CURRENT_TIMESTAMP NOT NULL,
LAST_UPDATED_TIMESTAMP timestamp DEFAULT CURRENT_TIMESTAMP NOT NULL,
PRIMARY KEY (USER_ID,ACCOUNT_ID,METADATA_KEY)
);
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ CREATE TABLE IF NOT EXISTS OB_ACCOUNT_METADATA (
USER_ID varchar(100) NOT NULL,
METADATA_KEY varchar(100) NOT NULL,
METADATA_VALUE varchar(100) NOT NULL,
LAST_UPDATE_TIMESTAMP TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
LAST_UPDATED_TIMESTAMP TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (USER_ID,ACCOUNT_ID,METADATA_KEY)
);

0 comments on commit 72fa47c

Please sign in to comment.