Allow users to remove default values from columns properly. Fixes #2461

REL-1_X
Surinder Kumar 2017-06-07 14:33:28 +01:00 committed by Dave Page
parent f89aec867a
commit 63c093248d
2 changed files with 12 additions and 0 deletions

View File

@ -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 %}

View File

@ -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 %}