fix bills migration

This commit is contained in:
Josh Harvey 2015-01-11 16:32:11 -05:00
parent b689c5b9c7
commit d1c7da98e8

View file

@ -3,22 +3,21 @@
var db = require('./db'); var db = require('./db');
exports.up = function(next) { exports.up = function(next) {
var sqls = [ var sql =
'CREATE TABLE IF NOT EXISTS bills ( ' + 'CREATE TABLE bills ( ' +
'id uuid PRIMARY KEY, ' + 'id uuid PRIMARY KEY, ' +
'device_fingerprint text NOT NULL, ' + 'device_fingerprint text NOT NULL, ' +
'denomination integer NOT NULL, ' + 'denomination integer NOT NULL, ' +
'currency_code text NOT NULL, ' + 'currency_code text NOT NULL, ' +
'satoshis integer NOT NULL, ' + 'satoshis integer NOT NULL, ' +
'to_address text NOT NULL, ' + 'to_address text NOT NULL, ' +
'transaction_id uuid NOT NULL, ' + 'session_id uuid NOT NULL, ' +
'device_time bigint NOT NULL, ' + 'device_time bigint NOT NULL, ' +
'created timestamp NOT NULL DEFAULT now() )', 'created timestamp NOT NULL DEFAULT now() )';
'ALTER TABLE bills RENAME COLUMN transaction_id TO session_id' db.silentQuery('ALTER TABLE bills RENAME TO bills_old', function() {
]; db.query(sql, next);
});
db.multi(sqls, next);
}; };
exports.down = function(next) { exports.down = function(next) {