Skip to content

Commit 09bd7bf

Browse files
authored
Adding liquibase for account service (#600)
* Adding +x to script, typos and remove verrazzano file * Repo updates for OL Changed repo for Oracle Linux to Oracle hosted repo * Typo in Dockerfile * Upgrading OKE and nodepool version to latest Current version 1.21.5 doesn't deploy properly. Upgrading to latest version * Updated README.md Changed the bit.ly URL * Initial check-in of sec workshop (#456) Initial check-in of sec workshop (#456) * Initial check in of Security Workshop (WMS8461) Initial check in of Security Workshop (WMS8461) * Initial check in of Security Workshop (WMS8461) * CLI Setup changes * Sample app Doc Update * Doc and SQL script updates * Created separate doc for the CLI stuff * cli doc changes * Removing CLI stuff * Doc updates * Doc bugs and Vault Documentation * Doc bugs and Vault docs * Vault Doc Updates * Setup doc fixes * Spell checking * Vault doc updates * Doc updates per Mark findings * Fix for k8s version and TF deprecated attr * Removed ssl_server_cert_dn from DBLINK * Remove _SSL_SERVER_CERT_DN vars * Adding back DB1_SSL_SERVER_CERT_DN * Vault doc updates * Vault doc updates * Setup and Vault changes * Typos * Added HashiCorp * Setup doc updates * Adding .gitignore for Hugo files * Rollback SSL_SERVER_CERT changes * Vault doc updates * PR fixes * Bugfixes * Vault doc update * Added Liquibase stuff * Liquibase stuff
1 parent e4bda13 commit 09bd7bf

File tree

4 files changed

+72
-4
lines changed

4 files changed

+72
-4
lines changed

cloudbank-v2/spring-apps/account/pom.xml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
<properties>
1919
<java.version>17</java.version>
2020
<oracle.jdbc.version>21.8.0.0</oracle.jdbc.version>
21+
<liquibase.version>4.19.0</liquibase.version>
2122
</properties>
2223
<dependencies>
2324
<dependency>
@@ -55,8 +56,11 @@
5556
<groupId>org.projectlombok</groupId>
5657
<artifactId>lombok</artifactId>
5758
</dependency>
58-
59-
59+
<dependency>
60+
<groupId>org.liquibase</groupId>
61+
<artifactId>liquibase-core</artifactId>
62+
<version>${liquibase.version}</version>
63+
</dependency>
6064
<dependency>
6165
<groupId>org.springframework.boot</groupId>
6266
<artifactId>spring-boot-starter-jersey</artifactId>
@@ -76,14 +80,12 @@
7680
<artifactId>jakarta.enterprise.cdi-api</artifactId>
7781
<version>2.0.2</version>
7882
</dependency>
79-
8083
<dependency>
8184
<groupId>org.springframework.boot</groupId>
8285
<artifactId>spring-boot-starter-test</artifactId>
8386
<scope>test</scope>
8487
</dependency>
8588
</dependencies>
86-
8789
<build>
8890
<plugins>
8991
<plugin>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
databaseChangeLog:
3+
- include:
4+
file: classpath:db/changelog/table.sql
5+
- include:
6+
file: classpath:db/changelog/data.sql
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
-- liquibase formatted sql
2+
3+
-- changeset gotsysdba:1 runAlways:true
4+
DELETE FROM ACCOUNT.JOURNAL;
5+
TRUNCATE TABLE ACCOUNT.ACCOUNTS;
6+
7+
INSERT INTO ACCOUNT.ACCOUNTS (ACCOUNT_NAME,ACCOUNT_TYPE,CUSTOMER_ID,ACCOUNT_OTHER_DETAILS,ACCOUNT_BALANCE)
8+
VALUES ('Andy''s checking','CH','qwertysdwr','Account Info',-20);
9+
INSERT INTO ACCOUNT.ACCOUNTS (ACCOUNT_NAME,ACCOUNT_TYPE,CUSTOMER_ID,ACCOUNT_OTHER_DETAILS,ACCOUNT_BALANCE)
10+
VALUES ('Mark''s CCard','CC','bkzLp8cozi','Mastercard account',1000);
11+
INSERT INTO ACCOUNT.ACCOUNTS (ACCOUNT_NAME,ACCOUNT_TYPE,CUSTOMER_ID,ACCOUNT_OTHER_DETAILS,ACCOUNT_BALANCE)
12+
VALUES ('Andy''s Saving','SA','qwertysdwr','Savings account',1035);
13+
INSERT INTO ACCOUNT.ACCOUNTS (ACCOUNT_NAME,ACCOUNT_TYPE,CUSTOMER_ID,ACCOUNT_OTHER_DETAILS,ACCOUNT_BALANCE)
14+
VALUES ('Sanjay''s Savings','SA','bkzLp8cozi','Savings Account',1040);
15+
INSERT INTO ACCOUNT.ACCOUNTS (ACCOUNT_NAME,ACCOUNT_TYPE,CUSTOMER_ID,ACCOUNT_OTHER_DETAILS,ACCOUNT_BALANCE)
16+
VALUES ('Sanjays Loan','LO','bkzLp8cozi','Car Loan',-80);
17+
INSERT INTO ACCOUNT.ACCOUNTS (ACCOUNT_NAME,ACCOUNT_TYPE,CUSTOMER_ID,ACCOUNT_OTHER_DETAILS,ACCOUNT_BALANCE)
18+
VALUES ('Mark''s Checking','CH','bkzLp8cozi','Checking Account',-1100);
19+
20+
--rollback DELETE FROM ACCOUNT.ACCOUNTS;
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
-- liquibase formatted sql
2+
3+
--changeset gotsysdba:1
4+
--preconditions onFail:MARK_RAN onerror:MARK_RAN
5+
--precondition-sql-check expectedResult:0 SELECT COUNT(*) FROM ACCOUNT.ACCOUNTS WHERE 1=2
6+
DROP TABLE ACCOUNT.ACCOUNTS;
7+
8+
--changeset gotsysdba:2
9+
--preconditions onFail:MARK_RAN onerror:MARK_RAN
10+
--precondition-sql-check expectedResult:0 SELECT COUNT(*) FROM ACCOUNT.JOURNAL WHERE 1=2
11+
DROP TABLE ACCOUNT.JOURNAL;
12+
13+
--changeset gotsysdba:3
14+
CREATE TABLE ACCOUNT.ACCOUNTS (
15+
ACCOUNT_ID NUMBER GENERATED ALWAYS AS IDENTITY (START WITH 1 CACHE 20),
16+
ACCOUNT_NAME VARCHAR2(40) NOT NULL,
17+
ACCOUNT_TYPE VARCHAR2(2) CHECK (ACCOUNT_TYPE IN ('CH', 'SA', 'CC', 'LO')),
18+
CUSTOMER_ID VARCHAR2 (20),
19+
ACCOUNT_OPENED_DATE DATE DEFAULT SYSDATE NOT NULL,
20+
ACCOUNT_OTHER_DETAILS VARCHAR2(4000),
21+
ACCOUNT_BALANCE NUMBER
22+
) LOGGING;
23+
ALTER TABLE ACCOUNT.ACCOUNTS ADD CONSTRAINT ACCOUNTS_PK PRIMARY KEY (ACCOUNT_ID) USING INDEX LOGGING;
24+
COMMENT ON TABLE ACCOUNT.ACCOUNTS is 'CLOUDBANK ACCOUNTS TABLE';
25+
26+
CREATE TABLE ACCOUNT.JOURNAL (
27+
JOURNAL_ID NUMBER GENERATED ALWAYS AS IDENTITY (START WITH 1 CACHE 20),
28+
JOURNAL_TYPE VARCHAR2(40) NOT NULL,
29+
LRA_ID VARCHAR2 (20),
30+
LRA_STATE VARCHAR2 (20),
31+
JOURNAL_AMOUNT NUMBER,
32+
ACCOUNT_ID NUMBER NOT NULL
33+
) LOGGING;
34+
ALTER TABLE ACCOUNT.JOURNAL ADD CONSTRAINT JOURNAL_PK PRIMARY KEY (JOURNAL_ID) USING INDEX LOGGING;
35+
ALTER TABLE ACCOUNT.JOURNAL ADD CONSTRAINT JOURNAL_ACCOUNT_FK FOREIGN KEY ( ACCOUNT_ID )
36+
REFERENCES ACCOUNT.ACCOUNTS ( ACCOUNT_ID );
37+
COMMENT ON TABLE ACCOUNT.JOURNAL is 'CLOUDBANK JOURNAL TABLE';
38+
39+
--rollback DROP TABLE ACCOUNT.ACCOUNTS;
40+
--rollback DROP TABLE ACCOUNT.JOURNAL;

0 commit comments

Comments
 (0)