def db_handler(args): """db_handler.""" if args.type == 'create': if args.db is None: db.init_db() return if not db.setup(url=args.db, echo=args.db_echo): return if args.type == 'status': current_rev = db_revision.current_db_revision() print('The current DB schema version:', current_rev) if args.type == 'upgrade': db.upgrade() if args.type == 'revision': db_revision.new_revision() if args.type == 'drop': if args.db is not None: db.downgrade() db.remove_db()
def db_handler(args): """db_handler.""" if args.type == 'create': create_db() if args.type == 'status': current_rev = db_revision.current_db_revision() print('current_rev', current_rev) if args.type == 'upgrade': upgrade_db() if args.type == 'revision': db_revision.new_revision() if args.type == 'drop': if os.path.exists(DB_FILE_PATH): os.remove(DB_FILE_PATH)