Allow users to remove default values from columns properly. Fixes #2461
parent
f89aec867a
commit
63c093248d
|
@ -19,6 +19,12 @@ ALTER TABLE {{conn|qtIdent(data.schema, data.table)}}
|
|||
ALTER TABLE {{conn|qtIdent(data.schema, data.table)}}
|
||||
ALTER COLUMN {% if data.name %}{{conn|qtTypeIdent(data.name)}}{% else %}{{conn|qtTypeIdent(o_data.name)}}{% endif %} SET DEFAULT {{data.defval}};
|
||||
|
||||
{% endif %}
|
||||
{### Drop column default value ###}
|
||||
{% if data.defval is defined and data.defval == '' and data.defval != o_data.defval %}
|
||||
ALTER TABLE {{conn|qtIdent(data.schema, data.table)}}
|
||||
ALTER COLUMN {% if data.name %}{{conn|qtTypeIdent(data.name)}}{% else %}{{conn|qtTypeIdent(o_data.name)}}{% endif %} DROP DEFAULT;
|
||||
|
||||
{% endif %}
|
||||
{### Alter column not null value ###}
|
||||
{% if 'attnotnull' in data and data.attnotnull != o_data.attnotnull %}
|
||||
|
|
|
@ -19,6 +19,12 @@ ALTER TABLE {{conn|qtIdent(data.schema, data.table)}}
|
|||
ALTER TABLE {{conn|qtIdent(data.schema, data.table)}}
|
||||
ALTER COLUMN {% if data.name %}{{conn|qtTypeIdent(data.name)}}{% else %}{{conn|qtTypeIdent(o_data.name)}}{% endif %} SET DEFAULT {{data.defval}};
|
||||
|
||||
{% endif %}
|
||||
{### Drop column default value ###}
|
||||
{% if data.defval is defined and data.defval == '' and data.defval != o_data.defval %}
|
||||
ALTER TABLE {{conn|qtIdent(data.schema, data.table)}}
|
||||
ALTER COLUMN {% if data.name %}{{conn|qtTypeIdent(data.name)}}{% else %}{{conn|qtTypeIdent(o_data.name)}}{% endif %} DROP DEFAULT;
|
||||
|
||||
{% endif %}
|
||||
{### Alter column not null value ###}
|
||||
{% if 'attnotnull' in data and data.attnotnull != o_data.attnotnull %}
|
||||
|
|
Loading…
Reference in New Issue