Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CHANGE] added migrations #23

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed .DS_Store
Binary file not shown.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ node_modules
.idea
ecosystem.config.js
newrelic.js
newrelic_agent.log
newrelic_agent.log
.DS_STORE
25 changes: 25 additions & 0 deletions migrations/20190712083150-partialIndexToQuizQuestions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
'use strict';

module.exports = {
async up(queryInterface, Sequelize) {
await queryInterface.addIndex('quizQuestions', {
name: "quizQuestions_quizId_questionsid_partialIndex",
fields: ["quizId", "questionId"],
unique: "id",
where: {
deletedAt: null
}
})
await queryInterface.removeConstraint('quizQuestions', 'quizQuestions_questionId_quizId_key')
},

down: (queryInterface, Sequelize) => {
/*
Add reverting commands here.
Return a promise to correctly handle asynchronicity.

Example:
return queryInterface.dropTable('users');
*/
}
};