Skip to content

Commit

Permalink
Merge #6795
Browse files Browse the repository at this point in the history
6795: Fixed issues in the migration files for v1.25.0 to v1.26.0 r=jmcameron a=jmcameron

This PR fixes some errors in the site-specific migration files.

Co-authored-by: Jonathan Cameron <jmcameron@gmail.com>
  • Loading branch information
bors[bot] and jmcameron authored Aug 27, 2022
2 parents 6ac5878 + 24e26c9 commit c4e317b
Show file tree
Hide file tree
Showing 4 changed files with 111 additions and 69 deletions.
50 changes: 26 additions & 24 deletions server/models/migrations/v1.25.0-v1.26.0/migrate-bandunduville.sql
Original file line number Diff line number Diff line change
@@ -1,40 +1,42 @@
-- update inventory references to unit_id

UPDATE `inventory` SET unit_id = 27 WHERE unit_id = 3; --> PALLET
UPDATE `inventory` SET unit_id = 2 WHERE unit_id = 6; --> AMPOULE
UPDATE `inventory` SET unit_id = 12 WHERE unit_id = 9; --> CAPSULE
UPDATE `inventory` SET unit_id = 17 WHERE unit_id = 10; --> FLASK
UPDATE `inventory` SET unit_id = 30 WHERE unit_id = 14; --> POUCH
UPDATE `inventory` SET unit_id = 37 WHERE unit_id = 15; --> TABLET
UPDATE `inventory` SET unit_id = 35 WHERE unit_id = 20; --> SUPPOSITORY

-- The following changes need to be done in careful order due to overlapping id values

UPDATE `inventory` SET unit_id = 8 WHERE unit_id = 4; --> BOX
UPDATE `inventory` SET unit_id = 4 WHERE unit_id = 7; --> BAG

UPDATE `inventory` SET unit_id = 39 WHERE unit_id = 16; --> TUBE
UPDATE `inventory` SET unit_id = 16 WHERE unit_id = 21; --> EGG

UPDATE `inventory` SET unit_id = 36 WHERE unit_id = 19; --> SYRUP
UPDATE `inventory` SET unit_id = 19 WHERE unit_id = 22; --> INFUSION
UPDATE `inventory` SET unit_id = 22 WHERE unit_id = 25; --> KIT

-- Create new site-local inventory_unit entries

INSERT INTO `inventory_unit` (`id`, `abbr`, `text`, `token`) VALUES (100, 'susp', 'Suspension', NULL);
UPDATE `inventory` SET unit_id = 100 WHERE unit_id = 23;
UPDATE `inventory` SET unit_id = 23 WHERE unit_id = 5; --> LOT
UPDATE `inventory` SET unit_id = 23 WHERE unit_id = 5; -- LOT

INSERT INTO `inventory_unit` (`id`, `abbr`, `text`, `token`) VALUES (101, 'clr', 'Collyre', NULL);
UPDATE `inventory` SET unit_id = 101 WHERE unit_id = 24;
UPDATE `inventory` SET unit_id = 24 WHERE unit_id = 12; --> BOTTLE **
UPDATE `inventory` SET unit_id = 24 WHERE unit_id = 12; -- BOTTLE **

INSERT INTO `inventory_unit` (`id`, `abbr`, `text`, `token`) VALUES (102, 'SLT', 'Solution', NULL);
UPDATE `inventory` SET unit_id = 102 WHERE unit_id = 26;

INSERT INTO `inventory_unit` (`id`, `abbr`, `text`, `token`) VALUES (103, 'PrtqPfssnll', 'Pratique Professionnelle', NULL);
UPDATE `inventory` SET unit_id = 103 WHERE unit_id = 28;
UPDATE `inventory` SET unit_id = 28 WHERE unit_id = 13; --> PIECE
UPDATE `inventory` SET unit_id = 28 WHERE unit_id = 13; -- PIECE

-- update inventory references to unit_id

UPDATE `inventory` SET unit_id = 27 WHERE unit_id = 3; -- PALLET
UPDATE `inventory` SET unit_id = 2 WHERE unit_id = 6; -- AMPOULE
UPDATE `inventory` SET unit_id = 12 WHERE unit_id = 9; -- CAPSULE
UPDATE `inventory` SET unit_id = 17 WHERE unit_id = 10; -- FLASK
UPDATE `inventory` SET unit_id = 30 WHERE unit_id = 14; -- POUCH
UPDATE `inventory` SET unit_id = 37 WHERE unit_id = 15; -- TABLET
UPDATE `inventory` SET unit_id = 35 WHERE unit_id = 20; -- SUPPOSITORY

