Added flask database migration test to CI
This commit is contained in:
parent
7e0384d698
commit
8a080f3eff
2 changed files with 29 additions and 0 deletions
|
@ -54,6 +54,12 @@ test:pylint:
|
|||
- pylint app
|
||||
allow_failure: true
|
||||
|
||||
test:migration:
|
||||
script:
|
||||
- cp config.yaml.example config.yaml
|
||||
- pip install -r requirements.txt --quiet
|
||||
- sh scripts/test_migrate.sh
|
||||
|
||||
pages:
|
||||
stage: deploy
|
||||
script:
|
||||
|
|
23
scripts/test_migrate.sh
Normal file
23
scripts/test_migrate.sh
Normal file
|
@ -0,0 +1,23 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
nlines={1..$(flask db history | wc -l)}
|
||||
|
||||
# Upgrade to latest db schema
|
||||
for _ in $nlines
|
||||
do
|
||||
flask db upgrade
|
||||
done
|
||||
|
||||
# Downgrade to the first schema
|
||||
for _ in $nlines
|
||||
do
|
||||
flask db downgrade
|
||||
done
|
||||
|
||||
# Upgrade to the latest version again
|
||||
for _ in $nlines
|
||||
do
|
||||
flask db upgrade
|
||||
done
|
Loading…
Add table
Add a link
Reference in a new issue