-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SI-2621 Prevent references from blocking burn handling (#93)
* Add delete behavior for two foreign keys referencing vehicles * Rewards rows get deleted * DCNs get nulled out * Fix migration file name * Test that we really can delete a linked vehicle * Be as complete as before * One more assert
- Loading branch information
Showing
2 changed files
with
49 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
-- +goose Up | ||
-- +goose StatementBegin | ||
ALTER TABLE rewards | ||
DROP CONSTRAINT rewards_vehicle_token_id, | ||
ADD CONSTRAINT rewards_vehicle_id_fkey FOREIGN KEY (vehicle_id) REFERENCES vehicles (id) ON DELETE CASCADE; | ||
|
||
ALTER TABLE dcns | ||
DROP CONSTRAINT vehicle_dcn_vehicle_token_id, | ||
ADD CONSTRAINT dcns_vehicle_id_fkey FOREIGN KEY (vehicle_id) REFERENCES vehicles (id) ON DELETE SET NULL; | ||
-- +goose StatementEnd | ||
|
||
-- +goose Down | ||
-- +goose StatementBegin | ||
ALTER TABLE rewards | ||
DROP CONSTRAINT rewards_vehicle_id_fkey, | ||
ADD CONSTRAINT rewards_vehicle_token_id FOREIGN KEY (vehicle_id) REFERENCES vehicles (id); | ||
|
||
ALTER TABLE dcns | ||
DROP CONSTRAINT dcns_vehicle_id_fkey, | ||
ADD CONSTRAINT vehicle_dcn_vehicle_token_id FOREIGN KEY (vehicle_id) REFERENCES vehicles (id); | ||
-- +goose StatementEnd |