Skip to content

Commit

Permalink
chore: ignore invalid database when import appflowy data
Browse files Browse the repository at this point in the history
  • Loading branch information
appflowy committed Oct 29, 2024
1 parent 9707148 commit 01a94fd
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 50 deletions.
16 changes: 8 additions & 8 deletions frontend/appflowy_tauri/src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions frontend/appflowy_tauri/src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,14 @@ custom-protocol = ["tauri/custom-protocol"]
# To switch to the local path, run:
# scripts/tool/update_collab_source.sh
# ⚠️⚠️⚠️️
collab = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a302e9aaa3a86b7c2fe63992c312959feaf80bc0" }
collab-entity = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a302e9aaa3a86b7c2fe63992c312959feaf80bc0" }
collab-folder = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a302e9aaa3a86b7c2fe63992c312959feaf80bc0" }
collab-document = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a302e9aaa3a86b7c2fe63992c312959feaf80bc0" }
collab-database = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a302e9aaa3a86b7c2fe63992c312959feaf80bc0" }
collab-plugins = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a302e9aaa3a86b7c2fe63992c312959feaf80bc0" }
collab-user = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a302e9aaa3a86b7c2fe63992c312959feaf80bc0" }
collab-importer = { version = "0.1", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a302e9aaa3a86b7c2fe63992c312959feaf80bc0" }
collab = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "ae51ebef5cfc9805d58e89adca2cff9ea6e0b730" }
collab-entity = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "ae51ebef5cfc9805d58e89adca2cff9ea6e0b730" }
collab-folder = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "ae51ebef5cfc9805d58e89adca2cff9ea6e0b730" }
collab-document = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "ae51ebef5cfc9805d58e89adca2cff9ea6e0b730" }
collab-database = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "ae51ebef5cfc9805d58e89adca2cff9ea6e0b730" }
collab-plugins = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "ae51ebef5cfc9805d58e89adca2cff9ea6e0b730" }
collab-user = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "ae51ebef5cfc9805d58e89adca2cff9ea6e0b730" }
collab-importer = { version = "0.1", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "ae51ebef5cfc9805d58e89adca2cff9ea6e0b730" }

# Working directory: frontend
# To update the commit ID, run:
Expand Down
16 changes: 8 additions & 8 deletions frontend/appflowy_web_app/src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions frontend/appflowy_web_app/src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,14 @@ custom-protocol = ["tauri/custom-protocol"]
# To switch to the local path, run:
# scripts/tool/update_collab_source.sh
# ⚠️⚠️⚠️️
collab = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a302e9aaa3a86b7c2fe63992c312959feaf80bc0" }
collab-entity = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a302e9aaa3a86b7c2fe63992c312959feaf80bc0" }
collab-folder = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a302e9aaa3a86b7c2fe63992c312959feaf80bc0" }
collab-document = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a302e9aaa3a86b7c2fe63992c312959feaf80bc0" }
collab-database = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a302e9aaa3a86b7c2fe63992c312959feaf80bc0" }
collab-plugins = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a302e9aaa3a86b7c2fe63992c312959feaf80bc0" }
collab-user = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a302e9aaa3a86b7c2fe63992c312959feaf80bc0" }
collab-importer = { version = "0.1", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a302e9aaa3a86b7c2fe63992c312959feaf80bc0" }
collab = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "ae51ebef5cfc9805d58e89adca2cff9ea6e0b730" }
collab-entity = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "ae51ebef5cfc9805d58e89adca2cff9ea6e0b730" }
collab-folder = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "ae51ebef5cfc9805d58e89adca2cff9ea6e0b730" }
collab-document = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "ae51ebef5cfc9805d58e89adca2cff9ea6e0b730" }
collab-database = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "ae51ebef5cfc9805d58e89adca2cff9ea6e0b730" }
collab-plugins = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "ae51ebef5cfc9805d58e89adca2cff9ea6e0b730" }
collab-user = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "ae51ebef5cfc9805d58e89adca2cff9ea6e0b730" }
collab-importer = { version = "0.1", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "ae51ebef5cfc9805d58e89adca2cff9ea6e0b730" }


# Working directory: frontend
Expand Down
16 changes: 8 additions & 8 deletions frontend/rust-lib/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions frontend/rust-lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -142,14 +142,14 @@ rocksdb = { git = "https://github.com/rust-rocksdb/rust-rocksdb", rev = "1710120
# To switch to the local path, run:
# scripts/tool/update_collab_source.sh
# ⚠️⚠️⚠️️
collab = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a302e9aaa3a86b7c2fe63992c312959feaf80bc0" }
collab-entity = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a302e9aaa3a86b7c2fe63992c312959feaf80bc0" }
collab-folder = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a302e9aaa3a86b7c2fe63992c312959feaf80bc0" }
collab-document = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a302e9aaa3a86b7c2fe63992c312959feaf80bc0" }
collab-database = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a302e9aaa3a86b7c2fe63992c312959feaf80bc0" }
collab-plugins = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a302e9aaa3a86b7c2fe63992c312959feaf80bc0" }
collab-user = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a302e9aaa3a86b7c2fe63992c312959feaf80bc0" }
collab-importer = { version = "0.1", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "a302e9aaa3a86b7c2fe63992c312959feaf80bc0" }
collab = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "ae51ebef5cfc9805d58e89adca2cff9ea6e0b730" }
collab-entity = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "ae51ebef5cfc9805d58e89adca2cff9ea6e0b730" }
collab-folder = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "ae51ebef5cfc9805d58e89adca2cff9ea6e0b730" }
collab-document = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "ae51ebef5cfc9805d58e89adca2cff9ea6e0b730" }
collab-database = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "ae51ebef5cfc9805d58e89adca2cff9ea6e0b730" }
collab-plugins = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "ae51ebef5cfc9805d58e89adca2cff9ea6e0b730" }
collab-user = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "ae51ebef5cfc9805d58e89adca2cff9ea6e0b730" }
collab-importer = { version = "0.1", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "ae51ebef5cfc9805d58e89adca2cff9ea6e0b730" }

# Working directory: frontend
# To update the commit ID, run:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ pub(crate) fn generate_import_data(
};

let (views, orphan_views) = user_collab_db.with_write_txn(|current_collab_db_write_txn| {
let imported_uid = imported_folder.imported_session.user_id;
let imported_collab_db_read_txn = imported_collab_db.read_txn();
// use the old_to_new_id_map to keep track of the other collab object id and the new collab object id
let mut old_to_new_id_map = OldToNewIdMap::new();
Expand All @@ -179,6 +180,8 @@ pub(crate) fn generate_import_data(
.map(|iter| iter.collect::<Vec<String>>())
.unwrap_or_default();

info!("[AppflowyData]: {} has {} collab objects", imported_uid, all_imported_object_ids.len());

// when doing import, we don't want to import these objects:
// 1. user workspace
// 2. workspace database views
Expand Down Expand Up @@ -580,9 +583,17 @@ where
}

database_object_ids.push(object_id.clone());
reset_inline_view_id(database_collab, |old_inline_view_id| {
if reset_inline_view_id(database_collab, |old_inline_view_id| {
old_to_new_id_map.exchange_new_id(&old_inline_view_id)
});
})
.is_err()
{
error!(
"[AppflowyData]: reset inline view id failed for database: {}",
object_id
);
continue;
}

mut_database_views_with_collab(database_collab, |database_view| {
let new_view_id = old_to_new_id_map.exchange_new_id(&database_view.id);
Expand Down

0 comments on commit 01a94fd

Please sign in to comment.