update.sql
1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/* Указание валюты */
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';
*/