فهرست منبع

chore: add grid_view_table

appflowy 2 سال پیش
والد
کامیت
b15439fb70

+ 2 - 0
frontend/rust-lib/flowy-database/migrations/2022-08-15-020544_grid-view/down.sql

@@ -0,0 +1,2 @@
+-- This file should undo anything in `up.sql`
+DROP TABLE grid_view_table;

+ 11 - 0
frontend/rust-lib/flowy-database/migrations/2022-08-15-020544_grid-view/up.sql

@@ -0,0 +1,11 @@
+-- Your SQL goes here
+
+
+CREATE TABLE grid_view_table (
+    id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
+    object_id TEXT NOT NULL DEFAULT '',
+    base_rev_id BIGINT NOT NULL DEFAULT 0,
+    rev_id BIGINT NOT NULL DEFAULT 0,
+    data BLOB NOT NULL DEFAULT (x''),
+    state INTEGER NOT NULL DEFAULT 0
+);

+ 12 - 0
frontend/rust-lib/flowy-database/src/schema.rs

@@ -42,6 +42,17 @@ table! {
     }
 }
 
+table! {
+    grid_view_table (id) {
+        id -> Integer,
+        object_id -> Text,
+        base_rev_id -> BigInt,
+        rev_id -> BigInt,
+        data -> Binary,
+        state -> Integer,
+    }
+}
+
 table! {
     kv_table (key) {
         key -> Text,
@@ -125,6 +136,7 @@ allow_tables_to_appear_in_same_query!(
     grid_block_index_table,
     grid_meta_rev_table,
     grid_rev_table,
+    grid_view_table,
     kv_table,
     rev_snapshot,
     rev_table,

+ 2 - 1
frontend/rust-lib/flowy-grid/src/services/grid_editor.rs

@@ -7,6 +7,7 @@ use crate::services::cell::{apply_cell_data_changeset, decode_any_cell_data, Cel
 use crate::services::field::{default_type_option_builder_from_type, type_option_builder_from_bytes, FieldBuilder};
 use crate::services::filter::{GridFilterChangeset, GridFilterService};
 
+use crate::services::grid_view_editor::GridViewRevisionEditor;
 use crate::services::group::GridGroupService;
 use crate::services::persistence::block_index::BlockIndexCache;
 use crate::services::row::{
@@ -32,7 +33,7 @@ pub struct GridRevisionEditor {
     pub(crate) grid_id: String,
     user: Arc<dyn GridUser>,
     grid_pad: Arc<RwLock<GridRevisionPad>>,
-    // view_editor: Arc<GridViewRevisionEditor>,
+    view_editor: Arc<GridViewRevisionEditor>,
     rev_manager: Arc<RevisionManager>,
     block_manager: Arc<GridBlockManager>,