Commit fe044526 authored by Johannes Zellner's avatar Johannes Zellner

Stop dealing with mysql date types and the node module messing with it

parent 46b1fbdc
......@@ -118,7 +118,7 @@ function syncReleasesByProject(user, project, callback) {
assert.strictEqual(typeof project, 'object');
assert.strictEqual(typeof callback, 'function');
debug(`syncReleasesByProject: ${project.name} start sync releases. Last successful sync was at`, project.lastSuccessfulSyncAt);
debug(`syncReleasesByProject: ${project.name} start sync releases. Last successful sync was at`, new Date(project.lastSuccessfulSyncAt));
github.getReleases(user.githubToken, project, function (error, result) {
if (error) return callback(error);
......@@ -140,7 +140,7 @@ function syncReleasesByProject(user, project, callback) {
// before initial successful sync and if notifications for this project are enabled, we mark the release as not notified yet
release.notified = !project.lastSuccessfulSyncAt ? true : !project.enabled;
release.createdAt = new Date(commit.committer.date);
release.createdAt = new Date(commit.committer.date).getTime();
delete release.sha;
......@@ -154,7 +154,7 @@ function syncReleasesByProject(user, project, callback) {
debug(`syncReleasesByProject: ${project.name} successfully synced`);
// set the last successful sync time
database.projects.update(project.id, { lastSuccessfulSyncAt: new Date() }, callback);
database.projects.update(project.id, { lastSuccessfulSyncAt: Date.now() }, callback);
});
});
});
......
......@@ -9,7 +9,7 @@ CREATE TABLE IF NOT EXISTS projects(
userId VARCHAR(128) NOT NULL,
name VARCHAR(512) NOT NULL,
enabled BOOLEAN DEFAULT true,
lastSuccessfulSyncAt TIMESTAMP,
lastSuccessfulSyncAt BIGINT DEFAULT 0,
FOREIGN KEY(userId) REFERENCES users(id),
PRIMARY KEY(id));
......@@ -18,6 +18,6 @@ CREATE TABLE IF NOT EXISTS releases(
projectId VARCHAR(128) NOT NULL,
version VARCHAR(512) NOT NULL,
notified BOOLEAN DEFAULT false,
createdAt TIMESTAMP NOT NULL,
createdAt BIGINT NOT NULL,
FOREIGN KEY(projectId) REFERENCES projects(id),
PRIMARY KEY(id));
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment