Skip to content
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

feat(migration): add function to undo migrations #1675

Merged
merged 1 commit into from
Apr 7, 2022

Conversation

jdrouet
Copy link
Contributor

@jdrouet jdrouet commented Feb 4, 2022

Right now, there is only a run function to programatically run the
migrations, which is great, but nothing to run the migrations down.

This function adds the possibility to undo the migrations until a
specific version (could say -1 or 0 to remove them all).

With this feature, it's now possible, in the end to end or integration
tests to run the migrations and undo them between each test set and
therefore test the migrations themselves.

This is the kind of feature that some ORM have like sequelize in nodejs
that allow you to undo migrations programatically.

Reference to the doc:
https://sequelize.org/v7/manual/migrations.html#undoing-migrations

Signed-off-by: Jérémie Drouet jeremie.drouet@gmail.com

@jdrouet jdrouet force-pushed the jdrouet/sqlx-down-migration branch from cdd5074 to 497ca52 Compare February 4, 2022 19:26
@jdrouet jdrouet force-pushed the jdrouet/sqlx-down-migration branch from 497ca52 to 3f72df2 Compare February 7, 2022 20:07
@jdrouet
Copy link
Contributor Author

jdrouet commented Feb 9, 2022

There's not maintainer assigned automagically, so I'll ping you, I hope you won't mind.
@mehcode @abonander @danielakhterov @jplatte

@abonander
Copy link
Collaborator

We get to PRs when we get to them. Pinging people on this repo is just going to fill up their notifications.

@jdrouet jdrouet force-pushed the jdrouet/sqlx-down-migration branch from 3f72df2 to 17273cb Compare March 16, 2022 19:05
@jdrouet
Copy link
Contributor Author

jdrouet commented Mar 16, 2022

I just rebased this PR on lastest master 😉

Right now, there is only a `run` function to programatically run the
migrations, which is great, but nothing to run the migrations down.

This function adds the possibility to undo the migrations until a
specific version (could say -1 or 0 to remove them all).

With this feature, it's now possible, in the end to end or integration
tests to run the migrations and undo them between each test set and
therefore test the migrations themselves.

This is the kind of feature that some ORM have like sequelize in nodejs
that allow you to undo migrations programatically.

Reference to the doc:
https://sequelize.org/v7/manual/migrations.html#undoing-migrations

Signed-off-by: Jérémie Drouet <jeremie.drouet@gmail.com>
@jdrouet jdrouet force-pushed the jdrouet/sqlx-down-migration branch from 17273cb to 184f853 Compare March 23, 2022 19:41
@abonander abonander merged commit 0c95fdd into launchbadge:master Apr 7, 2022
@jdrouet
Copy link
Contributor Author

jdrouet commented Apr 8, 2022

🎉 Thanks @abonander
If you need some help to maintain sqlx, it'd be happy to help 😉

@abonander
Copy link
Collaborator

If you're ever bored, feel free to follow up on old issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants