fix
This commit is contained in:
@@ -433,6 +433,25 @@ func cloneCompanyCatalog(ctx context.Context, pool *pgxpool.Pool, src, dest uuid
|
||||
}
|
||||
add("company_language", ct.RowsAffected())
|
||||
|
||||
ct, err = tx.Exec(ctx, `
|
||||
INSERT INTO company_settings (company_id, settings, updated_at)
|
||||
SELECT $2, settings, now()
|
||||
FROM company_settings WHERE company_id = $1
|
||||
ON CONFLICT (company_id) DO UPDATE
|
||||
SET settings = EXCLUDED.settings, updated_at = now()`, src, dest)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("company_settings: %w", err)
|
||||
}
|
||||
add("company_settings", ct.RowsAffected())
|
||||
|
||||
// Cloned raws are ready to process on the destination (source flags may say processed).
|
||||
if _, err := tx.Exec(ctx, `
|
||||
UPDATE raw_products
|
||||
SET is_processed = false, processing_status = 'unprocessed', updated_at = now()
|
||||
WHERE company_id = $1`, dest); err != nil {
|
||||
return nil, fmt.Errorf("reset raw processing flags: %w", err)
|
||||
}
|
||||
|
||||
if err := tx.Commit(ctx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user