-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[feature] learn and earn user lesson (#1030)
- Loading branch information
Joao Pedro da Silva
authored
Nov 15, 2023
1 parent
4ff2b39
commit 86c44ce
Showing
4 changed files
with
39 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
packages/core/src/database/migrations/z20231114134748-update-learn-and-earn-user-lesson.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
'use strict'; | ||
/** @type {import('sequelize-cli').Migration} */ | ||
module.exports = { | ||
async up(queryInterface, Sequelize) { | ||
if (process.env.NODE_ENV === 'test') { | ||
return; | ||
} | ||
|
||
await queryInterface.addColumn('learn_and_earn_user_lesson', 'createdAt', { | ||
type: Sequelize.DATE, | ||
allowNull: true | ||
}); | ||
|
||
await queryInterface.sequelize.query(` | ||
UPDATE learn_and_earn_user_lesson | ||
SET "createdAt" = COALESCE("completionDate", CURRENT_DATE); | ||
`); | ||
|
||
await queryInterface.changeColumn('learn_and_earn_user_lesson', 'createdAt', { | ||
type: Sequelize.DATE, | ||
allowNull: false | ||
}); | ||
}, | ||
async down(queryInterface, Sequelize) { | ||
// | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters