]> git.datanom.net - flask-test.git/blobdiff - db_create.py
First half
[flask-test.git] / db_create.py
diff --git a/db_create.py b/db_create.py
new file mode 100755 (executable)
index 0000000..f35f9bc
--- /dev/null
@@ -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))
This page took 0.028507 seconds and 5 git commands to generate.