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

Source Code for Module commands.create_db

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