Location column is kept in database

Added a data migration script for stock_locations and item_quantities tables
This commit is contained in:
jekkos-t520
2014-08-17 00:49:48 +02:00
parent 43189d0748
commit a61bc10dde
2 changed files with 3 additions and 1 deletions

View File

@@ -19,7 +19,7 @@ ALTER TABLE ospos_inventory
ADD KEY `trans_location` (`trans_location`),
ADD CONSTRAINT `ospos_inventory_ibfk_3` FOREIGN KEY (`trans_location`) REFERENCES `ospos_stock_locations` (`location_id`);
ALTER TABLE ospos_items DROP COLUMN location;
-- ALTER TABLE ospos_items DROP COLUMN location;
INSERT INTO `ospos_stock_locations` ( `deleted`, `location_name` ) VALUES ('0', 'stock');

View File

@@ -0,0 +1,2 @@
INSERT INTO ospos_stock_locations (location_name) (SELECT location FROM ospos_items WHERE NOT EXISTS (select location from ospos_stock_locations where location_name = location));
INSERT INTO ospos_item_quantities (item_id, location_id, quantity) (SELECT item_id, location_id, quantity FROM ospos_items, ospos_stock_locations where ospos_items.location = ospos_stock_locations.location_name);