-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP Migrate data from existing freedit instance #10
base: main
Are you sure you want to change the base?
Conversation
a0f3e59
to
c288ecf
Compare
i_u.username, i_u.uid, uid | ||
); | ||
} else { | ||
let uid = incr_id(db, "users_count")?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that most (all?) ids for entries are done via incrementing id. When merging in data from another instance, these ids must be remapped to a higher id. The new id then must be used in other references to the old id in the incoming data.
let num_incoming_inns = get_count(&m_db, "default", "inns_count")?; | ||
info!("processing {0} incoming Inns", num_incoming_inns); | ||
|
||
// TODO If only one inn, just use that (aka merge posts in) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe there is only one inn on each of the freedit instances/data we are targeting. Can likely just use the current inn and ignore the incoming one from the migration.
let num_incoming_inns = get_count(&m_db, "default", "inns_count")?; | ||
info!("processing {0} incoming Inns", num_incoming_inns); | ||
|
||
let num_current_inns = get_count(&db, "default", "inns_count")?; |
Check warning
Code scanning / clippy
this expression creates a reference which is immediately dereferenced by the compiler Warning
let num_incoming_inns = get_count(&m_db, "default", "inns_count")?; | ||
info!("processing {0} incoming Inns", num_incoming_inns); | ||
|
||
let num_current_inns = get_count(&db, "default", "inns_count")?; |
Check warning
Code scanning / clippy
this expression creates a reference which is immediately dereferenced by the compiler Warning
); | ||
return Err(AppError::Custom(msg)); | ||
} | ||
let uid = uid_opt.unwrap().clone(); |
Check warning
Code scanning / clippy
using clone on type u32 which implements the Copy trait Warning
); | ||
return Err(AppError::Custom(msg)); | ||
} | ||
let uid = uid_opt.unwrap().clone(); |
Check warning
Code scanning / clippy
using clone on type u32 which implements the Copy trait Warning
info!("creating post. pid {0}, incoming pid {1}", pid, i_p.pid); | ||
|
||
let new_post = Post { | ||
pid: pid, |
Check warning
Code scanning / clippy
redundant field names in struct initialization Warning
|
||
let new_post = Post { | ||
pid: pid, | ||
uid: uid, |
Check warning
Code scanning / clippy
redundant field names in struct initialization Warning
let new_post = Post { | ||
pid: pid, | ||
uid: uid, | ||
iid: iid, |
Check warning
Code scanning / clippy
redundant field names in struct initialization Warning
let new_post = Post { | ||
pid: pid, | ||
uid: uid, | ||
iid: iid, |
Check warning
Code scanning / clippy
redundant field names in struct initialization Warning
title: i_p.title.clone(), | ||
tags: i_p.tags.clone(), | ||
content: i_p.content.clone(), | ||
created_at: i_p.created_at.clone(), |
Check warning
Code scanning / clippy
using clone on type i64 which implements the Copy trait Warning
title: i_p.title.clone(), | ||
tags: i_p.tags.clone(), | ||
content: i_p.content.clone(), | ||
created_at: i_p.created_at.clone(), |
Check warning
Code scanning / clippy
using clone on type i64 which implements the Copy trait Warning
Implementation / Review resources
TODO
Resolves #1