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

How to run up/down migration before service starts? #1033

Open
shengchaohua opened this issue Jan 22, 2024 · 0 comments
Open

How to run up/down migration before service starts? #1033

shengchaohua opened this issue Jan 22, 2024 · 0 comments

Comments

@shengchaohua
Copy link

Hi, all

We put the migration sql files in our codebase and they are embed into our program. We just add a command flag migrate into our main function, so that the up migrate can be run before our service starts.

The question is that we can not run down migration when our service needs downgrade, because the downgraded docker image (golang binary) does not have the corresponding migration files.

For example, the program is v1.0, then we upgrade it v1.1 and do some up migrates. Once we downgrade to v1.0, the docker images of v1.0 doesnot have the migration files.

Does anyone has any idea?

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

No branches or pull requests

1 participant