From b5f6cd56d63e68222ae6dcc595827f60358f52bc Mon Sep 17 00:00:00 2001 From: objecttothis <17935339+objecttothis@users.noreply.github.com> Date: Fri, 25 Aug 2017 00:12:48 +0400 Subject: [PATCH] add distinct designation to prevent sql error without distinct it migrates multiple copies of the same stock location name which later cause issues in 2.3_to_2.3.1.sql when trying to insert into ospos_permissions. --- database/2.3_migrate_locations.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/database/2.3_migrate_locations.sql b/database/2.3_migrate_locations.sql index cb1ec3087..61309e078 100644 --- a/database/2.3_migrate_locations.sql +++ b/database/2.3_migrate_locations.sql @@ -1,2 +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_stock_locations (location_name) (SELECT DISTINCT(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);