-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdb_create.py
More file actions
19 lines (17 loc) · 817 Bytes
/
db_create.py
File metadata and controls
19 lines (17 loc) · 817 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
from groupbot.models import Base, db_DropEverything, drop_shit
from sqlalchemy import create_engine
from config import SQLALCHEMY_DATABASE_URI
from config import SQLALCHEMY_MIGRATE_REPO
from groupbot import db
# This script kills the database and then creates it again. Purely for development, still haven't
# really implemented database migrations.
engine = create_engine(SQLALCHEMY_DATABASE_URI)
# drop_shit()
Base.metadata.drop_all(bind=engine)
Base.metadata.create_all(bind=engine)
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))