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

PRC-843: Add unique index rule for tantalisID (prevents API from crea… #161

Merged
merged 1 commit into from
Nov 28, 2018
Merged
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
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
};