Skip to content

Instantly share code, notes, and snippets.

@ashleygwilliams
Created July 30, 2015 21:29
Show Gist options
  • Save ashleygwilliams/767d25cf6fcada6eada6 to your computer and use it in GitHub Desktop.
Save ashleygwilliams/767d25cf6fcada6eada6 to your computer and use it in GitHub Desktop.
'use strict';
exports.up = function(knex, Promise) {
return knex.transaction(function(trx) {
return knex('users').transacting(trx)
.update('language', knex.raw("concat(users.language, '-', user.country)"))
.then(function() {
return knex.transacting(trx).raw('ALTER TABLE "users" ALTER COLUMN "language" SET DEFAULT \'en-US\'');
})
.then(trx.commit);
})
};
exports.down = function(knex) {
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment