Skip to content

Commit ed14d4d

Browse files
Mateusz Czeladkaclaude
andcommitted
refactor: standardize database schema to use public schema
Replace network-specific schemas (mainnet, preprod) with the public schema consistently across all configurations. Changes: - Update DB_SCHEMA to 'public' in docker-compose and integration test configs - Modify JDBC URLs to use currentSchema=public as default - Update entrypoint.sh to set DB_SCHEMA=public instead of network name - Fix UPDATE_GENESIS_BLOCK_QUERY to use quoted "public" schema This simplifies database management by using a single schema regardless of the network being used. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent e978190 commit ed14d4d

File tree

6 files changed

+8
-8
lines changed

6 files changed

+8
-8
lines changed

.env.IntegrationTest

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ DB_SECRET=weakpwd#123_d
1616
DB_HOST=db
1717
# Service name in docker-compose or local db
1818
DB_PORT=5432
19-
DB_SCHEMA=${NETWORK}
19+
DB_SCHEMA=public
2020
DB_PATH=data
21-
UPDATE_GENESIS_BLOCK_QUERY="UPDATE devkit.block SET number = 0 WHERE number = -1; UPDATE devkit.block SET prev_hash = 'Genesis' WHERE number = 1"
22-
#UPDATE_GENESIS_BLOCK_QUERY="UPDATE devkit.block SET prev_hash = 'Genesis' WHERE number = 1"
21+
UPDATE_GENESIS_BLOCK_QUERY="UPDATE \"public\".block SET number = 0 WHERE number = -1; UPDATE \"public\".block SET prev_hash = 'Genesis' WHERE number = 1"
22+
#UPDATE_GENESIS_BLOCK_QUERY="UPDATE \"public\".block SET prev_hash = 'Genesis' WHERE number = 1"
2323

2424
## Cardano Node variables
2525
CARDANO_NODE_HOST=yaci-cli

.env.docker-compose

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ DB_SECRET=weakpwd#123_d
1616
DB_HOST=db
1717
# Service name in docker-compose or local db
1818
DB_PORT=5432
19-
DB_SCHEMA=${NETWORK}
19+
DB_SCHEMA=public
2020
DB_PATH=data
2121

2222
## Cardano Node variables

api/src/main/resources/config/application-online.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ spring:
99
datasource:
1010
username: ${DB_USER:rosetta_db_admin}
1111
password: ${DB_SECRET:weakpwd#123_d}
12-
url: jdbc:postgresql://${DB_HOST:localhost}:${DB_PORT:5433}/${DB_NAME:test}?currentSchema=${DB_SCHEMA:preprod}
12+
url: jdbc:postgresql://${DB_HOST:localhost}:${DB_PORT:5433}/${DB_NAME:test}?currentSchema=${DB_SCHEMA:public}
1313
hikari:
1414
poolName: "CardanoRosettaJavaDBPool"
1515

api/src/main/resources/config/application-staging.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ spring:
55
datasource:
66
username: rosetta_db_service_user
77
password: weakerpwd#123_d
8-
url: jdbc:postgresql://172.16.1.217:5432/rosetta?currentSchema=${DB_SCHEMA:preprod}
8+
url: jdbc:postgresql://172.16.1.217:5432/rosetta?currentSchema=${DB_SCHEMA:public}
99
jpa:
1010
properties:
1111
hibernate:

docker/entrypoint.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ start_postgres() {
173173
}
174174

175175
create_database_and_user() {
176-
export DB_SCHEMA="$NETWORK"
176+
export DB_SCHEMA=public
177177

178178
flag=true
179179
while [ $(sudo -u postgres "$PG_BIN/psql" -U postgres -Atc "SELECT pg_is_in_recovery()";) == "t" ]; do

yaci-indexer/src/main/resources/application-postgres.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
####################################################
55

66
##################### Postgres DB #######################
7-
spring.datasource.url=jdbc:postgresql://${DB_HOST:localhost}:${DB_PORT:5433}/${DB_NAME:rosetta-java}?currentSchema=${DB_SCHEMA:preprod}
7+
spring.datasource.url=jdbc:postgresql://${DB_HOST:localhost}:${DB_PORT:5433}/${DB_NAME:rosetta-java}?currentSchema=${DB_SCHEMA:public}
88
spring.datasource.username=${DB_USER:rosetta_db_admin}
99
spring.datasource.password=${DB_SECRET:weakpwd#123_d}
1010

0 commit comments

Comments
 (0)