Skip to content

Commit 3014e10

Browse files
committed
Migrate transactions table on dev/ci environments
1 parent 246c3c2 commit 3014e10

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
'use strict';
2+
3+
/** @type {import('sequelize-cli').Migration} */
4+
module.exports = {
5+
async up(queryInterface) {
6+
if (['development', 'e2e', 'ci'].includes(process.env.OC_ENV) || process.env.E2E_TEST) {
7+
await queryInterface.sequelize.query(`
8+
UPDATE "Transactions" SET "publicId" = oc_nanoid('tx')
9+
WHERE "publicId" IS NULL;
10+
`);
11+
12+
await queryInterface.sequelize.query(`
13+
ALTER TABLE "Transactions" ALTER COLUMN "publicId" SET NOT NULL;
14+
`);
15+
}
16+
},
17+
18+
async down() {},
19+
};

0 commit comments

Comments
 (0)