diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2015-10-30 19:45:22 +0100 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2015-10-30 19:45:22 +0100 |
commit | ecb664a8550ee787a593db6cf45907100a875a54 (patch) | |
tree | dc241c9941df27715f721ef12bd40a7648f09f37 /migrations | |
parent | 5e634d62d599c60a34f405e26ef0c3037e9a37a3 (diff) | |
download | diller-server-ecb664a8550ee787a593db6cf45907100a875a54.tar.gz diller-server-ecb664a8550ee787a593db6cf45907100a875a54.tar.bz2 diller-server-ecb664a8550ee787a593db6cf45907100a875a54.tar.xz diller-server-ecb664a8550ee787a593db6cf45907100a875a54.zip |
o Splitting the value field into value_numeric and value_text.
Diffstat (limited to 'migrations')
-rw-r--r-- | migrations/20151030181628-types-values.js | 30 | ||||
-rw-r--r-- | migrations/sqls/20151030181628-types-values-down.sql | 1 | ||||
-rw-r--r-- | migrations/sqls/20151030181628-types-values-up.sql | 5 |
3 files changed, 36 insertions, 0 deletions
diff --git a/migrations/20151030181628-types-values.js b/migrations/20151030181628-types-values.js new file mode 100644 index 0000000..2adec04 --- /dev/null +++ b/migrations/20151030181628-types-values.js @@ -0,0 +1,30 @@ +var dbm = global.dbm || require('db-migrate'); +var type = dbm.dataType; +var fs = require('fs'); +var path = require('path'); + +exports.up = function(db, callback) { + var filePath = path.join(__dirname + '/sqls/20151030181628-types-values-up.sql'); + fs.readFile(filePath, {encoding: 'utf-8'}, function(err,data){ + if (err) return callback(err); + console.log('received data: ' + data); + + db.runSql(data, function(err) { + if (err) return callback(err); + callback(); + }); + }); +}; + +exports.down = function(db, callback) { + var filePath = path.join(__dirname + '/sqls/20151030181628-types-values-down.sql'); + fs.readFile(filePath, {encoding: 'utf-8'}, function(err,data){ + if (err) return callback(err); + console.log('received data: ' + data); + + db.runSql(data, function(err) { + if (err) return callback(err); + callback(); + }); + }); +}; diff --git a/migrations/sqls/20151030181628-types-values-down.sql b/migrations/sqls/20151030181628-types-values-down.sql new file mode 100644 index 0000000..44f074e --- /dev/null +++ b/migrations/sqls/20151030181628-types-values-down.sql @@ -0,0 +1 @@ +/* Replace with your SQL commands */
\ No newline at end of file diff --git a/migrations/sqls/20151030181628-types-values-up.sql b/migrations/sqls/20151030181628-types-values-up.sql new file mode 100644 index 0000000..e0b5e61 --- /dev/null +++ b/migrations/sqls/20151030181628-types-values-up.sql @@ -0,0 +1,5 @@ +ALTER TABLE value +ADD COLUMN value_numeric NUMERIC; + +ALTER TABLE value +RENAME COLUMN value TO value_text; |