-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
17 additions
and
2 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
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
12 changes: 12 additions & 0 deletions
12
...ources/db/migration/20240801140000000__remove_indices_with_nullable_unitOfOrderableId.sql
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,12 @@ | ||
-- Cleanup indexes | ||
DROP INDEX IF EXISTS uniq_stock_card_facility_program_product_lot_unit; | ||
DROP INDEX IF EXISTS uniq_stock_card_facility_program_product_lot; | ||
DROP INDEX IF EXISTS uniq_stock_card_facility_program_product_unit; | ||
DROP INDEX IF EXISTS uniq_stock_card_facility_program_product; | ||
|
||
-- Create new indexes assuming unitOfOrderableId never null | ||
CREATE UNIQUE INDEX uniq_stock_card_facility_program_product_lot_unit | ||
ON stock_cards (facilityId, programId, orderableId, lotId, unitOfOrderableId) WHERE lotId IS NOT NULL; | ||
|
||
CREATE UNIQUE INDEX uniq_stock_card_facility_program_product_unit | ||
ON stock_cards (facilityId, programId, orderableId, unitOfOrderableId) WHERE lotId IS NULL; |