-- The following changes need to be done in careful order due to overlapping id values

UPDATE `inventory` SET unit_id = 8 WHERE unit_id = 4; -- BOX
UPDATE `inventory` SET unit_id = 4 WHERE unit_id = 7; -- BAG

UPDATE `inventory` SET unit_id = 39 WHERE unit_id = 16; -- TUBE
UPDATE `inventory` SET unit_id = 16 WHERE unit_id = 21; -- EGG

UPDATE `inventory` SET unit_id = 36 WHERE unit_id = 19; -- SYRUP
UPDATE `inventory` SET unit_id = 19 WHERE unit_id = 22; -- INFUSION
UPDATE `inventory` SET unit_id = 22 WHERE unit_id = 25; -- KIT

----------------------------------------------------------------------
-- OLD Inventory Units
Expand Down
41 changes: 21 additions & 20 deletions server/models/migrations/v1.25.0-v1.26.0/migrate-chk.sql
Original file line number Diff line number Diff line change
@@ -1,31 +1,32 @@
-- Create new site-local inventory_unit entries

INSERT INTO `inventory_unit` (`id`, `abbr`, `text`, `token`) VALUES (100, 'PT', 'Pot', NULL);
UPDATE `inventory` SET unit_id = 100 WHERE unit_id = 20;

-- Update inventory references to unit_id

UPDATE `inventory` SET unit_id = 27 WHERE unit_id = 3; --> PALLET
UPDATE `inventory` SET unit_id = 28 WHERE unit_id = 13; --> PIECE
UPDATE `inventory` SET unit_id = 30 WHERE unit_id = 14; --> POUCH
UPDATE `inventory` SET unit_id = 37 WHERE unit_id = 15; --> TABLET
UPDATE `inventory` SET unit_id = 35 WHERE unit_id = 18; --> SUPPOSITORY
UPDATE `inventory` SET unit_id = 36 WHERE unit_id = 19; --> SYRUP
UPDATE `inventory` SET unit_id = 27 WHERE unit_id = 3; -- PALLET
UPDATE `inventory` SET unit_id = 28 WHERE unit_id = 13; -- PIECE
UPDATE `inventory` SET unit_id = 30 WHERE unit_id = 14; -- POUCH
UPDATE `inventory` SET unit_id = 37 WHERE unit_id = 15; -- TABLET
UPDATE `inventory` SET unit_id = 35 WHERE unit_id = 18; -- SUPPOSITORY
UPDATE `inventory` SET unit_id = 36 WHERE unit_id = 19; -- SYRUP

-- The following changes need to be done in careful order due to overlapping id values
UPDATE `inventory` SET unit_id = 27 WHERE unit_id = 2; --> PALLET
UPDATE `inventory` SET unit_id = 2 WHERE unit_id = 6; --> AMPOULE
UPDATE `inventory` SET unit_id = 27 WHERE unit_id = 2; -- PALLET
UPDATE `inventory` SET unit_id = 2 WHERE unit_id = 6; -- AMPOULE

UPDATE `inventory` SET unit_id = 7 WHERE unit_id = 8; --> BOTTLE (btl)
UPDATE `inventory` SET unit_id = 8 WHERE unit_id = 4; --> BOX
UPDATE `inventory` SET unit_id = 7 WHERE unit_id = 8; -- BOTTLE (btl)
UPDATE `inventory` SET unit_id = 8 WHERE unit_id = 4; -- BOX

UPDATE `inventory` SET unit_id = 7 WHERE unit_id = 12; --> BOTTLE (litre)
UPDATE `inventory` SET unit_id = 12 WHERE unit_id = 9; --> CAPSULE
UPDATE `inventory` SET unit_id = 7 WHERE unit_id = 12; -- BOTTLE (litre)
UPDATE `inventory` SET unit_id = 12 WHERE unit_id = 9; -- CAPSULE

UPDATE `inventory` SET unit_id = 39 WHERE unit_id = 16; --> TUBE
UPDATE `inventory` SET unit_id = 16 WHERE unit_id = 21; --> EGG
UPDATE `inventory` SET unit_id = 39 WHERE unit_id = 16; -- TUBE
UPDATE `inventory` SET unit_id = 16 WHERE unit_id = 21; -- EGG

