Allow custom migration table name#433
Open
sandbergja wants to merge 1 commit into
Open
Conversation
This was suggested by FrankP on the forum here: https://discourse.hanakai.org/t/customize-schema-migrations-table-name-on-a-gateway/1463 I implemented this as a configuration option in the hanami gem, so this has a sibling PR in the hanami gem. My reasoning was that this should be a relatively stable configuration option, rather than an argument that you need to remember to pass to `hanami db migrate` each time, since if you forget to specify your custom table name even once, you could potentially get your database into an odd state. However, I would definitely be open to other ideas -- I also wasn't sure what the best practice was for testing a configuration setting that isn't yet in the `hanami` gem, or for backwards compatibility. To try it out: 1. `hanami new octopus` 1. `cd octopus` 1. Adjust the gemfile to point to versions of `hanami` and `hanami-cli` with the relevant commits. 1. In `config/app.rb`, add `config.db.migrations_table = :hanami_migrations` 1. Use `hanami g migration` to create a new migration. Add a table to it. 1. `hanami db migrate` 1. Verify that your database does not have a table named `schema_migrations`, and that it instead has a table named `hanami_migrations`.
Contributor
|
ℹ️ Optional job failed: Ruby jruby |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This was suggested by FrankP on the forum. It has a sibling PR in
hanami: hanami/hanami#1615I implemented this as a configuration option in the hanami gem, so this has a sibling PR in the hanami gem. My reasoning was that this should be a relatively stable configuration option, rather than an argument that you need to remember to pass to
hanami db migrateeach time, since if you forget to specify your custom table name even once, you could potentially get your database into an odd state.However, I would definitely be open to other ideas -- I also wasn't sure what the best practice was for testing a configuration setting that isn't yet in the
hanamigem, or for backwards compatibility.To try it out:
hanami new octopuscd octopushanamiandhanami-cliwith the relevant commits.config/app.rb, addconfig.db.migrations_table = :hanami_migrationshanami g migrationto create a new migration. Add a table to it.hanami db migrateschema_migrations, and that it instead has a table namedhanami_migrations.