Add a script to force migration of lazy tables and fix missing options in DAL init.
This commit is contained in:
+11
-2
@@ -251,12 +251,12 @@ def run(
|
||||
orig_init = DAL.__init__
|
||||
|
||||
def custom_init(*args, **kwargs):
|
||||
kwargs['migrate_enabled'] = True
|
||||
kwargs['migrate'] = True
|
||||
logger.info('Forcing migrate=True')
|
||||
logger.info('Forcing migrate_enabled=True')
|
||||
orig_init(*args, **kwargs)
|
||||
|
||||
DAL.__init__ = custom_init
|
||||
logger.debug('Custom init should not have been called already')
|
||||
|
||||
if c:
|
||||
import_models = True
|
||||
@@ -310,6 +310,15 @@ def run(
|
||||
print(traceback.format_exc())
|
||||
if import_models:
|
||||
BaseAdapter.close_all_instances('rollback')
|
||||
elif force_migrate:
|
||||
try:
|
||||
execfile("scripts/migrator.py", _env)
|
||||
if import_models:
|
||||
BaseAdapter.close_all_instances('commit')
|
||||
except:
|
||||
print(traceback.format_exc())
|
||||
if import_models:
|
||||
BaseAdapter.close_all_instances('rollback')
|
||||
else:
|
||||
if not plain:
|
||||
if bpython:
|
||||
|
||||
Reference in New Issue
Block a user