adds a flag for specifying the db name for migrations #185
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
Currently, it seems that the name of the target database for migrations is fixed to "default." This produces the following error when there is no database named "default":
(see #184 (comment))
Solution
To address this issue and provide more flexibility in configuring the target database for migrations, we propose the following solution:
Environment Variable: Introduce a new environment variable named
HASURA_DB_NAME
to allow users to specify the target database name for migrations.Configuration Update: Modify the code in
hasura-storage/migrations/hasura.go
to use the value ofHASURA_DB_NAME
as the target database name. This ensures that users can configure the target database dynamically.Fallback to "default": If
HASURA_DB_NAME
is not set, the code should default to "default" to maintain backward compatibility.Notes
Users can set the
HASURA_DB_NAME
environment variable to configure the target database for migrations to their desired database name.This change enhances the flexibility of the migration process, especially in cases where the database name is not "default."
Reviewers are encouraged to verify that the documentation has been updated to reflect the new configuration option.
With this solution, users can customize the target database for migrations by setting the
HASURA_DB_NAME
environment variable, which eliminates the error associated with the fixed "default" database name.