Package commands :: Module create_db
[hide private]
[frames] | no frames]

Source Code for Module commands.create_db

 1  from flask_script import Command, Option 
 2  from coprs import db 
 3  from coprs.logic import builds_logic 
 4  from commands.create_sqlite_file import CreateSqliteFileCommand 
 5   
 6   
7 -class CreateDBCommand(Command):
8 9 """ 10 Create the DB schema 11 """ 12
13 - def run(self, alembic_ini=None):
14 CreateSqliteFileCommand().run() 15 db.create_all() 16 17 # load the Alembic configuration and generate the 18 # version table, "stamping" it with the most recent rev: 19 from alembic.config import Config 20 from alembic import command 21 alembic_cfg = Config(alembic_ini) 22 command.stamp(alembic_cfg, "head") 23 24 # Functions are not covered by models.py, and no migrations are run 25 # by command.stamp() above. Create functions explicitly: 26 builds_logic.BuildsLogic.init_db()
27 28 option_list = ( 29 Option("--alembic", 30 "-f", 31 dest="alembic_ini", 32 help="Path to the alembic configuration file (alembic.ini)", 33 required=True), 34 )
35