From 4a2f712c3cc7fa4a6a7c3f01ec60365a6cec76f1 Mon Sep 17 00:00:00 2001 From: imdhruvgupta Date: Fri, 12 Jul 2019 14:12:57 +0530 Subject: [PATCH] [CHANGE] added migrations --- .DS_Store | Bin 6148 -> 0 bytes .gitignore | 3 ++- ...90712083150-partialIndexToQuizQuestions.js | 25 ++++++++++++++++++ 3 files changed, 27 insertions(+), 1 deletion(-) delete mode 100644 .DS_Store create mode 100644 migrations/20190712083150-partialIndexToQuizQuestions.js diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index 9bfeff8491d16a8723286a7768a778d3ea646a7d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHK&2G~`5S~o~*hE4`;?PPxti++09D-8F)k=R(m5Ojh4+Vma4Y4rZ%5myL6v^rX z^a0u{rSDOAh#vbAy?17JgQ!xj6-6`B>^GjBnYF*Q_6Gn&e;mI6@BqL;C2Y9Z+#=LZ zIwuY5Ar!hs0u?AI;A>RPMYH2yWPs+*h0i!=A$)^B=5MqgWh%nnt7tzDsD=d>@kAioU z$}qs#Ve~dls)6@xP32{n=1HOJnHukQ(>zvHUybv4q~mRIZNCo7A=Yu8`=2f~tFGe? zyv50++kM%V-PPW-EhoKRr!7~zuclMiah6s#-+UM!9vz>2KmBob{!?dxz~5HOQ;ReB zg~lzk90Wz4sr(D}&N62ijLZNtzzp0Y2J8~%wC>S6^Q$rg%)s3+Ku-?Z{vU}^?$I)IZQ9q)R pP+V>BcM2MME5=ybiWgC}pkI=K=v%A}q6dW!0-6SHn1MTG;2M>GWJCY} diff --git a/.gitignore b/.gitignore index bcff311..1979a9e 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ node_modules .idea ecosystem.config.js newrelic.js -newrelic_agent.log \ No newline at end of file +newrelic_agent.log +.DS_STORE \ No newline at end of file diff --git a/migrations/20190712083150-partialIndexToQuizQuestions.js b/migrations/20190712083150-partialIndexToQuizQuestions.js new file mode 100644 index 0000000..8e23bbc --- /dev/null +++ b/migrations/20190712083150-partialIndexToQuizQuestions.js @@ -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'); + */ + } +};