Compare commits

...

10 commits

Author SHA1 Message Date
Ivan Nikolaev-Axenov
f3e2f8de92 debug fix v16 2025-05-30 17:19:40 +03:00
Ivan Nikolaev-Axenov
4a997ce387 debug fix v15 2025-05-30 17:05:35 +03:00
Ivan Nikolaev-Axenov
59759c4151 debug fix v14 2025-05-30 16:51:39 +03:00
Ivan Nikolaev-Axenov
7f72221586 debug fix v13 2025-05-30 16:38:37 +03:00
Ivan Nikolaev-Axenov
3fa6fe0760 debug fix v12 2025-05-30 16:23:57 +03:00
Ivan Nikolaev-Axenov
d4820eb459 debug fix v11 2025-05-30 16:14:02 +03:00
Ivan Nikolaev-Axenov
04a9e11a67 debug fix v10 2025-05-30 16:03:23 +03:00
Ivan Nikolaev-Axenov
64b1505c86 debug fix v9 2025-05-30 13:51:46 +03:00
Ivan Nikolaev-Axenov
5f891993a8 debug fix v8 2025-05-30 13:38:59 +03:00
Ivan Nikolaev-Axenov
1ebb217897 debug fix v7 2025-05-30 13:30:26 +03:00
4 changed files with 29 additions and 2 deletions

View file

@ -1,7 +1,10 @@
FROM alpine
ADD combined_update_ddl.sql /init.sql
ADD init.sh /init.sh
RUN apk add --update --no-cache postgresql-client
RUN chmod +x init.sh
RUN find . -name "*.sh" | xargs sed -i 's/\r$//'
CMD [ "sh", "-c", "ls -la && psql --version && psql -U clearing -h db -p 5432 -d clearing -f ./init.sql && tail -f /dev/null" ]
ENTRYPOINT [ "./init.sh" ]

View file

@ -0,0 +1,19 @@
#!/bin/sh
until pg_isready -U clearing -h db -p 5432 -d clearing -t 1; do
echo "Waiting for database to be ready..."
sleep 2
done
echo "PSQL version: $(psql --version)"
echo "DB password is $PGPASSWORD"
echo "Database connection test:"
psql -U clearing -h db -p 5432 -d clearing -c "SELECT 'Database is connected!' AS status"
echo "Executing SQL file:"
cat init.sql
echo "Updating database"
psql -U clearing -h db -p 5432 -d clearing -f init.sql
tail -f /dev/null

View file

@ -15,6 +15,8 @@ services:
db-updater:
build: db-updater
environment:
- PGPASSWORD=Aa111111
depends_on:
db:
condition: service_healthy

View file

@ -117,8 +117,10 @@ def combine_ddl_updates_into_file():
logging.info(f"Combining DDLs...")
pattern = re.compile(r'updateDDL_(\d+)\.(\d+)\.sql$')
logging.info(f"Currently found files = {os.listdir(f'{CLR_TEST_DIR}/clearing-all/db')}")
files = []
for filepath in glob(f"{CLR_TEST_DIR}/db/updateDDL_*.sql"):
for filepath in glob(f"{CLR_TEST_DIR}/clearing-all/db/updateDDL_*.sql"):
filename = os.path.basename(filepath)
match = pattern.search(filename)
if match:
@ -127,6 +129,7 @@ def combine_ddl_updates_into_file():
files.append(((major, minor), filepath))
files.sort(key=lambda x: x[0])
logging.info(f"Found files: {files}")
with open(f"{CLR_TEST_DIR}/db-updater/combined_update_ddl.sql", 'w', encoding='utf-8') as outfile:
for version, filepath in files: