Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adds a flag for specifying the db name for migrations (#185)
## 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": ``` problem applying Hasura metadata: problem adding metadata for the buckets table: status_code: 400\nresponse: {"error":"source with name \"default\" does not exist","path":"$.args","code":"not-exists"} ``` (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 of `HASURA_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.
- Loading branch information