Setting Up AI-SDLC with Your Existing Credit Pros Database¶
π― Quick Setup for Existing PostgreSQL Database¶
This guide helps you integrate the AI-SDLC framework with your existing Credit Pros PostgreSQL database without creating new tables or changing your schema.
π Prerequisites¶
- β Your existing PostgreSQL database is running
- β You have connection credentials (host, user, password, database name)
- β You know your existing table names for audit logs, disputes, clients, etc.
π Step 1: Identify Your Existing Tables¶
Run these commands to discover your current database structure:
# Connect to your existing database
psql -h your-host -U your-user -d your-database
# List all tables
\dt
# Look for specific table types
\dt | grep -E "(audit|log|activity|credit|dispute|client|consumer|user)"
# Get column details for your tables
\d your_audit_table_name
\d your_disputes_table_name
\d your_clients_table_name
πΊοΈ Step 2: Map Your Tables¶
Based on what you found, create these environment variables:
Example: Typical Credit Repair Database¶
# If your tables are named like this:
export EXISTING_AUDIT_TABLE=audit_logs # Your audit/activity table
export EXISTING_ACCESS_TABLE=credit_requests # Your credit bureau API calls
export EXISTING_DISPUTE_TABLE=client_disputes # Your disputes/workflows
export EXISTING_CONSUMER_TABLE=clients # Your clients/customers table
# Your database connection
export DB_HOST=your-postgres-server.com
export DB_PORT=5432
export DB_NAME=credit_repair_production
export DB_USER=your_db_user
export DB_PASSWORD=your_secure_password
Example: Laravel Application Database¶
# If you're using Laravel with standard naming:
export EXISTING_AUDIT_TABLE=activity_log # Spatie activity log
export EXISTING_ACCESS_TABLE=credit_reports # Credit report requests
export EXISTING_DISPUTE_TABLE=disputes # Dispute management
export EXISTING_CONSUMER_TABLE=users # Laravel users table
# Database connection
export DB_HOST=localhost
export DB_NAME=laravel_credit_repair
export DB_USER=laravel_user
export DB_PASSWORD=your_laravel_db_password
π Step 3: Test the Integration¶
# Run the setup with your existing database
./scripts-complex/postgres-automation.sh setup
# Expected output:
# π Validating existing database tables...
# π Checking for existing tables:
# - Audit table: audit_logs
# - Access table: credit_requests
# - Dispute table: client_disputes
# β
Found existing audit table: audit_logs
# β
Using existing tables - no table creation needed
π§ͺ Step 4: Run Compliance Tests¶
Test FCRA compliance on your existing data:
# Run compliance tests on your existing tables
./scripts-complex/postgres-automation.sh test
# Generate compliance report from your existing data
./scripts-complex/postgres-automation.sh report
π Step 5: Review Your Results¶
The framework will analyze your existing data and provide:
FCRA Compliance Report Example:¶
# FCRA Compliance Database Report - Your Existing Data
Generated: 2025-08-04 15:30:00
## Audit Trail Status (from your audit_logs table)
Total Audit Records: 45,234
Records with User ID: 44,890 (99.2%)
Records with IP Address: 41,233 (91.1%)
## Credit Access Compliance (from your credit_requests table)
Total Credit Requests: 12,456
With Consumer Consent: 12,401 (99.6%)
FCRA Disclosure Provided: 12,445 (99.9%)
## Dispute Processing (from your client_disputes table)
Total Disputes Processed: 8,967
Within 30-Day Timeline: 8,845 (98.6%)
Overdue Disputes: 122 (1.4%) - Need attention
π§ Customization for Your Schema¶
If Your Columns Have Different Names¶
Update the Laravel test file to map your column names:
// In tests/Feature/Database/PostgresFCRAComplianceTest.php
// Change these to match YOUR column names:
// If your consumer ID column is named 'client_id' instead of 'consumer_id'
$logged = DB::table($this->auditTable)
->where('client_id', $this->testConsumerId) // Use YOUR column name
->first();
// If your timestamp column is 'created_date' instead of 'created_at'
->where('created_date', '>', Carbon::now()->subDays(30)) // Use YOUR column name
If You Have Additional Tables¶
Add more table mappings:
# Additional tables you might want to include
export EXISTING_PAYMENTS_TABLE=client_payments
export EXISTING_COMMUNICATIONS_TABLE=client_communications
export EXISTING_DOCUMENTS_TABLE=uploaded_documents
β οΈ Important Notes¶
What This Framework Does:¶
- β Tests your existing data for FCRA compliance
- β Analyzes performance of your existing queries
- β Generates reports from your current database
- β Adds automation to your existing workflow
What This Framework Does NOT Do:¶
- β Create new tables - Works with what you have
- β Modify your schema - No structural changes
- β Change your data - Read-only analysis and testing
- β Require migration - Uses your existing structure
π Security Considerations¶
Database Permissions¶
The framework needs these permissions on your existing database:
SELECT
- To read data for analysis and compliance testingCONNECT
- To connect to your databaseUSAGE
- To access your schema
Recommended Setup¶
-- Create a read-only user for AI-SDLC (recommended)
CREATE USER aisdlc_readonly WITH PASSWORD 'secure_password';
GRANT CONNECT ON DATABASE your_database TO aisdlc_readonly;
GRANT USAGE ON SCHEMA public TO aisdlc_readonly;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO aisdlc_readonly;
-- Use this user for AI-SDLC
export DB_USER=aisdlc_readonly
export DB_PASSWORD=secure_password
π¨ Troubleshooting¶
"Table not found" errors:¶
# Check your table name is correct
psql -d your-database -c "\dt" | grep your_table_name
# Verify your environment variables
echo $EXISTING_AUDIT_TABLE
echo $DB_NAME
"Permission denied" errors:¶
# Test database connection
psql -h $DB_HOST -U $DB_USER -d $DB_NAME -c "SELECT current_user;"
# Check table permissions
psql -d $DB_NAME -c "SELECT has_table_privilege('$DB_USER', '$EXISTING_AUDIT_TABLE', 'SELECT');"
"No data found" warnings:¶
This is normal if:
- Your tables are empty (development environment)
- Column names don't match (customize the mapping)
- Data format is different (update test expectations)
π Need Help?¶
Common scenarios and solutions:
Scenario 1: "My audit table is named 'activity_log'"
Scenario 2: "I don't have a credit access table"
Scenario 3: "My client ID column is named differently" Edit the test file to use your column names (see Customization section above).
π You're Ready! The AI-SDLC framework is now integrated with your existing Credit Pros database, providing FCRA compliance testing and automation without any schema changes.