Use the current timestamps

This commit is contained in:
Zalmoxisus 2016-11-09 20:12:28 +02:00
parent 45482098d7
commit 8419e7e090
2 changed files with 6 additions and 9 deletions

View File

@ -15,7 +15,7 @@ exports.up = function(knex, Promise) {
table.string('userId'); table.string('userId');
table.string('meta'); table.string('meta');
table.string('exception'); table.string('exception');
table.timestamp('added'); table.timestamp('added').defaultTo(knex.fn.now());
table.uuid('appId') table.uuid('appId')
.references('id') .references('id')
.inTable('remotedev_apps') .inTable('remotedev_apps')
@ -25,7 +25,7 @@ exports.up = function(knex, Promise) {
table.uuid('id').primary(); table.uuid('id').primary();
table.text('state'); table.text('state');
table.text('action'); table.text('action');
table.timestamp('added'); table.timestamp('added').defaultTo(knex.fn.now());
table.uuid('reportId') table.uuid('reportId')
.references('id') .references('id')
.inTable('remotedev_reports'); .inTable('remotedev_reports');
@ -35,7 +35,7 @@ exports.up = function(knex, Promise) {
table.string('title'); table.string('title');
table.string('description'); table.string('description');
table.string('url'); table.string('url');
table.timestamps(); table.timestamps(false, true);
}), }),
knex.schema.createTable('remotedev_users', function(table){ knex.schema.createTable('remotedev_users', function(table){
table.uuid('id').primary(); table.uuid('id').primary();
@ -47,7 +47,7 @@ exports.up = function(knex, Promise) {
table.string('oauthId'); table.string('oauthId');
table.string('oauthType'); table.string('oauthType');
table.string('token'); table.string('token');
table.timestamps(); table.timestamps(false, true);
}), }),
knex.schema.createTable('remotedev_users_apps', function(table){ knex.schema.createTable('remotedev_users_apps', function(table){
table.boolean('readOnly').defaultTo(false); table.boolean('readOnly').defaultTo(false);

View File

@ -34,7 +34,6 @@ function add(data) {
return error('Type ' + data.type + ' is not supported yet.'); return error('Type ' + data.type + ' is not supported yet.');
} }
var added = Date.now();
var reportId = uuid.v4(); var reportId = uuid.v4();
var report = { var report = {
id: reportId, id: reportId,
@ -51,15 +50,13 @@ function add(data) {
user: data.user, user: data.user,
userId: typeof data.user === 'object' ? data.user.id : data.user, userId: typeof data.user === 'object' ? data.user.id : data.user,
meta: data.meta, meta: data.meta,
exception: data.exception, exception: data.exception
added: added
}; };
/* /*
var payload = { var payload = {
id: uuid.v4(), id: uuid.v4(),
reportId: reportId, reportId: reportId,
state: data.payload, state: data.payload
added: added
}; };
*/ */