Loading comments/lib/comments.js +3 −8 Original line number Diff line number Diff line Loading @@ -223,8 +223,7 @@ Comments.prototype = { target_id: target_id, user_id: comment.user_id, content: comment.content, content_html: Formatter.format(comment.content), created_at: new Date() content_html: Formatter.format(comment.content) }, callback); }.bind(this)); }, Loading Loading @@ -253,8 +252,7 @@ Comments.prototype = { this.db.insert("updates", { comment_id: comment.id, user_id: comment.user_id, action: 'update', created_at: new Date() action: 'update' }, callback); }.bind(this)); }, Loading Loading @@ -282,8 +280,7 @@ Comments.prototype = { this.db.insert("updates", { comment_id: action.id, user_id: action.user_id, action: action.deleted ? 'delete' : 'undo_delete', created_at: new Date() action: action.deleted ? 'delete' : 'undo_delete' }, callback); }.bind(this)); }, Loading Loading @@ -315,7 +312,6 @@ Comments.prototype = { }, castVote: function(vote, callback) { vote.created_at = new Date(); this.db.insert("votes", vote, function(err, vote_id) { if (err) { // vote already exists, retrieve it Loading Loading @@ -354,7 +350,6 @@ Comments.prototype = { * @param {Error} callback.err */ markRead: function(read, callback) { read.created_at = new Date(); this.db.insert("readings", read, function(err) { if (err && err.code === "ER_DUP_ENTRY") { callback(); Loading comments/lib/subscriptions.js +1 −2 Original line number Diff line number Diff line Loading @@ -68,8 +68,7 @@ Subscriptions.prototype = { this.targets.ensure(subscription.target, function(err, target_id) { this.db.insert("subscriptions", { user_id: subscription.user_id, target_id: target_id, created_at: new Date() target_id: target_id }, callback); }.bind(this)); }.bind(this)); Loading comments/sql/schema.sql +5 −5 Original line number Diff line number Diff line Loading @@ -23,7 +23,7 @@ CREATE TABLE comments ( content TEXT NOT NULL, content_html TEXT NOT NULL, vote INT NOT NULL DEFAULT 0, created_at DATETIME NOT NULL, created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, deleted BOOLEAN NOT NULL DEFAULT 0, FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE CASCADE, FOREIGN KEY (target_id) REFERENCES targets (id) ON DELETE CASCADE Loading @@ -34,7 +34,7 @@ CREATE TABLE votes ( user_id INT NOT NULL, comment_id INT NOT NULL, value INT NOT NULL, -- +1 or -1 created_at DATETIME NOT NULL, created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE CASCADE, FOREIGN KEY (comment_id) REFERENCES comments (id) ON DELETE CASCADE, -- can't vote twice on the same comment Loading @@ -46,7 +46,7 @@ CREATE TABLE updates ( user_id INT NOT NULL, comment_id INT NOT NULL, action ENUM('update', 'delete') DEFAULT 'update', created_at DATETIME NOT NULL, created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE CASCADE, FOREIGN KEY (comment_id) REFERENCES comments (id) ON DELETE CASCADE ) ENGINE = InnoDB, CHARACTER SET = utf8; Loading @@ -55,7 +55,7 @@ CREATE TABLE subscriptions ( id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, user_id INT NOT NULL, target_id INT NOT NULL, created_at DATETIME NOT NULL, created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE CASCADE, FOREIGN KEY (target_id) REFERENCES targets (id) ON DELETE CASCADE, -- can't subscribe twice to the same thread Loading @@ -66,7 +66,7 @@ CREATE TABLE readings ( id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, user_id INT NOT NULL, comment_id INT NOT NULL, created_at DATETIME NOT NULL, created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE CASCADE, FOREIGN KEY (comment_id) REFERENCES comments (id) ON DELETE CASCADE, -- can't read the same comment twice Loading Loading
comments/lib/comments.js +3 −8 Original line number Diff line number Diff line Loading @@ -223,8 +223,7 @@ Comments.prototype = { target_id: target_id, user_id: comment.user_id, content: comment.content, content_html: Formatter.format(comment.content), created_at: new Date() content_html: Formatter.format(comment.content) }, callback); }.bind(this)); }, Loading Loading @@ -253,8 +252,7 @@ Comments.prototype = { this.db.insert("updates", { comment_id: comment.id, user_id: comment.user_id, action: 'update', created_at: new Date() action: 'update' }, callback); }.bind(this)); }, Loading Loading @@ -282,8 +280,7 @@ Comments.prototype = { this.db.insert("updates", { comment_id: action.id, user_id: action.user_id, action: action.deleted ? 'delete' : 'undo_delete', created_at: new Date() action: action.deleted ? 'delete' : 'undo_delete' }, callback); }.bind(this)); }, Loading Loading @@ -315,7 +312,6 @@ Comments.prototype = { }, castVote: function(vote, callback) { vote.created_at = new Date(); this.db.insert("votes", vote, function(err, vote_id) { if (err) { // vote already exists, retrieve it Loading Loading @@ -354,7 +350,6 @@ Comments.prototype = { * @param {Error} callback.err */ markRead: function(read, callback) { read.created_at = new Date(); this.db.insert("readings", read, function(err) { if (err && err.code === "ER_DUP_ENTRY") { callback(); Loading
comments/lib/subscriptions.js +1 −2 Original line number Diff line number Diff line Loading @@ -68,8 +68,7 @@ Subscriptions.prototype = { this.targets.ensure(subscription.target, function(err, target_id) { this.db.insert("subscriptions", { user_id: subscription.user_id, target_id: target_id, created_at: new Date() target_id: target_id }, callback); }.bind(this)); }.bind(this)); Loading
comments/sql/schema.sql +5 −5 Original line number Diff line number Diff line Loading @@ -23,7 +23,7 @@ CREATE TABLE comments ( content TEXT NOT NULL, content_html TEXT NOT NULL, vote INT NOT NULL DEFAULT 0, created_at DATETIME NOT NULL, created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, deleted BOOLEAN NOT NULL DEFAULT 0, FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE CASCADE, FOREIGN KEY (target_id) REFERENCES targets (id) ON DELETE CASCADE Loading @@ -34,7 +34,7 @@ CREATE TABLE votes ( user_id INT NOT NULL, comment_id INT NOT NULL, value INT NOT NULL, -- +1 or -1 created_at DATETIME NOT NULL, created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE CASCADE, FOREIGN KEY (comment_id) REFERENCES comments (id) ON DELETE CASCADE, -- can't vote twice on the same comment Loading @@ -46,7 +46,7 @@ CREATE TABLE updates ( user_id INT NOT NULL, comment_id INT NOT NULL, action ENUM('update', 'delete') DEFAULT 'update', created_at DATETIME NOT NULL, created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE CASCADE, FOREIGN KEY (comment_id) REFERENCES comments (id) ON DELETE CASCADE ) ENGINE = InnoDB, CHARACTER SET = utf8; Loading @@ -55,7 +55,7 @@ CREATE TABLE subscriptions ( id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, user_id INT NOT NULL, target_id INT NOT NULL, created_at DATETIME NOT NULL, created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE CASCADE, FOREIGN KEY (target_id) REFERENCES targets (id) ON DELETE CASCADE, -- can't subscribe twice to the same thread Loading @@ -66,7 +66,7 @@ CREATE TABLE readings ( id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, user_id INT NOT NULL, comment_id INT NOT NULL, created_at DATETIME NOT NULL, created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE CASCADE, FOREIGN KEY (comment_id) REFERENCES comments (id) ON DELETE CASCADE, -- can't read the same comment twice Loading