HomePhabricator

Work around an issue in MariaDB where dropping a column from a UNIQUE KEY fails

Description

Work around an issue in MariaDB where dropping a column from a UNIQUE KEY fails

Summary:
See T13193. See T13077. If we drop a column which is part of a UNIQUE KEY, MariaDB raises an error.

This is probably a bad idea on our side anyway, but in this case it wasn't an obviously bad idea.

To get around this:

  • Drop the unique key, if it exists, before dropping the column.
  • Explicitly add the new unique key afterward.

Test Plan: Ran bin/storage upgrade locally without issue, but I'm on MySQL. Will follow up on T13193.

Reviewers: amckinley

Subscribers: PHID-OPKG-gm6ozazyms6q6i22gyam

Differential Revision: https://secure.phabricator.com/D19624