-
Notifications
You must be signed in to change notification settings - Fork 0
WIP Migrate data from existing freedit instance #10
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
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
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
); | ||
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 comment. cid {0}", cid); | ||
|
||
let new_comment = Comment { | ||
cid: cid, |
Check warning
Code scanning / clippy
redundant field names in struct initialization Warning
info!("creating comment. cid {0}", cid); | ||
|
||
let new_comment = Comment { | ||
cid: cid, |
Check warning
Code scanning / clippy
redundant field names in struct initialization Warning
|
||
let new_comment = Comment { | ||
cid: cid, | ||
pid: pid, // Use new pid |
Check warning
Code scanning / clippy
redundant field names in struct initialization Warning
|
||
let new_comment = Comment { | ||
cid: cid, | ||
pid: pid, // Use new pid |
Check warning
Code scanning / clippy
redundant field names in struct initialization Warning
let new_comment = Comment { | ||
cid: cid, | ||
pid: pid, // Use new pid | ||
uid: uid, |
Check warning
Code scanning / clippy
redundant field names in struct initialization Warning
let new_comment = Comment { | ||
cid: cid, | ||
pid: pid, // Use new pid | ||
uid: uid, |
Check warning
Code scanning / clippy
redundant field names in struct initialization Warning
3a150f7
to
8023bdf
Compare
// Migrate InnRole // | ||
///////////////////// | ||
let incoming_inn_role = InnRole::get(&m_db, iid, uid)?; | ||
let inn_role: InnRole; |
Check warning
Code scanning / clippy
unneeded late initialization Warning
// Migrate InnRole // | ||
///////////////////// | ||
let incoming_inn_role = InnRole::get(&m_db, iid, uid)?; | ||
let inn_role: InnRole; |
Check warning
Code scanning / clippy
unneeded late initialization Warning
apps/server/src/controller/user.rs
Outdated
@@ -275,6 +275,20 @@ | |||
} | |||
} | |||
|
|||
impl Into<u8> for InnRole { |
Check warning
Code scanning / clippy
an implementation of From is preferred since it gives you Into<_> for free where the reverse isn't true Warning
apps/server/src/controller/user.rs
Outdated
@@ -275,6 +275,20 @@ | |||
} | |||
} | |||
|
|||
impl Into<u8> for InnRole { |
Check warning
Code scanning / clippy
an implementation of From is preferred since it gives you Into<_> for free where the reverse isn't true Warning
…rums into jacque006/data-migration
df5e71b
to
4f8b1fe
Compare
…rums into jacque006/data-migration
9b416df
to
ccfe741
Compare
d3c9a61
to
af19675
Compare
Implementation / Review resources
TODO
[ ] SolosN/A[ ] Static/uploaded assets?N/A, not detected in migration data or already in PSE instanceResolves #1