Script refinement

Add an implicit "anonymous" poster with the OID
e4edb497-3f6f-4a7e-8ad4-0272ab8d3a47.

This OID is not normally valid and is a type-4 UUID generated from
uuidgen(1).
This commit is contained in:
Christine Dodrill 2015-07-28 17:45:40 -07:00
parent 0734115264
commit ed2a686f5d
4 changed files with 13 additions and 1 deletions

1
db/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
db.back.sql

View File

@ -13,3 +13,9 @@ CREATE TABLE IF NOT EXISTS Users (
, name TEXT UNIQUE NOT NULL , name TEXT UNIQUE NOT NULL
, avatar_url TEXT NOT NULL , avatar_url TEXT NOT NULL
); );
BEGIN TRANSACTION;
INSERT INTO Users VALUES(NULL, "e4edb497-3f6f-4a7e-8ad4-0272ab8d3a47", "Background Pony", '//derpicdn.net/assets/no_avatar_125x125-2c4e2d8e68cb13a208dae3c6d6877b45c5390dd367920d927c80dde1665bc0ed.png');
COMMIT;

View File

@ -3,7 +3,9 @@ json = require "dkjson"
socket = require "socket" socket = require "socket"
sqlite3 = require "lsqlite3" sqlite3 = require "lsqlite3"
authors = {} authors = {
["e4edb497-3f6f-4a7e-8ad4-0272ab8d3a47"]: true
}
db = assert sqlite3.open "../db/posts.db" db = assert sqlite3.open "../db/posts.db"

View File

@ -17,6 +17,9 @@ for page=1,8002
for _, post in pairs posts.topics for _, post in pairs posts.topics
continue unless post continue unless post
post.author = "e4edb497-3f6f-4a7e-8ad4-0272ab8d3a47" unless post.author
do do
insert_stmt\bind_values post.id, post.body, post.author, page insert_stmt\bind_values post.id, post.body, post.author, page
insert_stmt\step! insert_stmt\step!