diff --git a/lib/db/migrations/reports.js b/lib/db/migrations/reports.js index e8a9f27..cfb86cb 100644 --- a/lib/db/migrations/reports.js +++ b/lib/db/migrations/reports.js @@ -15,7 +15,7 @@ exports.up = function(knex, Promise) { table.string('userId'); table.string('meta'); table.string('exception'); - table.timestamp('added'); + table.timestamp('added').defaultTo(knex.fn.now()); table.uuid('appId') .references('id') .inTable('remotedev_apps') @@ -25,7 +25,7 @@ exports.up = function(knex, Promise) { table.uuid('id').primary(); table.text('state'); table.text('action'); - table.timestamp('added'); + table.timestamp('added').defaultTo(knex.fn.now()); table.uuid('reportId') .references('id') .inTable('remotedev_reports'); @@ -35,7 +35,7 @@ exports.up = function(knex, Promise) { table.string('title'); table.string('description'); table.string('url'); - table.timestamps(); + table.timestamps(false, true); }), knex.schema.createTable('remotedev_users', function(table){ table.uuid('id').primary(); @@ -47,7 +47,7 @@ exports.up = function(knex, Promise) { table.string('oauthId'); table.string('oauthType'); table.string('token'); - table.timestamps(); + table.timestamps(false, true); }), knex.schema.createTable('remotedev_users_apps', function(table){ table.boolean('readOnly').defaultTo(false); diff --git a/lib/store.js b/lib/store.js index 1065e36..457d7e9 100644 --- a/lib/store.js +++ b/lib/store.js @@ -34,7 +34,6 @@ function add(data) { return error('Type ' + data.type + ' is not supported yet.'); } - var added = Date.now(); var reportId = uuid.v4(); var report = { id: reportId, @@ -51,15 +50,13 @@ function add(data) { user: data.user, userId: typeof data.user === 'object' ? data.user.id : data.user, meta: data.meta, - exception: data.exception, - added: added + exception: data.exception }; /* var payload = { id: uuid.v4(), reportId: reportId, - state: data.payload, - added: added + state: data.payload }; */