Fix MySQL gateway migration ordering
Split replacement-key recreation so MySQL drops the old constraint before validating its reused name.
This commit is contained in:
@@ -59,7 +59,9 @@ ALTER TABLE usage_records
|
||||
-- A rotated refresh row points to its replacement. RESTRICT can block the
|
||||
-- account -> grant -> refresh cascade when an account is deleted.
|
||||
ALTER TABLE gateway_refresh_tokens
|
||||
DROP FOREIGN KEY fk_gateway_refresh_replacement,
|
||||
DROP FOREIGN KEY fk_gateway_refresh_replacement;
|
||||
|
||||
ALTER TABLE gateway_refresh_tokens
|
||||
ADD CONSTRAINT fk_gateway_refresh_replacement
|
||||
FOREIGN KEY (replaced_by_id) REFERENCES gateway_refresh_tokens (id)
|
||||
ON DELETE SET NULL;
|
||||
|
||||
Reference in New Issue
Block a user