| Conditions | 1 |
| Total Lines | 20 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | # -*- coding: utf-8 -*- |
||
| 9 | def setup_schema(command, conf, vars): |
||
| 10 | """Place any commands to setup pyjobsweb here""" |
||
| 11 | # Load the models |
||
| 12 | |||
| 13 | # <websetup.websetup.schema.before.model.import> |
||
| 14 | from pyjobsweb import model |
||
| 15 | # <websetup.websetup.schema.after.model.import> |
||
| 16 | |||
| 17 | # <websetup.websetup.schema.before.metadata.create_all> |
||
| 18 | print("Creating tables") |
||
| 19 | model.metadata.create_all(bind=config['tg.app_globals'].sa_engine) |
||
| 20 | # <websetup.websetup.schema.after.metadata.create_all> |
||
| 21 | transaction.commit() |
||
| 22 | print('Initializing Migrations') |
||
| 23 | import alembic.config |
||
| 24 | alembic_cfg = alembic.config.Config() |
||
| 25 | alembic_cfg.set_main_option("script_location", "migration") |
||
| 26 | alembic_cfg.set_main_option("sqlalchemy.url", config['sqlalchemy.url']) |
||
| 27 | import alembic.command |
||
| 28 | alembic.command.stamp(alembic_cfg, "head") |
||
| 29 |