Skip to content

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

Closed
wants to merge 8 commits into from

Conversation

jacque006
Copy link
Contributor

@jacque006 jacque006 commented Dec 17, 2024

Implementation / Review resources

TODO

  • Users
  • Inns - Just use existing inns on each instance if only 1
  • Inn role?
  • Posts
  • [ ] Solos N/A
  • Comments
  • [ ] Static/uploaded assets? N/A, not detected in migration data or already in PSE instance
  • Test/simulate with prod data
  • Migrate data from talk.zketh.io

Resolves #1

@jacque006 jacque006 force-pushed the jacque006/data-migration branch from a0f3e59 to c288ecf Compare December 18, 2024 05:37
i_u.username, i_u.uid, uid
);
} else {
let uid = incr_id(db, "users_count")?;
Copy link
Contributor Author

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.

Comment on lines 95 to 98
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)
Copy link
Contributor Author

@jacque006 jacque006 Dec 18, 2024

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

this expression creates a reference which is immediately dereferenced by the compiler
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

this expression creates a reference which is immediately dereferenced by the compiler
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

redundant field names in struct initialization

let new_post = Post {
pid: pid,
uid: uid,

Check warning

Code scanning / clippy

redundant field names in struct initialization Warning

redundant field names in struct initialization
let new_post = Post {
pid: pid,
uid: uid,
iid: iid,

Check warning

Code scanning / clippy

redundant field names in struct initialization Warning

redundant field names in struct initialization
let new_post = Post {
pid: pid,
uid: uid,
iid: iid,

Check warning

Code scanning / clippy

redundant field names in struct initialization Warning

redundant field names in struct initialization
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

using clone on type i64 which implements the Copy trait
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

using clone on type i64 which implements the Copy trait
);
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

using clone on type u32 which implements the Copy trait
);
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

using clone on type u32 which implements the Copy trait
info!("creating comment. cid {0}", cid);

let new_comment = Comment {
cid: cid,

Check warning

Code scanning / clippy

redundant field names in struct initialization Warning

redundant field names in struct initialization
info!("creating comment. cid {0}", cid);

let new_comment = Comment {
cid: cid,

Check warning

Code scanning / clippy

redundant field names in struct initialization Warning

redundant field names in struct initialization

let new_comment = Comment {
cid: cid,
pid: pid, // Use new pid

Check warning

Code scanning / clippy

redundant field names in struct initialization Warning

redundant field names in struct initialization

let new_comment = Comment {
cid: cid,
pid: pid, // Use new pid

Check warning

Code scanning / clippy

redundant field names in struct initialization Warning

redundant field names in struct initialization
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

redundant field names in struct initialization
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

redundant field names in struct initialization
@jacque006 jacque006 force-pushed the jacque006/data-migration branch from 3a150f7 to 8023bdf Compare January 16, 2025 01:31
// 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

unneeded late initialization
// 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

unneeded late initialization
@@ -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

an implementation of From is preferred since it gives you Into<_> for free where the reverse isn't true
@@ -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

an implementation of From is preferred since it gives you Into<_> for free where the reverse isn't true
@sripwoud sripwoud force-pushed the main branch 9 times, most recently from df5e71b to 4f8b1fe Compare January 27, 2025 15:27
@sripwoud sripwoud force-pushed the main branch 5 times, most recently from 9b416df to ccfe741 Compare January 31, 2025 13:11
@sripwoud sripwoud force-pushed the main branch 4 times, most recently from d3c9a61 to af19675 Compare January 31, 2025 13:15
@jacque006 jacque006 closed this Feb 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Migrate data from https://talk.zketh.io
1 participant