New migration
This commit is contained in:
parent
5dde39eb37
commit
19e30eaf0a
|
@ -1,8 +1,8 @@
|
||||||
"""add flags to user
|
"""add flags to the user model
|
||||||
|
|
||||||
Revision ID: 98040e190381
|
Revision ID: 088f23324464
|
||||||
Revises: 0aaad1740797
|
Revises: e866ad0e78e1
|
||||||
Create Date: 2022-05-03 17:31:58.559032
|
Create Date: 2022-05-12 13:32:30.898367
|
||||||
|
|
||||||
"""
|
"""
|
||||||
import sqlalchemy_utils
|
import sqlalchemy_utils
|
||||||
|
@ -11,8 +11,8 @@ import sqlalchemy as sa
|
||||||
|
|
||||||
|
|
||||||
# revision identifiers, used by Alembic.
|
# revision identifiers, used by Alembic.
|
||||||
revision = '98040e190381'
|
revision = '088f23324464'
|
||||||
down_revision = '0aaad1740797'
|
down_revision = 'e866ad0e78e1'
|
||||||
branch_labels = None
|
branch_labels = None
|
||||||
depends_on = None
|
depends_on = None
|
||||||
|
|
16
scripts/new-migration.sh
Normal file → Executable file
16
scripts/new-migration.sh
Normal file → Executable file
|
@ -2,9 +2,17 @@
|
||||||
# To run it:
|
# To run it:
|
||||||
# sh scripts/new-migration.sh
|
# sh scripts/new-migration.sh
|
||||||
|
|
||||||
|
container_name=sl-db-new-migration
|
||||||
|
|
||||||
|
if [ "$#" -lt "1" ]; then
|
||||||
|
echo "What is this migration for?"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
reason="$@"
|
||||||
|
|
||||||
# create a postgres database for SimpleLogin
|
# create a postgres database for SimpleLogin
|
||||||
docker rm -f sl-db
|
docker rm -f ${container_name}
|
||||||
docker run -p 25432:5432 --name sl-db -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=sl -d postgres:13
|
docker run -p 25432:5432 --name ${container_name} -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=sl -d postgres:13
|
||||||
|
|
||||||
# sleep a little bit for the db to be ready
|
# sleep a little bit for the db to be ready
|
||||||
sleep 3
|
sleep 3
|
||||||
|
@ -13,7 +21,7 @@ sleep 3
|
||||||
env DB_URI=postgresql://postgres:postgres@127.0.0.1:25432/sl poetry run alembic upgrade head
|
env DB_URI=postgresql://postgres:postgres@127.0.0.1:25432/sl poetry run alembic upgrade head
|
||||||
|
|
||||||
# generate the migration script.
|
# generate the migration script.
|
||||||
env DB_URI=postgresql://postgres:postgres@127.0.0.1:25432/sl poetry run alembic revision --autogenerate
|
env DB_URI=postgresql://postgres:postgres@127.0.0.1:25432/sl poetry run alembic revision --autogenerate -m "$reason"
|
||||||
|
|
||||||
# remove the db
|
# remove the db
|
||||||
docker rm -f sl-db
|
docker rm -f ${container_name}
|
||||||
|
|
Loading…
Reference in a new issue