You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Previously disabled auto-migration in a hotfix (#68). I realized that setting a common entrypoint for all containers to migrate the database, as I did in #56, caused a race condition where multiple containers were trying to run the migration at the same time. This caused squirrel-api to crash on my end.
This PR will only run the migration if the RUN_MIGRATIONS environment variable is set to "true". If it is set to something else or is missing then the migrations will not run. This is entrypoint should only be used for dev environments and we may want a separate entrypoint for prod.
Motivation
Auto migrating the database was nice while it lasted. I wanted it back after #68.
Pre-merge checklist
Code works interactively
Code contains descriptive docstrings
New/changed functions and methods are covered in the test suite where possible
In it's current state, the entrypoint does not try to handle the case of multiple alembic heads.
I may use alembic upgrade heads which will upgrade using all branches. Not sure if this behavior is desirable opposed to making sure we use just one branch/head.
zdomke
changed the title
FIX: Reenable Auto-Mmigration for Dev
FIX: Re-Enable Auto-Migration for Dev
Mar 31, 2026
In it's current state, the entrypoint does not try to handle the case of multiple alembic heads. I may use alembic upgrade heads which will upgrade using all branches. Not sure if this behavior is desirable opposed to making sure we use just one branch/head.
Decided against this as the main branch should probably only ever have one alembic branch. If it does have diverging branches, we should know more about why and how to handle it then.
For now, if there are multiple heads they should be merged using alembic merge heads.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Previously disabled auto-migration in a hotfix (#68). I realized that setting a common entrypoint for all containers to migrate the database, as I did in #56, caused a race condition where multiple containers were trying to run the migration at the same time. This caused
squirrel-apito crash on my end.This PR will only run the migration if the
RUN_MIGRATIONSenvironment variable is set to"true". If it is set to something else or is missing then the migrations will not run. This is entrypoint should only be used for dev environments and we may want a separate entrypoint for prod.Motivation
Auto migrating the database was nice while it lasted. I wanted it back after #68.
Pre-merge checklist