]> git.datanom.net - flask-test.git/blobdiff - db_downgrade.py
First half
[flask-test.git] / db_downgrade.py
diff --git a/db_downgrade.py b/db_downgrade.py
new file mode 100755 (executable)
index 0000000..59200a9
--- /dev/null
@@ -0,0 +1,8 @@
+#!flask/bin/python
+from migrate.versioning import api
+from config import SQLALCHEMY_DATABASE_URI
+from config import SQLALCHEMY_MIGRATE_REPO
+v = api.db_version(SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIGRATE_REPO)
+api.downgrade(SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIGRATE_REPO, v - 1)
+v = api.db_version(SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIGRATE_REPO)
+print('Current database version: ' + str(v))
This page took 0.031896 seconds and 5 git commands to generate.