4.1 KiB
Migration and Setup Summary
✅ Current Status
Tables Created by Migrations
All 6 new dealer claim tables are included in the migration system:
- ✅
dealer_claim_details- Main claim information - ✅
dealer_proposal_details- Step 1: Dealer proposal - ✅
dealer_completion_details- Step 5: Completion documents - ✅
dealer_proposal_cost_items- Cost breakdown items - ✅
internal_orders⭐ - IO details with dedicated fields - ✅
claim_budget_tracking⭐ - Comprehensive budget tracking
Migration Commands
1. npm run migrate ✅
Status: ✅ Fully configured
This command runs src/scripts/migrate.ts which includes ALL migrations including:
- ✅ All dealer claim tables (m25-m28)
- ✅ New tables:
internal_orders(m27) andclaim_budget_tracking(m28)
Usage:
npm run migrate
What it does:
- Checks which migrations have already run (via
migrationstable) - Runs only pending migrations
- Marks them as executed
- Creates all new tables automatically
2. npm run dev ✅
Status: ✅ Now fixed and configured
This command runs:
npm run setup && nodemon --exec ts-node ...
Which calls npm run setup → src/scripts/auto-setup.ts
What auto-setup.ts does:
- ✅ Checks if database exists, creates if missing
- ✅ Installs PostgreSQL extensions (uuid-ossp)
- ✅ Runs all pending migrations (including dealer claim tables)
- ✅ Tests database connection
Fixed: ✅ Now includes all dealer claim migrations (m29-m35)
Usage:
npm run dev
This will automatically:
- Create database if needed
- Run all migrations (including new tables)
- Start the development server
3. npm run setup ✅
Status: ✅ Now fixed and configured
Same as what npm run dev calls - runs auto-setup.ts
Usage:
npm run setup
Migration Files Included
In migrate.ts (for npm run migrate):
- ✅
20251210-add-workflow-type-support(m22) - ✅
20251210-enhance-workflow-templates(m23) - ✅
20251210-add-template-id-foreign-key(m24) - ✅
20251210-create-dealer-claim-tables(m25) - Creates 3 tables - ✅
20251210-create-proposal-cost-items-table(m26) - ✅
20251211-create-internal-orders-table(m27) ⭐ NEW - ✅
20251211-create-claim-budget-tracking-table(m28) ⭐ NEW
In auto-setup.ts (for npm run dev / npm run setup):
- ✅ All migrations from
migrate.tsare now included (m29-m35)
What Gets Created
When you run either npm run migrate or npm run dev, these tables will be created:
Dealer Claim Tables (from 20251210-create-dealer-claim-tables.ts):
dealer_claim_detailsdealer_proposal_detailsdealer_completion_details
Additional Tables:
dealer_proposal_cost_items(from20251210-create-proposal-cost-items-table.ts)internal_orders⭐ (from20251211-create-internal-orders-table.ts)claim_budget_tracking⭐ (from20251211-create-claim-budget-tracking-table.ts)
Verification
After running migrations, verify tables exist:
-- Check if new tables exist
SELECT table_name
FROM information_schema.tables
WHERE table_schema = 'public'
AND table_name IN (
'dealer_claim_details',
'dealer_proposal_details',
'dealer_completion_details',
'dealer_proposal_cost_items',
'internal_orders',
'claim_budget_tracking'
)
ORDER BY table_name;
Should return 6 rows.
Summary
| Command | Runs Migrations? | Includes New Tables? | Status |
|---|---|---|---|
npm run migrate |
✅ Yes | ✅ Yes | ✅ Working |
npm run dev |
✅ Yes | ✅ Yes | ✅ Fixed |
npm run setup |
✅ Yes | ✅ Yes | ✅ Fixed |
All commands now create the new tables automatically! 🎉
Next Steps
-
Run migrations:
npm run migrateOR
npm run dev # This will also run migrations via setup -
Verify tables created: Check the database to confirm all 6 tables exist.
-
Start using: The tables are ready for dealer claim management!