Merge branch 'main' into feat/dup-doc-in-db-row
This commit is contained in:
commit
bf9aed5384
|
|
@ -2089,7 +2089,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "collab"
|
||||
version = "0.2.0"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=5f3e7163e3a408a08423d079eb41068fb86e562b#5f3e7163e3a408a08423d079eb41068fb86e562b"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=28c439274c222bbc298dc6753200ee492d7e8509#28c439274c222bbc298dc6753200ee492d7e8509"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"arc-swap",
|
||||
|
|
@ -2114,7 +2114,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "collab-database"
|
||||
version = "0.2.0"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=5f3e7163e3a408a08423d079eb41068fb86e562b#5f3e7163e3a408a08423d079eb41068fb86e562b"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=28c439274c222bbc298dc6753200ee492d7e8509#28c439274c222bbc298dc6753200ee492d7e8509"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"async-trait",
|
||||
|
|
@ -2144,7 +2144,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "collab-document"
|
||||
version = "0.2.0"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=5f3e7163e3a408a08423d079eb41068fb86e562b#5f3e7163e3a408a08423d079eb41068fb86e562b"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=28c439274c222bbc298dc6753200ee492d7e8509#28c439274c222bbc298dc6753200ee492d7e8509"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"arc-swap",
|
||||
|
|
@ -2164,7 +2164,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "collab-entity"
|
||||
version = "0.2.0"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=5f3e7163e3a408a08423d079eb41068fb86e562b#5f3e7163e3a408a08423d079eb41068fb86e562b"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=28c439274c222bbc298dc6753200ee492d7e8509#28c439274c222bbc298dc6753200ee492d7e8509"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bytes",
|
||||
|
|
@ -2183,7 +2183,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "collab-folder"
|
||||
version = "0.2.0"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=5f3e7163e3a408a08423d079eb41068fb86e562b#5f3e7163e3a408a08423d079eb41068fb86e562b"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=28c439274c222bbc298dc6753200ee492d7e8509#28c439274c222bbc298dc6753200ee492d7e8509"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"arc-swap",
|
||||
|
|
@ -2268,7 +2268,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "collab-user"
|
||||
version = "0.2.0"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=5f3e7163e3a408a08423d079eb41068fb86e562b#5f3e7163e3a408a08423d079eb41068fb86e562b"
|
||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=28c439274c222bbc298dc6753200ee492d7e8509#28c439274c222bbc298dc6753200ee492d7e8509"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"collab",
|
||||
|
|
|
|||
12
Cargo.toml
12
Cargo.toml
|
|
@ -287,12 +287,12 @@ debug = true
|
|||
[patch.crates-io]
|
||||
# It's diffcult to resovle different version with the same crate used in AppFlowy Frontend and the Client-API crate.
|
||||
# So using patch to workaround this issue.
|
||||
collab = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5f3e7163e3a408a08423d079eb41068fb86e562b" }
|
||||
collab-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5f3e7163e3a408a08423d079eb41068fb86e562b" }
|
||||
collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5f3e7163e3a408a08423d079eb41068fb86e562b" }
|
||||
collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5f3e7163e3a408a08423d079eb41068fb86e562b" }
|
||||
collab-user = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5f3e7163e3a408a08423d079eb41068fb86e562b" }
|
||||
collab-database = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5f3e7163e3a408a08423d079eb41068fb86e562b" }
|
||||
collab = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "28c439274c222bbc298dc6753200ee492d7e8509" }
|
||||
collab-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "28c439274c222bbc298dc6753200ee492d7e8509" }
|
||||
collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "28c439274c222bbc298dc6753200ee492d7e8509" }
|
||||
collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "28c439274c222bbc298dc6753200ee492d7e8509" }
|
||||
collab-user = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "28c439274c222bbc298dc6753200ee492d7e8509" }
|
||||
collab-database = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "28c439274c222bbc298dc6753200ee492d7e8509" }
|
||||
|
||||
[features]
|
||||
history = []
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
FROM golang as base
|
||||
WORKDIR /go/src/supabase
|
||||
RUN git clone https://github.com/supabase/auth.git --depth 1 --branch v2.159.1
|
||||
WORKDIR /go/src/supabase/gotrue
|
||||
WORKDIR /go/src/supabase/auth
|
||||
COPY docker/gotrue.patch .
|
||||
RUN git apply gotrue.patch
|
||||
RUN CGO_ENABLED=0 go build -o /gotrue .
|
||||
RUN CGO_ENABLED=0 go build -o /auth .
|
||||
|
||||
FROM scratch
|
||||
COPY --from=base /usr/share/zoneinfo /usr/share/zoneinfo
|
||||
|
|
@ -12,7 +12,7 @@ COPY --from=base /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
|
|||
COPY --from=base /etc/passwd /etc/passwd
|
||||
COPY --from=base /etc/group /etc/group
|
||||
|
||||
COPY --from=base /gotrue .
|
||||
COPY --from=base /go/src/supabase/gotrue/migrations ./migrations
|
||||
COPY --from=base /auth .
|
||||
COPY --from=base /go/src/supabase/auth/migrations ./migrations
|
||||
|
||||
CMD ["./gotrue"]
|
||||
CMD ["./auth"]
|
||||
|
|
|
|||
|
|
@ -1,49 +1,16 @@
|
|||
use anyhow::Error;
|
||||
use async_trait::async_trait;
|
||||
use collab::preclude::Collab;
|
||||
use collab_database::database::{Database, DatabaseContext};
|
||||
use collab_database::entity::{CreateDatabaseParams, EncodedDatabase};
|
||||
use collab_database::error::DatabaseError;
|
||||
use collab_database::workspace_database::{
|
||||
DatabaseCollabPersistenceService, DatabaseCollabService,
|
||||
};
|
||||
use collab_entity::CollabType;
|
||||
use collab_folder::CollabOrigin;
|
||||
use collab_database::workspace_database::NoPersistenceDatabaseCollabService;
|
||||
use std::sync::Arc;
|
||||
use std::vec;
|
||||
|
||||
struct TemplateDatabaseCollabServiceImpl;
|
||||
|
||||
#[async_trait]
|
||||
impl DatabaseCollabService for TemplateDatabaseCollabServiceImpl {
|
||||
async fn build_collab(
|
||||
&self,
|
||||
object_id: &str,
|
||||
_object_type: CollabType,
|
||||
_is_new: bool,
|
||||
) -> Result<Collab, DatabaseError> {
|
||||
Ok(Collab::new_with_origin(
|
||||
CollabOrigin::Empty,
|
||||
object_id,
|
||||
vec![],
|
||||
false,
|
||||
))
|
||||
}
|
||||
|
||||
fn persistence(&self) -> Option<Arc<dyn DatabaseCollabPersistenceService>> {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn create_database_collab(
|
||||
_object_id: String,
|
||||
params: CreateDatabaseParams,
|
||||
) -> Result<EncodedDatabase, Error> {
|
||||
let collab_service = Arc::new(TemplateDatabaseCollabServiceImpl);
|
||||
let collab_service = Arc::new(NoPersistenceDatabaseCollabService);
|
||||
let context = DatabaseContext {
|
||||
collab_service,
|
||||
notifier: Default::default(),
|
||||
is_new: true,
|
||||
};
|
||||
Database::create_with_view(params, context)
|
||||
.await?
|
||||
|
|
|
|||
|
|
@ -65,13 +65,10 @@ impl GettingStartedTemplate {
|
|||
object_id: String,
|
||||
create_database_params: CreateDatabaseParams,
|
||||
) -> anyhow::Result<Vec<TemplateData>> {
|
||||
let object_id = object_id.clone();
|
||||
let database_id = create_database_params.database_id.clone();
|
||||
|
||||
let encoded_database = tokio::task::spawn_blocking({
|
||||
let object_id = object_id.clone();
|
||||
let create_database_params = create_database_params.clone();
|
||||
move || create_database_collab(object_id, create_database_params)
|
||||
move || create_database_collab(create_database_params)
|
||||
})
|
||||
.await?
|
||||
.await?;
|
||||
|
|
@ -84,7 +81,7 @@ impl GettingStartedTemplate {
|
|||
// 1. create the new database collab
|
||||
let database_template_data = TemplateData {
|
||||
template_id: TemplateObjectId::Database {
|
||||
object_id: object_id.clone(),
|
||||
object_id,
|
||||
database_id: database_id.clone(),
|
||||
},
|
||||
collab_type: CollabType::Database,
|
||||
|
|
@ -95,15 +92,11 @@ impl GettingStartedTemplate {
|
|||
let database_row_template_data =
|
||||
encoded_database
|
||||
.encoded_row_collabs
|
||||
.iter()
|
||||
.map(|encoded_row_collab| {
|
||||
let object_id = encoded_row_collab.object_id.clone();
|
||||
let data = encoded_row_collab.encoded_collab.clone();
|
||||
TemplateData {
|
||||
template_id: TemplateObjectId::DatabaseRow(object_id.clone()),
|
||||
collab_type: CollabType::DatabaseRow,
|
||||
encoded_collab: data,
|
||||
}
|
||||
.into_iter()
|
||||
.map(|encoded_row_collab| TemplateData {
|
||||
template_id: TemplateObjectId::DatabaseRow(encoded_row_collab.object_id),
|
||||
collab_type: CollabType::DatabaseRow,
|
||||
encoded_collab: encoded_row_collab.encoded_collab,
|
||||
});
|
||||
|
||||
let mut template_data = vec![database_template_data];
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
CREATE INDEX af_collab_embeddings_oid_idx ON public.af_collab_embeddings (oid);
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
DO $$
|
||||
BEGIN
|
||||
CREATE INDEX IF NOT EXISTS af_collab_embeddings_oid_idx ON public.af_collab_embeddings (oid);
|
||||
EXCEPTION WHEN others THEN
|
||||
RAISE NOTICE 'could not create index on af_collab_embeddings(oid), ignoring this migration';
|
||||
END $$;
|
||||
|
|
@ -158,7 +158,7 @@ async fn create_workspace_database_collab(
|
|||
let collab_type = CollabType::WorkspaceDatabase;
|
||||
let mut collab = Collab::new_with_origin(CollabOrigin::Empty, object_id, vec![], false);
|
||||
{
|
||||
let workspace_database_body = WorkspaceDatabaseBody::new(&mut collab);
|
||||
let workspace_database_body = WorkspaceDatabaseBody::create(&mut collab);
|
||||
let mut txn = collab.context.transact_mut();
|
||||
for (object_id, database_id) in initial_database_records {
|
||||
workspace_database_body.add_database(&mut txn, &database_id, vec![object_id]);
|
||||
|
|
|
|||
|
|
@ -188,8 +188,7 @@ impl PublishCollabDuplicator {
|
|||
collab_from_doc_state(ws_database_ec.doc_state.to_vec(), &ws_db_oid)?
|
||||
};
|
||||
|
||||
let ws_db_body = WorkspaceDatabaseBody::new(&mut ws_db_collab);
|
||||
|
||||
let ws_db_body = WorkspaceDatabaseBody::open(&mut ws_db_collab);
|
||||
let (ws_db_updates, updated_ws_w_db_collab) = tokio::task::spawn_blocking(move || {
|
||||
let ws_db_updates = {
|
||||
let mut txn_wrapper = ws_db_collab.transact_mut();
|
||||
|
|
|
|||
|
|
@ -942,7 +942,7 @@ async fn duplicate_to_workspace_doc_inline_database() {
|
|||
let mut ws_db_collab = client_2
|
||||
.get_workspace_database_collab(&workspace_id_2)
|
||||
.await;
|
||||
let ws_db_body = WorkspaceDatabaseBody::new(&mut ws_db_collab);
|
||||
let ws_db_body = WorkspaceDatabaseBody::open(&mut ws_db_collab);
|
||||
let txn = ws_db_collab.transact();
|
||||
let dup_grid1_db_id = ws_db_body
|
||||
.get_all_database_meta(&txn)
|
||||
|
|
|
|||
Loading…
Reference in New Issue