Skip to content

Commit

Permalink
chore: apply migration if need
Browse files Browse the repository at this point in the history
  • Loading branch information
appflowy committed Oct 30, 2024
1 parent 696af8e commit 53443a6
Show file tree
Hide file tree
Showing 15 changed files with 144 additions and 122 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 = "d6af6171ee8ab8b1ff75e38ecbc9c6155bdd17a7" }
collab-entity = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "d6af6171ee8ab8b1ff75e38ecbc9c6155bdd17a7" }
collab-folder = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "d6af6171ee8ab8b1ff75e38ecbc9c6155bdd17a7" }
collab-document = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "d6af6171ee8ab8b1ff75e38ecbc9c6155bdd17a7" }
collab-database = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "d6af6171ee8ab8b1ff75e38ecbc9c6155bdd17a7" }
collab-plugins = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "d6af6171ee8ab8b1ff75e38ecbc9c6155bdd17a7" }
collab-user = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "d6af6171ee8ab8b1ff75e38ecbc9c6155bdd17a7" }
collab-importer = { version = "0.1", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "d6af6171ee8ab8b1ff75e38ecbc9c6155bdd17a7" }
collab = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "60e4e8d642eb0fe5752bf917acbe2f66327b4b8d" }
collab-entity = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "60e4e8d642eb0fe5752bf917acbe2f66327b4b8d" }
collab-folder = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "60e4e8d642eb0fe5752bf917acbe2f66327b4b8d" }
collab-document = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "60e4e8d642eb0fe5752bf917acbe2f66327b4b8d" }
collab-database = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "60e4e8d642eb0fe5752bf917acbe2f66327b4b8d" }
collab-plugins = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "60e4e8d642eb0fe5752bf917acbe2f66327b4b8d" }
collab-user = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "60e4e8d642eb0fe5752bf917acbe2f66327b4b8d" }
collab-importer = { version = "0.1", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "60e4e8d642eb0fe5752bf917acbe2f66327b4b8d" }

# 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 = "d6af6171ee8ab8b1ff75e38ecbc9c6155bdd17a7" }
collab-entity = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "d6af6171ee8ab8b1ff75e38ecbc9c6155bdd17a7" }
collab-folder = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "d6af6171ee8ab8b1ff75e38ecbc9c6155bdd17a7" }
collab-document = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "d6af6171ee8ab8b1ff75e38ecbc9c6155bdd17a7" }
collab-database = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "d6af6171ee8ab8b1ff75e38ecbc9c6155bdd17a7" }
collab-plugins = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "d6af6171ee8ab8b1ff75e38ecbc9c6155bdd17a7" }
collab-user = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "d6af6171ee8ab8b1ff75e38ecbc9c6155bdd17a7" }
collab-importer = { version = "0.1", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "d6af6171ee8ab8b1ff75e38ecbc9c6155bdd17a7" }
collab = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "60e4e8d642eb0fe5752bf917acbe2f66327b4b8d" }
collab-entity = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "60e4e8d642eb0fe5752bf917acbe2f66327b4b8d" }
collab-folder = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "60e4e8d642eb0fe5752bf917acbe2f66327b4b8d" }
collab-document = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "60e4e8d642eb0fe5752bf917acbe2f66327b4b8d" }
collab-database = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "60e4e8d642eb0fe5752bf917acbe2f66327b4b8d" }
collab-plugins = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "60e4e8d642eb0fe5752bf917acbe2f66327b4b8d" }
collab-user = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "60e4e8d642eb0fe5752bf917acbe2f66327b4b8d" }
collab-importer = { version = "0.1", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "60e4e8d642eb0fe5752bf917acbe2f66327b4b8d" }


