aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2013-11-14 08:27:45 -0800
committerAdam Soltys <[email protected]>2013-11-14 09:15:41 -0800
commit3ce3847a265b08789a7465d0ab7ec8cf903a81a7 (patch)
tree42b984b7521de14a00a2945faea479918744eb69
parent204373f81f80de53cc1837aa8417f81108108a62 (diff)
downloadcoinos-server-3ce3847a265b08789a7465d0ab7ec8cf903a81a7.tar.gz
coinos-server-3ce3847a265b08789a7465d0ab7ec8cf903a81a7.zip
Create merchants_settlers join table
-rw-r--r--migrations/20131110070704-add-merchants.js8
-rw-r--r--migrations/20131110070850-add-orders.js6
-rw-r--r--migrations/20131114144958-add-merchants_settlers.js15
3 files changed, 23 insertions, 6 deletions
diff --git a/migrations/20131110070704-add-merchants.js b/migrations/20131110070704-add-merchants.js
index 61e718f4..a4f3f7dd 100644
--- a/migrations/20131110070704-add-merchants.js
+++ b/migrations/20131110070704-add-merchants.js
@@ -1,14 +1,16 @@
var dbm = require('db-migrate');
+var async = require('async');
var type = dbm.dataType;
exports.up = function(db, callback) {
- db.createTable('merchants', {
+ async.series([db.bind.createTable('merchants', {
user_id: { type: 'int', primaryKey: true },
formula: { type: 'string' },
limit: { type: 'decimal' }
- }, callback);
+ }),
+ db.runSql('ALTER TABLE merchants ALTER COLUMN "limit" type decimal(10,2);')
+ ], callback);
- db.runSql('ALTER TABLE merchants ALTER COLUMN "limit" type decimal(10,2);');
};
exports.down = function(db, callback) {
diff --git a/migrations/20131110070850-add-orders.js b/migrations/20131110070850-add-orders.js
index 39b31139..b0a7d474 100644
--- a/migrations/20131110070850-add-orders.js
+++ b/migrations/20131110070850-add-orders.js
@@ -13,9 +13,9 @@ exports.up = function(db, callback) {
creation_time: { type: 'datetime' },
expiration_time: { type: 'datetime' }
}),
- db.runSql('ALTER TABLE orders ALTER COLUMN amount type decimal(10,2);', callback),
- db.runSql('ALTER TABLE orders ALTER COLUMN rate type decimal(10,2);', callback)
- ]);
+ db.runSql('ALTER TABLE orders ALTER COLUMN amount type decimal(10,2);'),
+ db.runSql('ALTER TABLE orders ALTER COLUMN rate type decimal(10,2);')
+ ], callback);
};
exports.down = function(db, callback) {
diff --git a/migrations/20131114144958-add-merchants_settlers.js b/migrations/20131114144958-add-merchants_settlers.js
new file mode 100644
index 00000000..28e8b136
--- /dev/null
+++ b/migrations/20131114144958-add-merchants_settlers.js
@@ -0,0 +1,15 @@
+var dbm = require('db-migrate');
+var type = dbm.dataType;
+
+exports.up = function(db, callback) {
+ db.createTable('merchants_settlers', {
+ merchant_id: { type: 'int' },
+ settler_id: { type: 'int' },
+ schedule: { type: 'int' },
+ method_id: { type: 'int' }
+ }, callback);
+};
+
+exports.down = function(db, callback) {
+ db.dropTable('merchants_settlers', callback);
+};