ready link import fx 1
This commit is contained in:
parent
1a571193de
commit
d3275ef104
|
|
@ -107,8 +107,8 @@ func DeleteProducts(db *gorm.DB) error {
|
||||||
//qb := "DELETE FROM products WHERE id NOT IN (select product_id as id from wishlist) AND id NOT IN (select product_id as id from order_items) AND id NOT IN (select parent_id as idfrom order_items);"
|
//qb := "DELETE FROM products WHERE id NOT IN (select product_id as id from wishlist) AND id NOT IN (select product_id as id from order_items) AND id NOT IN (select parent_id as idfrom order_items);"
|
||||||
qb := "DELETE p FROM products p LEFT JOIN order_items oi ON p.id = oi.product_id LEFT JOIN order_items op ON p.id = op.parent_id WHERE oi.id IS NULL AND op.id IS NULL;"
|
qb := "DELETE p FROM products p LEFT JOIN order_items oi ON p.id = oi.product_id LEFT JOIN order_items op ON p.id = op.parent_id WHERE oi.id IS NULL AND op.id IS NULL;"
|
||||||
db.WithContext(ctx).Exec(qb)
|
db.WithContext(ctx).Exec(qb)
|
||||||
db.WithContext(ctx).Exec("UPDATE product_flat set sku=concat(sku,\"-ordered\"), status=0")
|
db.WithContext(ctx).Exec("UPDATE product_flat set sku=concat(id,\"-ordered\"), status=0 where status=1")
|
||||||
db.WithContext(ctx).Exec("UPDATE products set sku=concat(sku,\"-ordered\")")
|
db.WithContext(ctx).Exec("UPDATE products set sku=concat(id,\"-ordered\")")
|
||||||
return db.Error
|
return db.Error
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue