From 356348aa1df5704d9e9eaddf053dff423808acdb Mon Sep 17 00:00:00 2001 From: Daniel Tsvetkov Date: Wed, 22 Dec 2021 09:36:42 +0100 Subject: [PATCH] db purge recreate populate commands --- bootstrap/init_populate.py | 3 +++ oshipka.sh | 16 ++++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/bootstrap/init_populate.py b/bootstrap/init_populate.py index 03d709a..6b055e4 100644 --- a/bootstrap/init_populate.py +++ b/bootstrap/init_populate.py @@ -6,3 +6,6 @@ from webapp.app import app init_db(app) populate_static(app) populate_db(app) + +if __name__ == "__main__": + print('done') diff --git a/oshipka.sh b/oshipka.sh index 014b799..bbd84ed 100755 --- a/oshipka.sh +++ b/oshipka.sh @@ -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 "$@" ;;