Loading comments/database.sql +2 −2 Original line number Diff line number Diff line Loading @@ -5,7 +5,7 @@ CREATE TABLE comments ( content TEXT NOT NULL, content_html TEXT NOT NULL, created_at DATETIME NOT NULL, deleted ENUM('Y', 'N') NOT NULL DEFAULT 'N', deleted BOOLEAN NOT NULL DEFAULT 0, FOREIGN KEY (user_id) REFERENCES users (id), FOREIGN KEY (target_id) REFERENCES targets (id) ); Loading @@ -15,7 +15,7 @@ CREATE TABLE users ( username VARCHAR(255) NOT NULL, external_id INT NOT NULL, -- (link to Sencha Forum database) email VARCHAR(255) NOT NULL, -- (from subscriptions) moderator ENUM('Y', 'N') NOT NULL DEFAULT 'N' moderator BOOLEAN NOT NULL DEFAULT 0 ); CREATE TABLE targets ( Loading comments/extract.js +11 −2 Original line number Diff line number Diff line Loading @@ -293,7 +293,7 @@ var CommentsTable = (function() { content: c.content, content_html: c.contentHtml, created_at: c.createdAt, deleted: c.deleted deleted: !!c.deleted }; }); return map; Loading Loading @@ -454,13 +454,22 @@ function asyncPrint(msg) { function printInserts(table) { return function(data, next) { data[table].forEach(function(row) { data[table].map(fixBooleans).forEach(function(row) { console.log(db.format("INSERT INTO "+table+" SET ?;", row)); }); next(); }; } // turn true and false into 0 and 1 for MySQL insertion function fixBooleans(row) { for (var i in row) { if (row[i] === true || row[i] === false) { row[i] = row[i] ? 1 : 0; } } return row; } sequence({}, [ Loading Loading
comments/database.sql +2 −2 Original line number Diff line number Diff line Loading @@ -5,7 +5,7 @@ CREATE TABLE comments ( content TEXT NOT NULL, content_html TEXT NOT NULL, created_at DATETIME NOT NULL, deleted ENUM('Y', 'N') NOT NULL DEFAULT 'N', deleted BOOLEAN NOT NULL DEFAULT 0, FOREIGN KEY (user_id) REFERENCES users (id), FOREIGN KEY (target_id) REFERENCES targets (id) ); Loading @@ -15,7 +15,7 @@ CREATE TABLE users ( username VARCHAR(255) NOT NULL, external_id INT NOT NULL, -- (link to Sencha Forum database) email VARCHAR(255) NOT NULL, -- (from subscriptions) moderator ENUM('Y', 'N') NOT NULL DEFAULT 'N' moderator BOOLEAN NOT NULL DEFAULT 0 ); CREATE TABLE targets ( Loading
comments/extract.js +11 −2 Original line number Diff line number Diff line Loading @@ -293,7 +293,7 @@ var CommentsTable = (function() { content: c.content, content_html: c.contentHtml, created_at: c.createdAt, deleted: c.deleted deleted: !!c.deleted }; }); return map; Loading Loading @@ -454,13 +454,22 @@ function asyncPrint(msg) { function printInserts(table) { return function(data, next) { data[table].forEach(function(row) { data[table].map(fixBooleans).forEach(function(row) { console.log(db.format("INSERT INTO "+table+" SET ?;", row)); }); next(); }; } // turn true and false into 0 and 1 for MySQL insertion function fixBooleans(row) { for (var i in row) { if (row[i] === true || row[i] === false) { row[i] = row[i] ? 1 : 0; } } return row; } sequence({}, [ Loading