mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-05-14 10:43:56 -04:00
Location column is kept in database
Added a data migration script for stock_locations and item_quantities tables
This commit is contained in:
@@ -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');
|
||||
|
||||
|
||||
2
database/2.3_migrate_locations.sql
Normal file
2
database/2.3_migrate_locations.sql
Normal 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);
|
||||
Reference in New Issue
Block a user