-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
After Re-open REPL, migration exception will throw when go
#1
Comments
|
Yes, a better error message would be useful here. The Ragtime migrator can't rollback migrations it doesn't have in memory. One thing I'm considering is to make Ragtime's migrations serializable via something like Nippy, and then add them to a blob in the |
it depends on the designer decision. but "serialization" solution might be quite hard. what if the serialized .down.sql is not valid? During the development time, .up.sql may be okay, since it must be run before serializing to |
Yes, that's true, though I want to encourage higher-level migrations in future so that people aren't writing up and down migrations manually. That said, I expect there will always be some migrations that we'll need to write in bare SQL. Another option might be to simply to clear the database if a migration cannot be rolled back (obviously in development only). |
Having this sort of nuclear option in some form sounds attractive to me as I've had to do it manually to the database in development after having written bad migrations. |
@isker In this case, I am simply drop a DB schema (or schemas) and create again before evaluating
|
So what's the current solution if we want to edit the migration string or file, then let ragtime rollback the migration and re-apply the now-changed migration? (for local development obviously) |
It just needs the applied migration to be in memory. So currently you migrate, then work on the migration, then migrate again, etc. |
Got it. Thanks. |
After using it for a long time, I have some suggestions to make it easier for certain usage patterns.
Edit: The current changes already fix 2,3 points! marvelous! |
Thanks for the feedback! I've actually already addressed points 2 and 3 in the latest version, which loads migrations from an edn file. I've also added syntax sugar for common operations that should reduce mistakes. A migration file might now look like: [[:create-table example
(id "INTEGER PRIMARY KEY")
(name "TEXT")
(modified_at "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")]
[:create-unique-index example_name (name)]
{:id "custom_migration"
:up ["..."]
:down ["..."]}] I'm currently working on making the migration index persistent across REPL restarts. You can migrate a Duct application without starting it just by limiting the keys to |
Currently, if we changed the migration string,
(dev)
and(go)
, then ragtime will simply throwIllegalArgumentException No implementation of method: :run-down! of protocol: #'ragtime.protocols/Migration found for class: nil clojure.core/-cache-protocol-fn (core_deftype.clj:583)
If we already
(dev)
and(go)
, then change the migration string and(reset)
we have no exception.it seems due to lack of
index
which have the previous auto-hash-idsIt would be better to warn instead of throwing unknown exception.
The text was updated successfully, but these errors were encountered: