def main(args): '''Run the migration applier using the given parsed command line arguments.''' conf = Config() conf.initAll(args) if(args.basedir == None): args.basedir = '.' if(not(os.path.exists(args.basedir))): error('Invalid migration base directory: %s' % args.basedir) return migrator = MigrationApplier(args.basedir, conf) migrator.applyAllMigrations() migrator.plugin = MultiVersionPg(conf) versions = migrator.getMigrationVersions() try: migrator.plugin.openSession() migrator.plugin.openTransaction() migrator.plugin.execute('truncate __mig_version__;') for version in versions: migrator.plugin.updateVersion(version) migrator.plugin.commitTransaction() finally: if migrator.plugin.isOpen(): migrator.plugin.rollbackTransaction() migrator.plugin.closeSession() info('Upgraded migrations to multi-version.')
def main(args): conf = Config() conf.initAll(args, basedir=args.basedir) if conf['database'] is None: error('Invalid database: %s' % conf['database']) return if conf['basedir'] is None: error('Invalid migration base directory: %s' % conf['basedir']) return creator = MigrationCreator(conf['database'], conf['basedir']) creator.createMigration(advanced=args.advanced, version=args.version, header=getDefaultHeader())
def main(args): '''Run the migration applier using the given parsed command line arguments.''' conf = Config() conf.initAll(args) if args.basedir is None: args.basedir = '.' if not(os.path.exists(args.basedir)): error('Invalid migration base directory: %s' % args.basedir) return migrator = MigrationTester(args.basedir, conf, dry_run=args.dry_run) if args.version is None: migrator.applyAllMigrations() else: migrator.applySingleMigration(args.version)