Merge "Fix heal_script for MySQL specifics"
This commit is contained in:
commit
a1d13fc141
@ -103,12 +103,12 @@ def parse_modify_command(command):
|
|||||||
# autoincrement=None, existing_type=None,
|
# autoincrement=None, existing_type=None,
|
||||||
# existing_server_default=False, existing_nullable=None,
|
# existing_server_default=False, existing_nullable=None,
|
||||||
# existing_autoincrement=None, schema=None, **kw)
|
# existing_autoincrement=None, schema=None, **kw)
|
||||||
|
bind = op.get_bind()
|
||||||
for modified, schema, table, column, existing, old, new in command:
|
for modified, schema, table, column, existing, old, new in command:
|
||||||
if modified.endswith('type'):
|
if modified.endswith('type'):
|
||||||
modified = 'type_'
|
modified = 'type_'
|
||||||
elif modified.endswith('nullable'):
|
elif modified.endswith('nullable'):
|
||||||
modified = 'nullable'
|
modified = 'nullable'
|
||||||
bind = op.get_bind()
|
|
||||||
insp = sqlalchemy.engine.reflection.Inspector.from_engine(bind)
|
insp = sqlalchemy.engine.reflection.Inspector.from_engine(bind)
|
||||||
if column in insp.get_primary_keys(table) and new:
|
if column in insp.get_primary_keys(table) and new:
|
||||||
return
|
return
|
||||||
@ -122,8 +122,7 @@ def parse_modify_command(command):
|
|||||||
if isinstance(default.arg, basestring):
|
if isinstance(default.arg, basestring):
|
||||||
existing['existing_server_default'] = default.arg
|
existing['existing_server_default'] = default.arg
|
||||||
else:
|
else:
|
||||||
existing['existing_server_default'] = default.arg.compile(
|
existing['existing_server_default'] = default.arg.text
|
||||||
dialect=bind.engine.name)
|
|
||||||
kwargs.update(existing)
|
kwargs.update(existing)
|
||||||
op.alter_column(table, column, **kwargs)
|
op.alter_column(table, column, **kwargs)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user