Skip to content
This repository was archived by the owner on Jan 20, 2024. It is now read-only.

Commit affaa3e

Browse files
committed
fixes #76 update postgres and oracle db scripts to remove tables in the beginning
1 parent 47726d8 commit affaa3e

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

db/oracle/create_oracle.sql

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1+
DROP TABLE client_service CASCADE CONSTRAINTS;
2+
DROP TABLE service_endpoint CASCADE CONSTRAINTS;
3+
DROP TABLE service CASCADE CONSTRAINTS;
4+
DROP TABLE client CASCADE CONSTRAINTS;
15
DROP TABLE user_profile CASCADE CONSTRAINTS;
6+
DROP TABLE audit_log CASCADE CONSTRAINTS;
7+
28
CREATE TABLE user_profile (
39
user_id VARCHAR2(32) NOT NULL,
410
user_type VARCHAR2(16) NOT NULL, -- admin, customer, employee, partner
@@ -11,7 +17,6 @@ CREATE TABLE user_profile (
1117

1218
CREATE UNIQUE INDEX email_idx ON user_profile(email);
1319

14-
DROP TABLE client CASCADE CONSTRAINTS;
1520
CREATE TABLE client (
1621
client_id VARCHAR2(36) NOT NULL,
1722
client_type VARCHAR2(12) NOT NULL, -- public, confidential, trusted
@@ -30,7 +35,6 @@ CREATE TABLE client (
3035
REFERENCES user_profile(user_id)
3136
);
3237

33-
DROP TABLE service CASCADE CONSTRAINTS;
3438
CREATE TABLE service (
3539
service_id VARCHAR2(32) NOT NULL,
3640
service_type VARCHAR2(16) NOT NULL, -- swagger, openapi, graphql, hybrid
@@ -44,7 +48,6 @@ CREATE TABLE service (
4448
REFERENCES user_profile(user_id)
4549
);
4650

47-
DROP TABLE service_endpoint CASCADE CONSTRAINTS;
4851
CREATE TABLE service_endpoint (
4952
service_id VARCHAR2(32) NOT NULL,
5053
endpoint VARCHAR2(256) NOT NULL, -- different framework will have different endpoint format.
@@ -54,7 +57,6 @@ CREATE TABLE service_endpoint (
5457
CONSTRAINT service_endpoint_service_fk FOREIGN KEY (service_id) REFERENCES service(service_id)
5558
);
5659

57-
DROP TABLE client_service CASCADE CONSTRAINTS;
5860
CREATE TABLE client_service (
5961
client_id VARCHAR2(36) NOT NULL,
6062
service_id VARCHAR2(32) NOT NULL,
@@ -64,7 +66,6 @@ CREATE TABLE client_service (
6466
CONSTRAINT client_service_client_fk FOREIGN KEY (client_id) REFERENCES client(client_id)
6567
);
6668

67-
DROP TABLE audit_log CASCADE CONSTRAINTS;
6869
create table audit_log (
6970
log_id INT, -- system milliseonds from 1970.
7071
service_id VARCHAR2(32) NOT NULL,

db/postgres/create_postgres.sql

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1+
DROP TABLE IF EXISTS client_service;
2+
DROP TABLE IF EXISTS service_endpoint;
3+
DROP TABLE IF EXISTS service;
4+
DROP TABLE IF EXISTS client;
15
DROP TABLE IF EXISTS user_profile;
6+
DROP TABLE IF EXISTS audit_log;
7+
8+
29
CREATE TABLE user_profile (
310
user_id VARCHAR(32) NOT NULL,
411
user_type VARCHAR(16) NOT NULL, -- admin, customer, employee, partner
@@ -11,7 +18,6 @@ CREATE TABLE user_profile (
1118

1219
CREATE UNIQUE INDEX email_idx ON user_profile(email);
1320

14-
DROP TABLE IF EXISTS client;
1521
CREATE TABLE client (
1622
client_id VARCHAR(36) NOT NULL,
1723
client_type VARCHAR(12) NOT NULL, -- public, confidential, trusted
@@ -28,7 +34,6 @@ CREATE TABLE client (
2834
FOREIGN KEY (owner_id) REFERENCES user_profile(user_id)
2935
);
3036

31-
DROP TABLE IF EXISTS service;
3237
CREATE TABLE service (
3338
service_id VARCHAR(32) NOT NULL,
3439
service_type VARCHAR(16) NOT NULL, -- swagger, openapi, graphql, hybrid
@@ -40,7 +45,6 @@ CREATE TABLE service (
4045
FOREIGN KEY (owner_id) REFERENCES user_profile(user_id)
4146
);
4247

43-
DROP TABLE IF EXISTS service_endpoint;
4448
CREATE TABLE service_endpoint (
4549
service_id VARCHAR(32) NOT NULL,
4650
endpoint VARCHAR(256) NOT NULL, -- different framework will have different endpoint format.
@@ -51,7 +55,6 @@ CREATE TABLE service_endpoint (
5155
);
5256

5357

54-
DROP TABLE IF EXISTS client_service;
5558
CREATE TABLE client_service (
5659
client_id VARCHAR(36) NOT NULL,
5760
service_id VARCHAR(32) NOT NULL,
@@ -61,7 +64,6 @@ CREATE TABLE client_service (
6164
FOREIGN KEY (client_id) REFERENCES client(client_id)
6265
);
6366

64-
DROP TABLE IF EXISTS audit_log;
6567
create table audit_log (
6668
log_id INT, -- system milliseonds from 1970.
6769
service_id VARCHAR(32) NOT NULL,

0 commit comments

Comments
 (0)