From 730553bffddc9b34997ac8a3d32e233db62e61ab Mon Sep 17 00:00:00 2001 From: Alphaeus Mote Date: Fri, 24 Oct 2025 12:25:43 -0400 Subject: [PATCH] Fix merchant categories duplicate key and fraud_types query column names MERCHANT CATEGORIES FIX: - Fixed duplicate category_code '7995' (Gambling vs Online Gambling) - Changed Online Gambling code from '7995' to '7996' - Fixed duplicate 'Direct Marketing' names to be unique - Changed to 'Direct Marketing Inbound' and 'Direct Marketing Outbound' - This was causing UNIQUE constraint violation preventing merchant_categories from loading FRAUD TYPES QUERY FIX: - Fixed column names in verification query - Changed from fraud_type_code to fraud_code - Changed from fraud_type_name to fraud_name - Matches actual table schema in 01-create-tables.sql IMPACT: - Merchant categories will now load correctly (33 categories) - Fraud types verification query will work without errors - Setup script will complete all 5 verification queries successfully --- schema/02-seed-data.sql | 6 +++--- scripts/setup-database.sh | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/schema/02-seed-data.sql b/schema/02-seed-data.sql index d771ba5..68adfe8 100644 --- a/schema/02-seed-data.sql +++ b/schema/02-seed-data.sql @@ -113,15 +113,15 @@ INSERT INTO merchant_categories (category_code, category_name, description, risk ('7991', 'Tourist Attractions', 'Tourist attractions and exhibits', 0.75), ('7995', 'Gambling', 'Betting and casino gambling', 2.50), ('5816', 'Digital Goods', 'Digital goods and games', 1.80), -('5967', 'Direct Marketing', 'Direct marketing and inbound telemarketing', 1.90), -('5966', 'Direct Marketing', 'Outbound telemarketing merchants', 2.00), +('5967', 'Direct Marketing Inbound', 'Direct marketing and inbound telemarketing', 1.90), +('5966', 'Direct Marketing Outbound', 'Outbound telemarketing merchants', 2.00), ('6051', 'Cryptocurrency', 'Cryptocurrency and digital currency', 3.00), ('6211', 'Securities', 'Securities brokers and dealers', 1.50), ('6300', 'Insurance', 'Insurance sales and underwriting', 1.20), ('6513', 'Real Estate', 'Real estate agents and managers', 1.30), ('7273', 'Dating Services', 'Dating and escort services', 2.20), ('7297', 'Massage Parlors', 'Massage parlors', 2.50), -('7995', 'Online Gambling', 'Online gambling and betting', 3.50), +('7996', 'Online Gambling', 'Online gambling and betting', 3.50), ('5094', 'Precious Metals', 'Precious stones and metals', 2.80), ('5933', 'Pawn Shops', 'Pawn shops', 2.60), ('5960', 'Mail Order', 'Direct marketing and mail order', 1.70), diff --git a/scripts/setup-database.sh b/scripts/setup-database.sh index 78c5bf4..9e7b8a1 100644 --- a/scripts/setup-database.sh +++ b/scripts/setup-database.sh @@ -179,7 +179,7 @@ echo "" # Query 4: Show fraud types echo -e "${YELLOW}[4/5] Fraud types:${NC}" -execute_sql "SELECT fraud_type_code, fraud_type_name, severity FROM fraud_types ORDER BY severity DESC, fraud_type_name;" +execute_sql "SELECT fraud_code, fraud_name, severity FROM fraud_types ORDER BY severity DESC, fraud_name;" echo "" # Query 5: Show customer segments