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

Run migrations automatically when a Docker container starts #342

Open
2 tasks
JVT038 opened this issue May 12, 2023 · 7 comments · May be fixed by #623
Open
2 tasks

Run migrations automatically when a Docker container starts #342

JVT038 opened this issue May 12, 2023 · 7 comments · May be fixed by #623
Labels
Milestone

Comments

@JVT038
Copy link
Collaborator

JVT038 commented May 12, 2023

Just add some commands to the Docker script to check for new migrations and if there are any, execute them.
This will prevent issues where users forget to run migrations on new versions.

TODO:

@leepeuker
Copy link
Owner

Hm, I would say let us make this configurable via a environment variable? It seems like a potential risk running db migrations automatically on container start, I think I would prefer you have to explicitly define it when you want database migrations executed automatically. We can document this as the default way to run the containers in the README

@JVT038
Copy link
Collaborator Author

JVT038 commented May 16, 2023

What risks do you think there are?

@leepeuker
Copy link
Owner

Hm, mainly that changes to the database could potentially cause harm (like migrations causing data lose). I think it mainly feels wrong to me, but I cannot really put it into words why, which sucks. I tried to search for best practices or discussions about this topic online, but could not find anything really useful yet.

@DrMxrcy
Copy link

DrMxrcy commented Sep 12, 2023

I have seen apps implement checks to see what new migrations need to be ran.

@starsoccer
Copy link

+1 to this, it makes self hosting this much easier. Most apps do not require a manual migrations step be run and simply updating a docker image will handle it natively

@dwradcliffe
Copy link

In a professional environment we do this. And basically all other self-hosted apps I've seen do this as well (Home Assistant and Paperless-ngx off the top of my head).

@leepeuker
Copy link
Owner

Yes I agree now, I would like to see this added as well, espscially in the context of the docker refactoring. Let's hope someone will find the time for this (not sure when I will sadly)

@leepeuker leepeuker added this to the Version 1.0 milestone Dec 17, 2024
@JVT038 JVT038 linked a pull request Dec 18, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants