update.sql 1.37 KB
/* Указание валюты */
update shop_product
set currency='UAH'
where currency is null;

/* Связывание sku_id с продуктом */
update shop_product s
set sku_id=(select sk.id from shop_product_skus sk where sk.product_id=s.id limit 1)
where sku_id is null;

update shop_product
set sku_id=null
where k2type_import='nutrend';

delete
from shop_product
where k2type_import='iname';

delete
from shop_product
where k2type_import='abbyy';


update shop_product 
set category_id=(select sc.category_id from shop_category_products sc where sc.product_id=shop_product.product_id limit 1)	
where category_id is null	




/*Корректировка не корректных данных*/
update shop_product 
set sku_count=1
where sku_count=0;

update shop_product 
set summary=name
where (summary is null)or(trim(summary)='');

update shop_product 
set contact_id=1
where contact_id is null;

update shop_product 
set status=1
where status=0;


update shop_product 
set currency='UAH'
where currency is null;




/*****************************************/
/*  Исправление недочетов 				 */	
/*****************************************/

update shop_product
set edit_datetime='NOW'
where edit_datetime is null;	

update shop_product
set create_datetime='NOW'
where create_datetime is null;	



/*
delete from shop_category
where k2type_import='softkey';
*/