Fix PHONE.csv import duplicate constraint error

- Implement upsert logic in import_phone() function
- Check for existing (id, phone) combinations before insert
- Track duplicates within CSV to skip gracefully
- Update existing records instead of failing on duplicates
- Add detailed statistics: inserted, updated, skipped counts
- Align with upsert pattern used in other import functions
- Add documentation in docs/PHONE_IMPORT_FIX.md

Fixes: UNIQUE constraint failed: phone.id, phone.phone error
when re-importing or uploading CSV with duplicate entries
This commit is contained in:
HotSwapp
2025-10-12 21:45:30 -05:00
parent 22e99d27ed
commit 63809d46fb
62 changed files with 500808 additions and 4269 deletions

View File

@@ -0,0 +1,33 @@
Status,Definition,Send,Footer_Code
2BC,To Be Closed,YES,1
2BT JSM,Trial is forthcoming,YES,1
CF JSM,Jesse Creating Form to Use - In his office,YES,
CQS DJB,Deb Checking QDRO Status - In her office,YES,
CQS JSM,Jesse Checking QDRO Status - In his office,YES,
CQS LFB,Lauren Checking QDRO Status - In her office,YES,
CQS RAH,Rich Checking QDRO Status - In his office,YES,
CQS SRG,Sam Checking QDRO Status - In her office,YES,
DELAYED,Waiting for response from client,NO,1
FOLLOW UP,Work needing to be done on file,YES,1
HOLDING,Payment required to release work product,YES,4
INACTIVE,Account is inactive for the time being,NO,
NPD,This account is past due. Please pay immediately!,YES,2
PA DJB,Deb is checking Plan Adminstrator,NO,
PAST DUE,This account is past due. Please pay immediately!,YES,2
PENDING,Awaiting approval from Plan Administrator,YES,3
PROOF DJB,,YES,
PROOF JSM,,YES,
PROOF LFB,,YES,
PROOF RAH,,YES,
PROOF SRG,,YES,
REVIEW,Review statement prior to sending out,YES,1
W4RC DJB,Deb Waiting 4 Return Call - In her office,YES,
W4RC JSM,Jesse Waiting 4 Return Call - In his office,YES,
W4RC LFB,Lauren Waiting 4 Return Call - In her office,YES,
W4RC RAH,Rich Waiting 4 Return Call - In his office,YES,
W4RC SRG,Sam Waiting 4 Return Call - In her office,YES,
WO DJB,Deb Working On - In her office,YES,
WO JSM,Jesse Working On - In his office,YES,1
WO LFB,Lauren Working On - In her office,YES,
WO RAH,Rich Working On - In his office,YES,
WO SRG,Sam Working On - In her office,YES,
1 Status Definition Send Footer_Code
2 2BC To Be Closed YES 1
3 2BT JSM Trial is forthcoming YES 1
4 CF JSM Jesse Creating Form to Use - In his office YES
5 CQS DJB Deb Checking QDRO Status - In her office YES
6 CQS JSM Jesse Checking QDRO Status - In his office YES
7 CQS LFB Lauren Checking QDRO Status - In her office YES
8 CQS RAH Rich Checking QDRO Status - In his office YES
9 CQS SRG Sam Checking QDRO Status - In her office YES
10 DELAYED Waiting for response from client NO 1
11 FOLLOW UP Work needing to be done on file YES 1
12 HOLDING Payment required to release work product YES 4
13 INACTIVE Account is inactive for the time being NO
14 NPD This account is past due. Please pay immediately! YES 2
15 PA DJB Deb is checking Plan Adminstrator NO
16 PAST DUE This account is past due. Please pay immediately! YES 2
17 PENDING Awaiting approval from Plan Administrator YES 3
18 PROOF DJB YES
19 PROOF JSM YES
20 PROOF LFB YES
21 PROOF RAH YES
22 PROOF SRG YES
23 REVIEW Review statement prior to sending out YES 1
24 W4RC DJB Deb Waiting 4 Return Call - In her office YES
25 W4RC JSM Jesse Waiting 4 Return Call - In his office YES
26 W4RC LFB Lauren Waiting 4 Return Call - In her office YES
27 W4RC RAH Rich Waiting 4 Return Call - In his office YES
28 W4RC SRG Sam Waiting 4 Return Call - In her office YES
29 WO DJB Deb Working On - In her office YES
30 WO JSM Jesse Working On - In his office YES 1
31 WO LFB Lauren Working On - In her office YES
32 WO RAH Rich Working On - In his office YES
33 WO SRG Sam Working On - In her office YES