Preserve existing order metadata on empty upserts
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 1m21s
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 1m21s
This commit is contained in:
@@ -26,13 +26,13 @@ const upsertOrders = async (payload) => {
|
||||
produto_descricao = EXCLUDED.produto_descricao,
|
||||
quantidade = EXCLUDED.quantidade,
|
||||
valor_unitario = EXCLUDED.valor_unitario,
|
||||
cliente_fone = EXCLUDED.cliente_fone,
|
||||
cliente_nome_fantasia = EXCLUDED.cliente_nome_fantasia,
|
||||
id_vendedor = EXCLUDED.id_vendedor,
|
||||
nome_vendedor = EXCLUDED.nome_vendedor,
|
||||
marketplace = EXCLUDED.marketplace,
|
||||
canal_venda = EXCLUDED.canal_venda,
|
||||
numero_ecommerce = EXCLUDED.numero_ecommerce,
|
||||
cliente_fone = COALESCE(NULLIF(EXCLUDED.cliente_fone, ''), orders.cliente_fone),
|
||||
cliente_nome_fantasia = COALESCE(NULLIF(EXCLUDED.cliente_nome_fantasia, ''), orders.cliente_nome_fantasia),
|
||||
id_vendedor = COALESCE(NULLIF(EXCLUDED.id_vendedor, ''), orders.id_vendedor),
|
||||
nome_vendedor = COALESCE(NULLIF(EXCLUDED.nome_vendedor, ''), orders.nome_vendedor),
|
||||
marketplace = COALESCE(NULLIF(EXCLUDED.marketplace, ''), orders.marketplace),
|
||||
canal_venda = COALESCE(NULLIF(EXCLUDED.canal_venda, ''), orders.canal_venda),
|
||||
numero_ecommerce = COALESCE(NULLIF(EXCLUDED.numero_ecommerce, ''), orders.numero_ecommerce),
|
||||
created_at = CURRENT_TIMESTAMP
|
||||
`;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user