app-MAIL-temp/scripts/new-migration.sh

16 lines
605 B
Bash
Raw Normal View History

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