Replies: 4 comments
-
Thanks for writing this proposal. Could you elaborate on how such a |
Beta Was this translation helpful? Give feedback.
-
This could be possibly implemented by resetting DB, running all migrations and then creating SQL dump of the result that would replace all existing migrations? Still, doesn't seem too useful for me. I'd use some database GUI like dbeaver etc to inspect your database, not your migrations. One possible use I can see is when your migrations have some dependency you no longer use. For example I use pg_sphinx extensions to implement my fulltext search etc. If I ever switched to different fulltext solution, I'd probably want to remove mentions of this from my past migrations so I wouldn't need to have this extensions to re-run my migrations. Doing such combine would solve it. But it would be probably easy to do it manually and such use case would be pretty rare, so I don't think it would be worth the effort to implement in in diesel(-cli). |
Beta Was this translation helpful? Give feedback.
-
Thank you both for taking a look! As @mjanda suggested, I was thinking you could use the database instance to do the reconciliation. aka. the diesel CLI would do:
I also agree with @mjanda that combining migrations manually would be sufficient. Maybe we could introduce the concept of a "snapshot" migration (vs. the existing incremental one) that tells diesel to skip previous incremental migrations?
|
Beta Was this translation helpful? Give feedback.
-
Actually, I might be able to get the experience I want with the pg-schema-diff. E.g.
I will try this out next time I make db edits and report back. |
Beta Was this translation helpful? Give feedback.
-
Migrations are very useful while iterating. However, I find that after a few migrations it's hard to go through them and understand what the current database schema actually is. For example, let's say I do the following:
orders
with anid TEXT
columnname
field to the tablename
field tocustomer_name
orders
table to be a composite (customer_name
,orders
)In theory, you could then do a
combine
operation that generates an equivalent SQL statement to create theorders
table as it is now, e.g.After that, you could clean up the old migrations and build on top of it.
Is a
combine
feature something others would find useful?Beta Was this translation helpful? Give feedback.
All reactions