app/new_migration.sh

16 lines
569 B
Bash
Raw Normal View History

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
docker run -p 5432:5432 --name sl-db -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=sl -d postgres
# run run `flask db upgrade` to upgrade the DB to the latest stage and
env DB_URI=postgresql://postgres:postgres@127.0.0.1:5432/sl flask db upgrade
# finally `flask db migrate` to generate the migration script.
env DB_URI=postgresql://postgres:postgres@127.0.0.1:5432/sl flask db migrate
# remove the db
docker rm -f sl-db