-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ability to auto-generate alembic migrations
We move to a slightly more general model where we can support specific Alembic operations passed as arguments. This was very useful to easily run the auto-generated migrations.
- Loading branch information
Showing
5 changed files
with
23 additions
and
14 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file was deleted.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/bash -e | ||
|
||
cd lib/pbench/server/database | ||
|
||
# First we run all our migrations to bring the blank database up to speed. | ||
alembic upgrade head | ||
|
||
if [[ "${1}" == "check" ]]; then | ||
# We have been asked to check to see if there are any model changes not | ||
# captured in existing migrations. | ||
alembic check | ||
elif [[ "${1}" == "create" ]]; then | ||
# We have been asked to auto-generate a migration based on the existing | ||
# model compared against the most recent migration "head". | ||
alembic revision --autogenerate | ||
else | ||
printf "Unsupported operation requested, '%s'\n" "${1}" >&2 | ||
exit 1 | ||
fi |
This file contains 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