From 0b535ef17cb76193b7d67af170b7bc3a9cfb29e6 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Sat, 9 Nov 2013 21:09:46 -0800 Subject: Create users table with db-migrate --- .gitignore | 1 + database.json.sample | 9 +++++++++ migrations/20131110050923-add-users.js | 26 ++++++++++++++++++++++++++ 3 files changed, 36 insertions(+) create mode 100644 database.json.sample create mode 100644 migrations/20131110050923-add-users.js diff --git a/.gitignore b/.gitignore index f8756461..10c71482 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ public/bitcoins.pdf node_modules config.js builtAssets +database.json diff --git a/database.json.sample b/database.json.sample new file mode 100644 index 00000000..688560dd --- /dev/null +++ b/database.json.sample @@ -0,0 +1,9 @@ +{ + "dev": { + "driver": "pg", + "user": "you", + "password": "password", + "host": "localhost", + "database": "pos" + } +} diff --git a/migrations/20131110050923-add-users.js b/migrations/20131110050923-add-users.js new file mode 100644 index 00000000..47911db8 --- /dev/null +++ b/migrations/20131110050923-add-users.js @@ -0,0 +1,26 @@ +var dbm = require('db-migrate'); +var type = dbm.dataType; + +exports.up = function(db, callback) { + db.createTable('users', { + id: { type: 'int', primaryKey: true }, + username: { type: 'string' }, + password: { type: 'string' }, + first_name: { type: 'string' }, + last_name: { type: 'string' }, + email: { type: 'string' }, + phone: { type: 'string' }, + company: { type: 'string' }, + category: { type: 'string' }, + website: { type: 'string' }, + location: { type: 'string' }, + city: { type: 'string' }, + postal_code: { type: 'string' }, + province: { type: 'string' }, + country: { type: 'string' } + }, callback); +}; + +exports.down = function(db, callback) { + db.dropTable('users', callback); +}; -- cgit v1.2.3