cli-migrations-v3 and unknown database name #8446
Unanswered
seanonthenet
asked this question in
Question
Replies: 1 comment
-
The database name should be specified in a connection string environment variable, not the database.yaml file, so it can be different in different environments like this e.g. database.yaml file: - name: MyDatabase
kind: mssql
configuration:
connection_info:
connection_string:
from_env: MY_DB_CONNECTION_STRING |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I need to be able to specify a different database name to apply metadata and migrations with cli-migrations-v3.
• I have spun up a Postgres database on render.com
• I can specify a database name ("default") but it always changed it to something else eg: default_dshj I'm sure because the server is shared and the name isn't available.
• I have created a Docker web service on render.com to pull my Hasura config from GitHub and apply migrations and metadata with the cli-migrations-v3 docker image
• The Dockerfile is:
• The migration is applied properly but it fails when it tries to apply and reload metadata obviously because my databases.yaml specifies the wrong database name as does the folder structure in metadata
How am I able to use cli-migrations-v3 without being able to set exactly what the database name will be beforehand in config.yaml and the metadata structure?
I have tried to write a renaming shell script to invoke from the Dockerfile and rename the three places where the database name is specified in metadata
• folder name: in
metadata/databases/default
• database yaml value in
metadata/databases/databases.yaml
eg- name: default
• string value in
metadata/databases/databases.yaml
egtables: "!include default/tables/tables.yaml"
This executes but I then get this error in the output:
{"level":"error","msg":"skipping applying migrations on database default_dshj, encountered: \nexpected to find a migrations directory for database default_dshj in /tmp/hasura-project/migrations, but encountered error: stat /tmp/hasura-project/migrations/default_dshj: no such file or directory","time":"2022-04-27T21:36:03Z"}
I'm not able to rename the database in my repo before committing, because it needs to match a parent Git repo in order to pull changes.
Not sure what else to do. Has Hasura got contingency for this?
Beta Was this translation helpful? Give feedback.
All reactions