Fixed an issue where schema diff does not create DROP DEFAULT statement for columns. Fixes #6377

This commit is contained in:
Akshay Joshi 2021-04-26 16:41:20 +05:30
parent b853bda2a2
commit 7d6f077cf8
3 changed files with 3 additions and 2 deletions

View File

@ -19,4 +19,5 @@ Bug fixes
| `Issue #6329 <https://redmine.postgresql.org/issues/6329>`_ - Fixed an issue where the wrong SQL is showing for the child partition tables.
| `Issue #6341 <https://redmine.postgresql.org/issues/6341>`_ - Fixed an issue where CSV download quotes the numeric columns.
| `Issue #6377 <https://redmine.postgresql.org/issues/6377>`_ - Fixed an issue where schema diff does not create DROP DEFAULT statement for columns.
| `Issue #6385 <https://redmine.postgresql.org/issues/6385>`_ - Ensure that Backup and Restore should work on shared servers.

View File

@ -31,7 +31,7 @@ ALTER TABLE {{conn|qtIdent(data.schema, data.table)}}
{% endif %}
{### Drop column default value ###}
{% if data.defval is defined and data.defval == '' and data.defval != o_data.defval %}
{% if data.defval is defined and (data.defval == '' or data.defval is none) 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;

View File

@ -31,7 +31,7 @@ ALTER TABLE {{conn|qtIdent(data.schema, data.table)}}
{% endif %}
{### Drop column default value ###}
{% if data.defval is defined and data.defval == '' and data.defval != o_data.defval %}
{% if data.defval is defined and (data.defval == '' or data.defval is none) 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;