db purge recreate populate commands

This commit is contained in:
Daniel Tsvetkov 2021-12-22 09:36:42 +01:00
parent 1153c791e2
commit 356348aa1d
2 changed files with 15 additions and 4 deletions

View File

@ -6,3 +6,6 @@ from webapp.app import app
init_db(app)
populate_static(app)
populate_db(app)
if __name__ == "__main__":
print('done')

View File

@ -18,8 +18,9 @@ Usage $0 [ bootstrap | model | db_migrate | db_upgrade | db_populate | db_recrea
db_migrate DB migration
db_upgrade DB upgrade to last migration
db_populate Populate db with data from data_static/ and populate.py
db_recreate Delete the database, recreate to latest migration and populate
db_purge_recreate Same as db_recreate but also purge the migrations
db_recreate Delete the database, recreate to latest migration
db_recreate_populate Same as db_recreate and populate
db_purge_recreate_populate Same as db_recreate_populate but also purge the migrations
translate Translations subcommand
@ -342,7 +343,7 @@ db_upgrade() {
python manager.py db upgrade
}
db_purge_recreate() {
db_purge_recreate_populate() {
shift
source venv/bin/activate
rm -rf data/db.sqlite data/search_index migrations/ data/media
@ -364,6 +365,11 @@ db_recreate() {
source venv/bin/activate
rm -rf data/db.sqlite data/search_index
db_upgrade
}
db_recreate_populate() {
shift
db_recreate
db_populate
}
@ -389,7 +395,9 @@ command_main() {
;;
db_recreate) db_recreate "$@"
;;
db_purge_recreate) db_purge_recreate "$@"
db_recreate_populate) db_recreate_populate "$@"
;;
db_purge_recreate_populate) db_purge_recreate_populate "$@"
;;
translate) command_translate "$@"
;;