diff --git a/src/main/resources/db/migration/V6__gateway_execution_state.sql b/src/main/resources/db/migration/V6__gateway_execution_state.sql index c09c8c8..3911f6a 100644 --- a/src/main/resources/db/migration/V6__gateway_execution_state.sql +++ b/src/main/resources/db/migration/V6__gateway_execution_state.sql @@ -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;