UPDATE `inventory` SET unit_id = 41 WHERE unit_id = 17; --> VIAL
UPDATE `inventory` SET unit_id = 17 WHERE unit_id = 10; --> FLASK

-- Create new site-local inventory_unit entries
INSERT INTO `inventory_unit` (`id`, `abbr`, `text`, `token`) VALUES (100, 'PT', 'Pot', NULL);
UPDATE `inventory` SET unit_id = 100 WHERE unit_id = 20;
UPDATE `inventory` SET unit_id = 41 WHERE unit_id = 17; -- VIAL
UPDATE `inventory` SET unit_id = 17 WHERE unit_id = 10; -- FLASK


----------------------------------------------------------------------
Expand Down
45 changes: 23 additions & 22 deletions server/models/migrations/v1.25.0-v1.26.0/migrate-imck.sql
Original file line number Diff line number Diff line change
@@ -1,32 +1,33 @@
-- Create new site-local inventory_unit entries

INSERT INTO `inventory_unit` (`id`, `abbr`, `text`, `token`) VALUES (100, 'MEKA', 'MEKA', NULL);
UPDATE `inventory` SET unit_id = 100 WHERE unit_id = 18;

-- Update inventory references to unit_id

UPDATE `inventory` SET unit_id = 29 WHERE unit_id = 3; --> PILL
UPDATE `inventory` SET unit_id = 23 WHERE unit_id = 5; --> LOT
UPDATE `inventory` SET unit_id = 21 WHERE unit_id = 11; --> JAR
UPDATE `inventory` SET unit_id = 28 WHERE unit_id = 13; --> PIECE
UPDATE `inventory` SET unit_id = 30 WHERE unit_id = 14; --> POUCH
UPDATE `inventory` SET unit_id = 37 WHERE unit_id = 15; --> TABLET
UPDATE `inventory` SET unit_id = 39 WHERE unit_id = 16; --> TUBE
UPDATE `inventory` SET unit_id = 29 WHERE unit_id = 3; -- PILL
UPDATE `inventory` SET unit_id = 23 WHERE unit_id = 5; -- LOT
UPDATE `inventory` SET unit_id = 21 WHERE unit_id = 11; -- JAR
UPDATE `inventory` SET unit_id = 28 WHERE unit_id = 13; -- PIECE
UPDATE `inventory` SET unit_id = 30 WHERE unit_id = 14; -- POUCH
UPDATE `inventory` SET unit_id = 37 WHERE unit_id = 15; -- TABLET
UPDATE `inventory` SET unit_id = 39 WHERE unit_id = 16; -- TUBE

-- The following changes need to be done in careful order due to overlapping id values

UPDATE `inventory` SET unit_id = 27 WHERE unit_id = 2; --> PALLET
UPDATE `inventory` SET unit_id = 2 WHERE unit_id = 6; --> AMPOULE
UPDATE `inventory` SET unit_id = 27 WHERE unit_id = 2; -- PALLET
UPDATE `inventory` SET unit_id = 2 WHERE unit_id = 6; -- AMPOULE

UPDATE `inventory` SET unit_id = 99 WHERE unit_id = 4; --> BOX
UPDATE `inventory` SET unit_id = 4 WHERE unit_id = 7; --> BAG
UPDATE `inventory` SET unit_id = 7 WHERE unit_id = 99; --> BOX
UPDATE `inventory` SET unit_id = 7 WHERE unit_id = 8; --> BOTTLE (btl)
UPDATE `inventory` SET unit_id = 7 WHERE unit_id = 12; --> BOTTLE (ltr)
UPDATE `inventory` SET unit_id = 7 WHERE unit_id = 20; --> BOTTLE (BOUTEILLE)
UPDATE `inventory` SET unit_id = 12 WHERE unit_id = 9; --> CAPSULE
UPDATE `inventory` SET unit_id = 99 WHERE unit_id = 4; -- BOX
UPDATE `inventory` SET unit_id = 4 WHERE unit_id = 7; -- BAG
UPDATE `inventory` SET unit_id = 7 WHERE unit_id = 99; -- BOX
UPDATE `inventory` SET unit_id = 7 WHERE unit_id = 8; -- BOTTLE (btl)
UPDATE `inventory` SET unit_id = 7 WHERE unit_id = 12; -- BOTTLE (ltr)
UPDATE `inventory` SET unit_id = 7 WHERE unit_id = 20; -- BOTTLE (BOUTEILLE)
UPDATE `inventory` SET unit_id = 12 WHERE unit_id = 9; -- CAPSULE

