Compare commits
No commits in common. "f3e2f8de927b0809b557bb096e0cb7eac317b693" and "0be34689ec7128a9daf88a004ba5cc93c79b07b0" have entirely different histories.
f3e2f8de92
...
0be34689ec
4 changed files with 2 additions and 29 deletions
|
|
@ -1,10 +1,7 @@
|
||||||
FROM alpine
|
FROM alpine
|
||||||
|
|
||||||
ADD combined_update_ddl.sql /init.sql
|
ADD combined_update_ddl.sql /init.sql
|
||||||
ADD init.sh /init.sh
|
|
||||||
|
|
||||||
RUN apk add --update --no-cache postgresql-client
|
RUN apk add --update --no-cache postgresql-client
|
||||||
RUN chmod +x init.sh
|
|
||||||
RUN find . -name "*.sh" | xargs sed -i 's/\r$//'
|
|
||||||
|
|
||||||
ENTRYPOINT [ "./init.sh" ]
|
CMD [ "sh", "-c", "ls -la && psql --version && psql -U clearing -h db -p 5432 -d clearing -f ./init.sql && tail -f /dev/null" ]
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
#!/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
|
|
||||||
|
|
@ -15,8 +15,6 @@ services:
|
||||||
|
|
||||||
db-updater:
|
db-updater:
|
||||||
build: db-updater
|
build: db-updater
|
||||||
environment:
|
|
||||||
- PGPASSWORD=Aa111111
|
|
||||||
depends_on:
|
depends_on:
|
||||||
db:
|
db:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
|
|
|
||||||
|
|
@ -117,10 +117,8 @@ def combine_ddl_updates_into_file():
|
||||||
logging.info(f"Combining DDLs...")
|
logging.info(f"Combining DDLs...")
|
||||||
pattern = re.compile(r'updateDDL_(\d+)\.(\d+)\.sql$')
|
pattern = re.compile(r'updateDDL_(\d+)\.(\d+)\.sql$')
|
||||||
|
|
||||||
logging.info(f"Currently found files = {os.listdir(f'{CLR_TEST_DIR}/clearing-all/db')}")
|
|
||||||
|
|
||||||
files = []
|
files = []
|
||||||
for filepath in glob(f"{CLR_TEST_DIR}/clearing-all/db/updateDDL_*.sql"):
|
for filepath in glob(f"{CLR_TEST_DIR}/db/updateDDL_*.sql"):
|
||||||
filename = os.path.basename(filepath)
|
filename = os.path.basename(filepath)
|
||||||
match = pattern.search(filename)
|
match = pattern.search(filename)
|
||||||
if match:
|
if match:
|
||||||
|
|
@ -129,7 +127,6 @@ def combine_ddl_updates_into_file():
|
||||||
files.append(((major, minor), filepath))
|
files.append(((major, minor), filepath))
|
||||||
|
|
||||||
files.sort(key=lambda x: x[0])
|
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:
|
with open(f"{CLR_TEST_DIR}/db-updater/combined_update_ddl.sql", 'w', encoding='utf-8') as outfile:
|
||||||
for version, filepath in files:
|
for version, filepath in files:
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue