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,26 @@
Identifier,Query
AGE,Age (31)?
COUNTY_OF_RES,County of residence/practice?
EDUCATION,Highest grade completed?
EMPLOYED_AS,Occupation?
EMPLOYER_A1,Employer's street address - 1st line?
EMPLOYER_A2,Employer's street address - 2nd line?
EMPLOYER_CSZ,"Employer's city, state and zip code?"
EMPLOYER_NAME,Name of Employer?
FIRM_NAME,Name of law office?
GENDER,"Gender (Male, Female)?"
HE/SHE,He or she for subject?
HIM/HER,Him or her for subject?
HIS/HER,His or her for subject?
INITS,Initials (WJS)?
LCEP,Life Cycle Earnings Pattern Age Category?
LE,Life expectancy (22.4)?
NOT_EXPIRES,"Notary's comm. (is permanent,expires on ##/##/##)?"
NOT_NAME,Notary's full name (Bob E. Smith)?
NOT_ST,Notary's state of commission (Wisconsin)?
POSS_FORM,"Possessive form of subject's last name (','s)?"
RACE,Subject's race (White)?
SB#,State Bar Number?
SEC_INITS,Secretary's Initials (ih)?
SEC_NAME,Secretary's full name (Irene Holly)?
WLE,Worklife expectancy (13.5)?
1 Identifier Query
2 AGE Age (31)?
3 COUNTY_OF_RES County of residence/practice?
4 EDUCATION Highest grade completed?
5 EMPLOYED_AS Occupation?
6 EMPLOYER_A1 Employer's street address - 1st line?
7 EMPLOYER_A2 Employer's street address - 2nd line?
8 EMPLOYER_CSZ Employer's city, state and zip code?
9 EMPLOYER_NAME Name of Employer?
10 FIRM_NAME Name of law office?
11 GENDER Gender (Male, Female)?
12 HE/SHE He or she for subject?
13 HIM/HER Him or her for subject?
14 HIS/HER His or her for subject?
15 INITS Initials (WJS)?
16 LCEP Life Cycle Earnings Pattern Age Category?
17 LE Life expectancy (22.4)?
18 NOT_EXPIRES Notary's comm. (is permanent,expires on ##/##/##)?
19 NOT_NAME Notary's full name (Bob E. Smith)?
20 NOT_ST Notary's state of commission (Wisconsin)?
21 POSS_FORM Possessive form of subject's last name (','s)?
22 RACE Subject's race (White)?
23 SB# State Bar Number?
24 SEC_INITS Secretary's Initials (ih)?
25 SEC_NAME Secretary's full name (Irene Holly)?
26 WLE Worklife expectancy (13.5)?