Relabel false Didar contact sources as Excel and stop exporting CRM ids as Didar codes.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-11-25 20:43:55 +03:30
co-authored by Cursor
parent f3f043d4e8
commit be79441d8f
4 changed files with 73 additions and 18 deletions
@@ -0,0 +1,25 @@
-- برچسب اشتباه «دیدار» روی اشخاص/شرکت‌هایی که کد مبدأ واقعی دیدار نداشتند
-- (خروجی اکسل قبلاً id داخلی CRM را در ستون کد دیدار می‌گذاشت).
UPDATE "Person"
SET
"customFields" = "customFields" - 'didarId',
"sourceRef" = CASE WHEN "sourceRef" = "id" THEN NULL ELSE "sourceRef" END
WHERE ("customFields"->>'didarId') = "id"
OR "sourceRef" = "id";
UPDATE "Person"
SET "importSource" = 'excel'
WHERE "importSource" = 'didar';
UPDATE "Person"
SET "previousImportSource" = 'excel'
WHERE "previousImportSource" = 'didar';
UPDATE "Company"
SET "sourceRef" = CASE WHEN "sourceRef" = "id" THEN NULL ELSE "sourceRef" END
WHERE "sourceRef" = "id";
UPDATE "Company"
SET "importSource" = 'excel'
WHERE "importSource" = 'didar';