UPDATE `inventory` SET unit_id = 41 WHERE unit_id = 17; --> VIAL
UPDATE `inventory` SET unit_id = 17 WHERE unit_id = 10; --> FLASK

-- Create new site-local inventory_unit entries
INSERT INTO `inventory_unit` (`id`, `abbr`, `text`, `token`) VALUES (100, 'MEKA', 'MEKA', NULL);
UPDATE `inventory` SET unit_id = 100 WHERE unit_id = 18;
UPDATE `inventory` SET unit_id = 41 WHERE unit_id = 17; -- VIAL
UPDATE `inventory` SET unit_id = 17 WHERE unit_id = 10; -- FLASK


----------------------------------------------------------------------
Expand Down
44 changes: 41 additions & 3 deletions server/models/migrations/v1.25.0-v1.26.0/migrate-vanga.sql
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,45 @@
* @date: 2021-08-12
*/

-- VANGA only uses one value of unit_id for its inventory.
-- It needs to changed from 18 (old Unité)) to 40 (new Unité))
-- Create new site-local inventory_unit entries

UPDATE `inventory` SET unit_id=40;
INSERT INTO `inventory_unit` (`id`, `abbr`, `text`, `token`) VALUE (100, 'Materiels', 'Materiels', NULL);
UPDATE `inventory` SET unit_id = 100 WHERE unit_id = 4;

INSERT INTO `inventory_unit` (`id`, `abbr`, `text`, `token`) VALUE (101, 'Collure Op', 'Collure Opthm.', NULL);
UPDATE `inventory` SET unit_id = 101 WHERE unit_id = 5;

INSERT INTO `inventory_unit` (`id`, `abbr`, `text`, `token`) VALUE (102, 'Pommade', 'Pommade', NULL);
UPDATE `inventory` SET unit_id = 102 WHERE unit_id = 12;

INSERT INTO `inventory_unit` (`id`, `abbr`, `text`, `token`) VALUE (103, 'Liquide 1L', 'Liquide 1L', NULL);
UPDATE `inventory` SET unit_id = 103 WHERE unit_id = 19;

INSERT INTO `inventory_unit` (`id`, `abbr`, `text`, `token`) VALUE (104, '1 ml', 'liquide1 ml', NULL);
UPDATE `inventory` SET unit_id = 104 WHERE unit_id = 21;

INSERT INTO `inventory_unit` (`id`, `abbr`, `text`, `token`) VALUE (105, 'centaine', 'Emballage a 100 pces', NULL);
UPDATE `inventory` SET unit_id = 105 WHERE unit_id = 22;

-- Update old unit_id values

UPDATE `inventory` SET unit_id = 27 WHERE unit_id = 2; -- Pallet
UPDATE `inventory` SET unit_id = 29 WHERE unit_id = 3; -- Pill
UPDATE `inventory` SET unit_id = 37 WHERE unit_id = 7; -- Comprimes
UPDATE `inventory` SET unit_id = 12 WHERE unit_id = 9; -- Capsuls
UPDATE `inventory` SET unit_id = 17 WHERE unit_id = 10; -- flc
UPDATE `inventory` SET unit_id = 35 WHERE unit_id = 11; -- Suppositoire
UPDATE `inventory` SET unit_id = 28 WHERE unit_id = 13; -- Piece
UPDATE `inventory` SET unit_id = 30 WHERE unit_id = 14; -- Sachet
UPDATE `inventory` SET unit_id = 32 WHERE unit_id = 18; -- Roulots

-- The following changes need to be done in careful order due to overlapping id values

UPDATE `inventory` SET unit_id = 39 WHERE unit_id = 16; -- Tube
UPDATE `inventory` SET unit_id = 16 WHERE unit_id = 15; -- Ovule

UPDATE `inventory` SET unit_id = 41 WHERE unit_id = 17; -- vial
UPDATE `inventory` SET unit_id = 17 WHERE unit_id = 8; -- Flacon

UPDATE `inventory` SET unit_id = 18 WHERE unit_id = 20; -- Gants
UPDATE `inventory` SET unit_id = 20 WHERE unit_id = 6; -- Injectable

0 comments on commit c4e317b

Please sign in to comment.