-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschemas.sh
More file actions
executable file
·20 lines (16 loc) · 869 Bytes
/
schemas.sh
File metadata and controls
executable file
·20 lines (16 loc) · 869 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/bash
# sleep here for a different amount of time than other xq-engine containers.
# Running alembic setup in multiple containers simultanesously, with each container accessing the same db,
# creates non-unique key conflicts in the db.
sleep $ALEMBIC_SLEEP
if grep -iq $DEX /app/xq-engine/alembic/versions/*.py; then
echo "Alembic migration already exists; skipping creation of alembic migration for ${DEX}..."
else
echo "Alembic migration does not exist; creating alembic migration for ${DEX}..."
alembic -n default -c alembic/alembic.ini revision --autogenerate -m "creating schema for ${DEX}"
fi
alembic -n default -c alembic/alembic.ini upgrade head
# Update hasura/graphql metadata to track all tables/views
cd hasura_project
awk -v ip=$HASURA_IP "/HASURA_IP/{sub(/HASURA_IP/, ip)};{print}" config.yaml.template > config.yaml
hasura metadata apply