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

Database migration with an API and a worker #24

Closed
Icaro-Lima opened this issue Aug 1, 2020 · 3 comments
Closed

Database migration with an API and a worker #24

Icaro-Lima opened this issue Aug 1, 2020 · 3 comments

Comments

@Icaro-Lima
Copy link

Let's suppose that I have an API and a worker both using gue, what approach do you recommend for migrating the database?

Some ways that I had been though:

  1. The API migrate all models.
  2. The API and the worker try to migrate on initialization.

For the 1st, I am worried about the execution order.
For the 2nd, I am thinking about the shared code to enable this.

@vgarvardt
Copy link
Owner

Can you please elaborate? I'm not sure what kind of migration you are talking about. Is it about applying B migration to create required DB table? Or data migration on your app? Or maybe something else?

@Icaro-Lima
Copy link
Author

Ah, sorry, I am talking about DB migration to create the required table.

@vgarvardt
Copy link
Owner

Normally I use something like https://github.com/golang-migrate/migrate and run migrations on app bootstrap. It has lock inside, so when API and worker use the same db it is not a problem.

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

2 participants