Removing non-null constraint in a column with a pre-existing default value breaks MSSQL upgrade task

Description

Removing non-null constraint in a column that had a default value configured like this:

Before:

1 - {name: PROJECT_KEY, type: String/255, nullable: false, defaultValue: N/A, deprecated: true, indexed: true}

After:

1 - {name: PROJECT_KEY, type: String/255, nullable: true, defaultValue: N/A, deprecated: true, indexed: true}

And this causes a failure during the upgrade phase:

1 2 Exception executing SQL update <ALTER TABLE jiraschema.AO_54307E_SERVICEDESK ALTER COLUMN PROJECT_KEY NVARCHAR(255)> com.microsoft.sqlserver.jdbc.SQLServerException: The object 'df_AO_54307E_SERVICEDESK_PROJECT_KEY' is dependent on column 'PROJECT_KEY'.

This only happened when upgrading from an older version of JSD to a newer version. The initial datatype for the column was “VARCHAR” and the upgrade tries to change it to “NVARCHAR”, causing the conflict with the existing default value constraint.

Environment

MSSQL

Testing Notes

Add notes...

Status

Assignee

Unassigned

Reporter

Aliaksei Melnikau

Labels

None

Add-on Type

None

Team

None

CC

None

Risk factor

None

QA Kickoff Status

None

QA Demo Status

None

Components

Priority

Critical
Configure