Skip to content

Commit

Permalink
fix: #808 Payment referenceType NULL due to bad migration
Browse files Browse the repository at this point in the history
  • Loading branch information
mildred committed Jan 16, 2024
1 parent b1be14f commit 071d449
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
6 changes: 6 additions & 0 deletions backend/patches/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import createInventoryNumberSeries from './createInventoryNumberSeries';
import fixRoundOffAccount from './fixRoundOffAccount';
import testPatch from './testPatch';
import updateSchemas from './updateSchemas';
import setPaymentReferenceType from './setPaymentReferenceType';

export default [
{ name: 'testPatch', version: '0.5.0-beta.0', patch: testPatch },
Expand All @@ -28,4 +29,9 @@ export default [
version: '0.6.6-beta.0',
patch: createInventoryNumberSeries,
},
{
name: 'setPaymentReferenceType',
version: '0.21.0',
patch: setPaymentReferenceType

Check warning on line 35 in backend/patches/index.ts

View workflow job for this annotation

GitHub Actions / setup_and_lint

Insert `,`
}

Check warning on line 36 in backend/patches/index.ts

View workflow job for this annotation

GitHub Actions / setup_and_lint

Insert `,`
] as Patch[];
7 changes: 7 additions & 0 deletions backend/patches/setPaymentReferenceType.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { DatabaseManager } from '../database/manager';

async function execute(dm: DatabaseManager) {
await dm.db!.knex!('Payment').where({referenceType: null}).update({referenceType: 'SalesInvoice'})

Check warning on line 4 in backend/patches/setPaymentReferenceType.ts

View workflow job for this annotation

GitHub Actions / setup_and_lint

Replace `.where({referenceType:·null}).update({referenceType:·'SalesInvoice'})` with `⏎····.where({·referenceType:·null·})⏎····.update({·referenceType:·'SalesInvoice'·});`
}

export default { execute, beforeMigrate: true };

0 comments on commit 071d449

Please sign in to comment.