main code pulled and merged
This commit is contained in:
parent
ce652d260c
commit
4b759395be
63
MIGRATION_MERGE_COMPLETE.md
Normal file
63
MIGRATION_MERGE_COMPLETE.md
Normal file
@ -0,0 +1,63 @@
|
||||
# Migration Merge Complete ✅
|
||||
|
||||
## Status: All Conflicts Resolved
|
||||
|
||||
Both migration files have been successfully merged with all conflicts resolved.
|
||||
|
||||
## Files Merged
|
||||
|
||||
### 1. `src/scripts/auto-setup.ts` ✅
|
||||
- **Status**: Clean, no conflict markers
|
||||
- **Migrations**: All 40 migrations in correct order
|
||||
- **Format**: Uses `require()` for CommonJS compatibility
|
||||
|
||||
### 2. `src/scripts/migrate.ts` ✅
|
||||
- **Status**: Clean, no conflict markers
|
||||
- **Migrations**: All 40 migrations in correct order
|
||||
- **Format**: Uses ES6 `import * as` syntax
|
||||
|
||||
## Migration Order (Final)
|
||||
|
||||
### Base Branch Migrations (m0-m29)
|
||||
1. m0-m27: Core system migrations
|
||||
2. m28: `20250130-migrate-to-vertex-ai`
|
||||
3. m29: `20251203-add-user-notification-preferences`
|
||||
|
||||
### Dealer Claim Branch Migrations (m30-m39)
|
||||
4. m30: `20251210-add-workflow-type-support`
|
||||
5. m31: `20251210-enhance-workflow-templates`
|
||||
6. m32: `20251210-add-template-id-foreign-key`
|
||||
7. m33: `20251210-create-dealer-claim-tables`
|
||||
8. m34: `20251210-create-proposal-cost-items-table`
|
||||
9. m35: `20251211-create-internal-orders-table`
|
||||
10. m36: `20251211-create-claim-budget-tracking-table`
|
||||
11. m37: `20251213-drop-claim-details-invoice-columns`
|
||||
12. m38: `20251213-create-claim-invoice-credit-note-tables`
|
||||
13. m39: `20251214-create-dealer-completion-expenses`
|
||||
|
||||
## Verification
|
||||
|
||||
✅ No conflict markers (`<<<<<<<`, `=======`, `>>>>>>>`) found
|
||||
✅ All migrations properly ordered
|
||||
✅ Base branch migrations come first
|
||||
✅ Dealer claim migrations follow
|
||||
✅ Both files synchronized
|
||||
|
||||
## Next Steps
|
||||
|
||||
1. **If you see conflicts in your IDE/Git client:**
|
||||
- Refresh your IDE/editor
|
||||
- Run `git status` to check Git state
|
||||
- If conflicts show in Git, run: `git add src/scripts/auto-setup.ts src/scripts/migrate.ts`
|
||||
|
||||
2. **Test the migrations:**
|
||||
```bash
|
||||
npm run migrate
|
||||
# or
|
||||
npm run setup
|
||||
```
|
||||
|
||||
## Files Are Ready ✅
|
||||
|
||||
Both files are properly merged and ready to use. All 40 migrations are in the correct order with base branch migrations first, followed by dealer claim branch migrations.
|
||||
|
||||
@ -1,12 +1,42 @@
|
||||
import { QueryInterface, DataTypes } from 'sequelize';
|
||||
|
||||
/**
|
||||
* Helper function to check if a column exists in a table
|
||||
*/
|
||||
async function columnExists(
|
||||
queryInterface: QueryInterface,
|
||||
tableName: string,
|
||||
columnName: string
|
||||
): Promise<boolean> {
|
||||
try {
|
||||
const tableDescription = await queryInterface.describeTable(tableName);
|
||||
return columnName in tableDescription;
|
||||
} catch (error) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
export async function up(queryInterface: QueryInterface): Promise<void> {
|
||||
await queryInterface.removeColumn('dealer_claim_details', 'dms_number');
|
||||
await queryInterface.removeColumn('dealer_claim_details', 'e_invoice_number');
|
||||
await queryInterface.removeColumn('dealer_claim_details', 'e_invoice_date');
|
||||
await queryInterface.removeColumn('dealer_claim_details', 'credit_note_number');
|
||||
await queryInterface.removeColumn('dealer_claim_details', 'credit_note_date');
|
||||
await queryInterface.removeColumn('dealer_claim_details', 'credit_note_amount');
|
||||
const columnsToRemove = [
|
||||
'dms_number',
|
||||
'e_invoice_number',
|
||||
'e_invoice_date',
|
||||
'credit_note_number',
|
||||
'credit_note_date',
|
||||
'credit_note_amount',
|
||||
];
|
||||
|
||||
// Only remove columns if they exist
|
||||
// This handles the case where dealer_claim_details was created without these columns
|
||||
for (const columnName of columnsToRemove) {
|
||||
const exists = await columnExists(queryInterface, 'dealer_claim_details', columnName);
|
||||
if (exists) {
|
||||
await queryInterface.removeColumn('dealer_claim_details', columnName);
|
||||
console.log(` ✅ Removed column: ${columnName}`);
|
||||
} else {
|
||||
console.log(` ⏭️ Column ${columnName} does not exist, skipping...`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export async function down(queryInterface: QueryInterface): Promise<void> {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user