DEV: fix Flarum import script (#13385)

This commit is contained in:
Arpit Jalan 2021-06-15 19:08:55 +05:30 committed by GitHub
parent fa57316a4e
commit 365d339985
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -39,7 +39,7 @@ class ImportScripts::FLARUM < ImportScripts::Base
batches(BATCH_SIZE) do |offset| batches(BATCH_SIZE) do |offset|
results = mysql_query( results = mysql_query(
"SELECT id, username, email, join_time created_at,last_seen_time last_visit_time, password "SELECT id, username, email, joined_at, last_seen_at
FROM users FROM users
LIMIT #{BATCH_SIZE} LIMIT #{BATCH_SIZE}
OFFSET #{offset};") OFFSET #{offset};")
@ -53,9 +53,9 @@ class ImportScripts::FLARUM < ImportScripts::Base
email: user['email'], email: user['email'],
username: user['username'], username: user['username'],
name: user['username'], name: user['username'],
created_at: user['created_at'], created_at: user['joined_at'],
last_seen_at: user['last_visit_time'], last_seen_at: user['last_seen_at']
password: user['password'] } }
end end
end end
end end
@ -106,13 +106,13 @@ class ImportScripts::FLARUM < ImportScripts::Base
d.first_post_id first_post_id, d.first_post_id first_post_id,
p.user_id user_id, p.user_id user_id,
p.content raw, p.content raw,
p.created_at created_at p.created_at created_at,
t.tag_id category_id, t.tag_id category_id
FROM posts p, FROM posts p,
discussions d, discussions d,
discussion_tag t, discussion_tag t
WHERE p.discussion_id = d.id WHERE p.discussion_id = d.id
AND t.discussion_id = d.id
ORDER BY p.created_at ORDER BY p.created_at
LIMIT #{BATCH_SIZE} LIMIT #{BATCH_SIZE}
OFFSET #{offset}; OFFSET #{offset};