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:
parent
0734115264
commit
ed2a686f5d
|
@ -0,0 +1 @@
|
|||
db.back.sql
|
|
@ -13,3 +13,9 @@ CREATE TABLE IF NOT EXISTS Users (
|
|||
, name TEXT UNIQUE 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;
|
||||
|
|
|
@ -3,7 +3,9 @@ json = require "dkjson"
|
|||
socket = require "socket"
|
||||
sqlite3 = require "lsqlite3"
|
||||
|
||||
authors = {}
|
||||
authors = {
|
||||
["e4edb497-3f6f-4a7e-8ad4-0272ab8d3a47"]: true
|
||||
}
|
||||
|
||||
db = assert sqlite3.open "../db/posts.db"
|
||||
|
||||
|
|
|
@ -17,6 +17,9 @@ for page=1,8002
|
|||
|
||||
for _, post in pairs posts.topics
|
||||
continue unless post
|
||||
|
||||
post.author = "e4edb497-3f6f-4a7e-8ad4-0272ab8d3a47" unless post.author
|
||||
|
||||
do
|
||||
insert_stmt\bind_values post.id, post.body, post.author, page
|
||||
insert_stmt\step!
|
||||
|
|
Loading…
Reference in New Issue