# Working directory: frontend
Expand Down
19 changes: 11 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 = "d6af6171ee8ab8b1ff75e38ecbc9c6155bdd17a7" }
collab-entity = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "d6af6171ee8ab8b1ff75e38ecbc9c6155bdd17a7" }
collab-folder = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "d6af6171ee8ab8b1ff75e38ecbc9c6155bdd17a7" }
collab-document = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "d6af6171ee8ab8b1ff75e38ecbc9c6155bdd17a7" }
collab-database = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "d6af6171ee8ab8b1ff75e38ecbc9c6155bdd17a7" }
collab-plugins = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "d6af6171ee8ab8b1ff75e38ecbc9c6155bdd17a7" }
collab-user = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "d6af6171ee8ab8b1ff75e38ecbc9c6155bdd17a7" }
collab-importer = { version = "0.1", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "d6af6171ee8ab8b1ff75e38ecbc9c6155bdd17a7" }
collab = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "60e4e8d642eb0fe5752bf917acbe2f66327b4b8d" }
collab-entity = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "60e4e8d642eb0fe5752bf917acbe2f66327b4b8d" }
collab-folder = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "60e4e8d642eb0fe5752bf917acbe2f66327b4b8d" }
collab-document = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "60e4e8d642eb0fe5752bf917acbe2f66327b4b8d" }
collab-database = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "60e4e8d642eb0fe5752bf917acbe2f66327b4b8d" }
collab-plugins = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "60e4e8d642eb0fe5752bf917acbe2f66327b4b8d" }
collab-user = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "60e4e8d642eb0fe5752bf917acbe2f66327b4b8d" }
collab-importer = { version = "0.1", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "60e4e8d642eb0fe5752bf917acbe2f66327b4b8d" }

# Working directory: frontend
# To update the commit ID, run:
Expand Down
2 changes: 1 addition & 1 deletion frontend/rust-lib/flowy-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ serde_repr.workspace = true
futures.workspace = true
walkdir = "2.4.0"
sysinfo = "0.30.5"
semver = "1.0.22"
semver = { version = "1.0.22", features = ["serde"] }

[features]
profiling = ["console-subscriber", "tokio/tracing"]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,15 @@
use std::sync::Arc;

use collab::core::origin::{CollabClient, CollabOrigin};
use collab::preclude::Collab;
use collab_document::document::Document;
use collab_document::document_data::default_document_data;
use collab_folder::{Folder, View};
use collab_plugins::local_storage::kv::doc::migrate_old_keys;
use collab_plugins::local_storage::kv::KVTransactionDB;
use semver::Version;
use tracing::{event, instrument};
use tracing::{instrument, trace};

use collab_integrate::{CollabKVAction, CollabKVDB, PersistenceError};
use flowy_error::{FlowyError, FlowyResult};
use collab_integrate::CollabKVDB;
use flowy_error::FlowyResult;
use flowy_user_pub::entities::Authenticator;

use crate::migrations::migration::UserDataMigration;
use crate::migrations::util::load_collab;
use flowy_user_pub::session::Session;

pub struct CollabDocKeyWithWorkspaceIdMigration;
Expand All @@ -25,17 +19,21 @@ impl UserDataMigration for CollabDocKeyWithWorkspaceIdMigration {
"collab_doc_key_with_workspace_id"
}

fn applies_to_version(&self, _version: &Version) -> bool {
true
fn applies_to_version(&self, install_version: &Version) -> bool {
install_version < &Version::new(0, 7, 2)
}

#[instrument(name = "CollabDocKeyWithWorkspaceIdMigration", skip_all, err)]
fn run(
&self,
session: &Session,
collab_db: &Arc<CollabKVDB>,
authenticator: &Authenticator,
_authenticator: &Authenticator,
) -> FlowyResult<()> {
trace!(
"migrate key with workspace id:{}",
session.user_workspace.id
);
collab_db.with_write_txn(|txn| {
migrate_old_keys(txn, &session.user_workspace.id)?;
Ok(())
Expand Down
Loading

0 comments on commit 53443a6

Please sign in to comment.