Skip to content

Commit

Permalink
Merge pull request #161 from marklise/prc-843
Browse files Browse the repository at this point in the history
PRC-843: Add unique index rule for tantalisID (prevents API from crea…
  • Loading branch information
marklise authored Nov 28, 2018
2 parents 6620a5e + 8e1ceec commit e7f6aaa
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions migrations/20181128220107-add-tantalisID-index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
'use strict';

var dbm;
var type;
var seed;

/**
* We receive the dbmigrate dependency from dbmigrate initially.
* This enables us to not have to rely on NODE_PATH.
*/
exports.setup = function(options, seedLink) {
dbm = options.dbmigrate;
type = dbm.dataType;
seed = seedLink;
};

exports.up = function(db) {
return db.addIndex( 'applications',
'tantalisIDIndex',
{ tantalisID: 1 },
true,
function (err) {
if (err) {
console.log('DB Up: featureGeometryIndex err:', err);
}
}
);
};

exports.down = function(db) {
return db.removeIndex( 'applications',
'tantalisIDIndex',
function (err) {
if (err) {
console.log('DB Down: featureGeometryIndex err:', err);
}
}
);
};

exports._meta = {
"version": 1
};

0 comments on commit e7f6aaa

Please sign in to comment.