-
Notifications
You must be signed in to change notification settings - Fork 17
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
add option to apply the diff #35
Comments
I'm not a huge fan of this use-case as it feels wrong directly applying a diff directly to the database. I'm not so much against having this feature in tusker but I'm highly against overloading the tbh. I'd recommend just piping the output of
The only downside is that you need to specify the connection parameters to the How about adding a That way you could just do the following:
It's still a bit against the spirit of tusker, but I like that much better than adding a I'd always recommend doing this instead:
As of now tusker never modifies existing databases. It only creates temporary databases to perform the diffing (using migra). That |
we could add a new The Agree that this brings Tusker into a completely new territory(modifying the database), but I this solves a huge problem for me. |
I'm currently in progress of rewriting Tusker in Rust and in the rewrite it will come with a built-in migration manager.
That migration file is crucial however as it might contain not just schema migrations but data migrations as well. Just think of adding a By keeping this a two step process it's always the same procedure. Do this on your local machine:
And then call
Just applying the new schema without a properly verified migration is a game changer, but in the very wrong direction. It's a loaded foot gun with the trigger half-pulled. You should never trust the output of
"Database as code" only works if you're starting fresh or you work with schemas that don't have any constraints and all fields are nullable. Which is a terrible database design to begin with.
Migration managers are nothing new. There are plenty of implementations available, which solve this problem quite well. Maybe I don't get what you're trying to do. Do you use |
I am trying to avoid using migration managers. I do agree that for production use then we should use a two steps process, 1-generate sql, 2-run/apply it. I also agree that migra has issues and I plan to fork and fix some since it appears that project is stale and abandoned. At this point I will close the issue and the PR since it's clear that we're going in different directions. |
@mingfang I'm curious. What's wrong with the idea of adding a
It follows the unix philosophy and it's clear what it does. As a neat side effect you can also use it to run arbitrary SQL code. |
Nothing wrong with it. |
Not sure if this thread is the right place to ask, but, did you check out postgres_migrator? It says in the readme:
|
@dlight I opened a new issue to discuss this: |
Add an option to the
diff
command to apply the diff(sql) to the database, instead of just printing it out. e.g.The text was updated successfully, but these errors were encountered: