2020-05-07 23:59:21 +08:00
|
|
|
# Generate a new migration script using Docker
|
|
|
|
# To run it:
|
|
|
|
# sh new_migration.sh
|
|
|
|
|
|
|
|
# create a postgres database for SimpleLogin
|
|
|
|
docker rm -f sl-db
|
2020-10-20 22:50:13 +08:00
|
|
|
docker run -p 15432:5432 --name sl-db -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=sl -d postgres
|
2020-05-07 23:59:21 +08:00
|
|
|
|
|
|
|
# run run `flask db upgrade` to upgrade the DB to the latest stage and
|
2020-10-20 22:50:13 +08:00
|
|
|
env DB_URI=postgresql://postgres:postgres@127.0.0.1:15432/sl flask db upgrade
|
2020-05-07 23:59:21 +08:00
|
|
|
|
|
|
|
# finally `flask db migrate` to generate the migration script.
|
2020-10-20 22:50:13 +08:00
|
|
|
env DB_URI=postgresql://postgres:postgres@127.0.0.1:15432/sl flask db migrate
|
2020-05-07 23:59:21 +08:00
|
|
|
|
|
|
|
# remove the db
|
|
|
|
docker rm -f sl-db
|