summaryrefslogtreecommitdiffstats
path: root/db_create.py
diff options
context:
space:
mode:
authorJohannes Löthberg <johannes@kyriasis.com>2014-10-02 19:18:30 +0200
committerJohannes Löthberg <johannes@kyriasis.com>2014-10-02 19:18:30 +0200
commitfb217ca2658c25f4df0a9b9b471ad85c608377a9 (patch)
tree7f6a34179a3824e3decab523b37d704f9ae9c213 /db_create.py
downloadtbt-fb217ca2658c25f4df0a9b9b471ad85c608377a9.tar.xz
initial dump, sorta broken
Diffstat (limited to 'db_create.py')
-rwxr-xr-xdb_create.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/db_create.py b/db_create.py
new file mode 100755
index 0000000..6845880
--- /dev/null
+++ b/db_create.py
@@ -0,0 +1,12 @@
+#!flask/bin/python
+from migrate.versioning import api
+from config import SQLALCHEMY_DATABASE_URI
+from config import SQLALCHEMY_MIGRATE_REPO
+from app import db
+import os.path
+db.create_all()
+if not os.path.exists(SQLALCHEMY_MIGRATE_REPO):
+ api.create(SQLALCHEMY_MIGRATE_REPO, 'database repository')
+ api.version_control(SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIGRATE_REPO)
+else:
+ api.version_control(SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIGRATE_REPO, api.version(SQLALCHEMY_MIGRATE_REPO))