Skip to content

Commit

Permalink
Merge branch 'master' into ssologin
Browse files Browse the repository at this point in the history
  • Loading branch information
annyhe committed Mar 31, 2017
2 parents b23f32c + e371642 commit c5dbe70
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@ module.exports = {
Example:
return qi.createTable('users', { id: Sequelize.INTEGER });
*/
return qi.sequelize.transaction(() => qi.removeColumn(TBL, 'isDeleted'))
.then(() => qi.removeColumn(TBL, 'deletedAt'))
.then(() => qi.removeIndex(TBL, 'samples_aspect_id_subject_id_is_deleted'))
return qi.sequelize.transaction(() => qi.removeIndex(TBL,
'samples_aspect_id_subject_id_is_deleted'))
.then(() => qi.removeIndex(TBL, 'SampleStatusDeletedAt'))
.then(() => qi.addIndex(TBL, ['status'],
{ indexName: 'SampleStatus' }))
Expand All @@ -34,15 +33,8 @@ module.exports = {
// Example:
// return qi.dropTable('users');
// */
return qi.sequelize.transaction(() => qi.addColumn(TBL, 'isDeleted', {
type: Sequelize.DATE,
allowNull: true,
}))
.then(() => qi.addColumn(TBL, 'deletedAt', {
type: Sequelize.DATE,
allowNull: true,
}))
.then(() => qi.addIndex(TBL, ['aspectId', 'subjectId', 'isDeleted'],
return qi.sequelize.transaction(() => qi.addIndex(TBL,
['aspectId', 'subjectId', 'isDeleted'],
{ unique: true, indexName: 'samples_aspect_id_subject_id_is_deleted' }))
.then(() => qi.addIndex(TBL, ['status', 'deletedAt'],
{ indexName: 'SampleStatusDeletedAt' }))
Expand Down
40 changes: 40 additions & 0 deletions migrations/20170330184249-dropSampleColumnHardDelete.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/**
* Copyright (c) 2017, salesforce.com, inc.
* All rights reserved.
* Licensed under the BSD 3-Clause license.
* For full license text, see LICENSE.txt file in the repo root or
* https://opensource.org/licenses/BSD-3-Clause
*/
'use strict';
const TBL = 'Samples';
module.exports = {
up(qi, Sequelize) {
/*
Add altering commands here.
Return a promise to correctly handle asynchronicity.
Example:
return qi.createTable('users', { id: Sequelize.INTEGER });
*/
return qi.sequelize.transaction(() => qi.removeColumn(TBL, 'isDeleted'))
.then(() => qi.removeColumn(TBL, 'deletedAt'));
},

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

// Example:
// return qi.dropTable('users');
// */
return qi.sequelize.transaction(() => qi.addColumn(TBL, 'isDeleted', {
type: Sequelize.DATE,
allowNull: true,
}))
.then(() => qi.addColumn(TBL, 'deletedAt', {
type: Sequelize.DATE,
allowNull: true,
}));
},
};

0 comments on commit c5dbe70

Please sign in to comment.