working db and tests Nr2
This commit is contained in:
13
database/db_create.py
Normal file
13
database/db_create.py
Normal file
@@ -0,0 +1,13 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
from migrate.versioning import api
|
||||
from backend.config import SQLALCHEMY_DATABASE_URI
|
||||
from backend.config import SQLALCHEMY_MIGRATE_REPO
|
||||
from backend 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))
|
||||
Reference in New Issue
Block a user