Просмотр исходного кода

chore: remove unused sqlite table (#2704)

* chore: remove unused sqlite table

* ci: fix tests
Nathan.fooo 1 год назад
Родитель
Сommit
f2dd58a4f1
33 измененных файлов с 17 добавлено и 393 удалено
  1. 0 5
      frontend/rust-lib/flowy-sqlite/migrations/2021-07-09-063045_user/down.sql
  2. 0 53
      frontend/rust-lib/flowy-sqlite/migrations/2021-07-09-063045_user/up.sql
  3. 0 2
      frontend/rust-lib/flowy-sqlite/migrations/2021-07-14-022241_user-add-col/down.sql
  4. 0 2
      frontend/rust-lib/flowy-sqlite/migrations/2021-07-14-022241_user-add-col/up.sql
  5. 0 10
      frontend/rust-lib/flowy-sqlite/migrations/2021-09-22-074638_revision/up.sql
  6. 0 4
      frontend/rust-lib/flowy-sqlite/migrations/2022-03-11-025536_grid/down.sql
  7. 0 22
      frontend/rust-lib/flowy-sqlite/migrations/2022-03-11-025536_grid/up.sql
  8. 0 3
      frontend/rust-lib/flowy-sqlite/migrations/2022-04-05-015536_grid-block-index/down.sql
  9. 0 7
      frontend/rust-lib/flowy-sqlite/migrations/2022-04-05-015536_grid-block-index/up.sql
  10. 0 2
      frontend/rust-lib/flowy-sqlite/migrations/2022-06-10-140131_revision-snapshot/down.sql
  11. 0 7
      frontend/rust-lib/flowy-sqlite/migrations/2022-06-10-140131_revision-snapshot/up.sql
  12. 0 2
      frontend/rust-lib/flowy-sqlite/migrations/2022-06-11-090029_view-add-col/down.sql
  13. 0 2
      frontend/rust-lib/flowy-sqlite/migrations/2022-06-11-090029_view-add-col/up.sql
  14. 0 1
      frontend/rust-lib/flowy-sqlite/migrations/2022-08-08-110959_user-add-icon/down.sql
  15. 0 1
      frontend/rust-lib/flowy-sqlite/migrations/2022-08-08-110959_user-add-icon/up.sql
  16. 0 2
      frontend/rust-lib/flowy-sqlite/migrations/2022-08-15-020544_grid-view/down.sql
  17. 0 11
      frontend/rust-lib/flowy-sqlite/migrations/2022-08-15-020544_grid-view/up.sql
  18. 0 2
      frontend/rust-lib/flowy-sqlite/migrations/2022-10-22-033122_document/down.sql
  19. 0 9
      frontend/rust-lib/flowy-sqlite/migrations/2022-10-22-033122_document/up.sql
  20. 0 2
      frontend/rust-lib/flowy-sqlite/migrations/2022-12-08-011428_grid_rev_snapshot/down.sql
  21. 0 9
      frontend/rust-lib/flowy-sqlite/migrations/2022-12-08-011428_grid_rev_snapshot/up.sql
  22. 0 2
      frontend/rust-lib/flowy-sqlite/migrations/2023-01-06-032859_folder_rev_snapshot/down.sql
  23. 0 9
      frontend/rust-lib/flowy-sqlite/migrations/2023-01-06-032859_folder_rev_snapshot/up.sql
  24. 0 2
      frontend/rust-lib/flowy-sqlite/migrations/2023-01-12-131717_document_rev_snapshot/down.sql
  25. 0 9
      frontend/rust-lib/flowy-sqlite/migrations/2023-01-12-131717_document_rev_snapshot/up.sql
  26. 0 1
      frontend/rust-lib/flowy-sqlite/migrations/2023-02-13-102237_user-add-openai_key/down.sql
  27. 0 1
      frontend/rust-lib/flowy-sqlite/migrations/2023-02-13-102237_user-add-openai_key/up.sql
  28. 0 2
      frontend/rust-lib/flowy-sqlite/migrations/2023-02-25-022539_database_refs/down.sql
  29. 0 8
      frontend/rust-lib/flowy-sqlite/migrations/2023-02-25-022539_database_refs/up.sql
  30. 1 1
      frontend/rust-lib/flowy-sqlite/migrations/2023-06-05-023648_user/down.sql
  31. 10 0
      frontend/rust-lib/flowy-sqlite/migrations/2023-06-05-023648_user/up.sql
  32. 2 198
      frontend/rust-lib/flowy-sqlite/src/schema.rs
  33. 4 2
      frontend/rust-lib/flowy-user/src/services/database.rs

+ 0 - 5
frontend/rust-lib/flowy-sqlite/migrations/2021-07-09-063045_user/down.sql

@@ -1,5 +0,0 @@
--- This file should undo anything in `up.sql`
-DROP TABLE user_table;
-DROP TABLE workspace_table;
-DROP TABLE app_table;
-DROP TABLE view_table;

+ 0 - 53
frontend/rust-lib/flowy-sqlite/migrations/2021-07-09-063045_user/up.sql

@@ -1,53 +0,0 @@
--- Your SQL goes here
-
-CREATE TABLE user_table (
-    id TEXT NOT NULL PRIMARY KEY,
-    name TEXT NOT NULL DEFAULT '',
-    token TEXT NOT NULL DEFAULT '',
-    email TEXT NOT NULL DEFAULT ''
-);
-
-CREATE TABLE workspace_table (
-    id TEXT NOT NULL PRIMARY KEY,
-    name TEXT NOT NULL DEFAULT '',
-    desc TEXT NOT NULL DEFAULT '',
-    modified_time BIGINT NOT NULL DEFAULT 0,
-    create_time BIGINT NOT NULL DEFAULT 0,
-    user_id TEXT NOT NULL DEFAULT '',
-    version BIGINT NOT NULL DEFAULT 0
-);
-
-CREATE TABLE app_table (
-    id TEXT NOT NULL PRIMARY KEY,
-    workspace_id TEXT NOT NULL DEFAULT '',
-    name TEXT NOT NULL DEFAULT '',
-    desc TEXT NOT NULL DEFAULT '',
-    color_style BLOB NOT NULL DEFAULT (x''),
-    last_view_id TEXT DEFAULT '',
-    modified_time BIGINT NOT NULL DEFAULT 0,
-    create_time BIGINT NOT NULL DEFAULT 0,
-    version BIGINT NOT NULL DEFAULT 0,
-    is_trash Boolean NOT NULL DEFAULT false
-);
-
-CREATE TABLE view_table (
-    id TEXT NOT NULL PRIMARY KEY,
-    belong_to_id TEXT NOT NULL DEFAULT '',
-    name TEXT NOT NULL DEFAULT '',
-    desc TEXT NOT NULL DEFAULT '',
-    modified_time BIGINT NOT NULL DEFAULT 0,
-    create_time BIGINT NOT NULL DEFAULT 0,
-    thumbnail TEXT NOT NULL DEFAULT '',
-    view_type INTEGER NOT NULL DEFAULT 0,
-    version BIGINT NOT NULL DEFAULT 0,
-    is_trash Boolean NOT NULL DEFAULT false
-);
-
-CREATE TABLE trash_table (
-    id TEXT NOT NULL PRIMARY KEY,
-    name TEXT NOT NULL DEFAULT '',
-    desc TEXT NOT NULL DEFAULT '',
-    modified_time BIGINT NOT NULL DEFAULT 0,
-    create_time BIGINT NOT NULL DEFAULT 0,
-    ty INTEGER NOT NULL DEFAULT 0
-);

+ 0 - 2
frontend/rust-lib/flowy-sqlite/migrations/2021-07-14-022241_user-add-col/down.sql

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

+ 0 - 2
frontend/rust-lib/flowy-sqlite/migrations/2021-07-14-022241_user-add-col/up.sql

@@ -1,2 +0,0 @@
--- Your SQL goes here
-ALTER TABLE user_table ADD COLUMN workspace TEXT NOT NULL DEFAULT '';

+ 0 - 10
frontend/rust-lib/flowy-sqlite/migrations/2021-09-22-074638_revision/up.sql

@@ -1,10 +0,0 @@
--- Your SQL goes here
-CREATE TABLE rev_table (
-    id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
-    doc_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,
-    ty INTEGER NOT NULL DEFAULT 0
-);

+ 0 - 4
frontend/rust-lib/flowy-sqlite/migrations/2022-03-11-025536_grid/down.sql

@@ -1,4 +0,0 @@
--- This file should undo anything in `up.sql`
-DROP TABLE kv_table;
-DROP TABLE grid_rev_table;
-DROP TABLE grid_meta_rev_table;

+ 0 - 22
frontend/rust-lib/flowy-sqlite/migrations/2022-03-11-025536_grid/up.sql

@@ -1,22 +0,0 @@
--- Your SQL goes here
-CREATE TABLE kv_table (
-    key TEXT NOT NULL PRIMARY KEY,
-    value BLOB NOT NULL DEFAULT (x'')
-);
-CREATE TABLE grid_rev_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
-);
-
-CREATE TABLE grid_meta_rev_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
-);

+ 0 - 3
frontend/rust-lib/flowy-sqlite/migrations/2022-04-05-015536_grid-block-index/down.sql

@@ -1,3 +0,0 @@
--- This file should undo anything in `up.sql`
-DROP TABLE grid_block_index_table;
--- DROP TABLE grid_block_fts_table;

+ 0 - 7
frontend/rust-lib/flowy-sqlite/migrations/2022-04-05-015536_grid-block-index/up.sql

@@ -1,7 +0,0 @@
--- Your SQL goes here
-CREATE TABLE grid_block_index_table (
-     row_id TEXT NOT NULL PRIMARY KEY,
-     block_id TEXT NOT NULL
-);
-
--- CREATE VIRTUAL TABLE grid_block_fts_table USING FTS5(content, grid_id, block_id, row_id);

+ 0 - 2
frontend/rust-lib/flowy-sqlite/migrations/2022-06-10-140131_revision-snapshot/down.sql

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

+ 0 - 7
frontend/rust-lib/flowy-sqlite/migrations/2022-06-10-140131_revision-snapshot/up.sql

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

+ 0 - 2
frontend/rust-lib/flowy-sqlite/migrations/2022-06-11-090029_view-add-col/down.sql

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

+ 0 - 2
frontend/rust-lib/flowy-sqlite/migrations/2022-06-11-090029_view-add-col/up.sql

@@ -1,2 +0,0 @@
--- Your SQL goes here
-ALTER TABLE view_table ADD COLUMN ext_data TEXT NOT NULL DEFAULT '';

+ 0 - 1
frontend/rust-lib/flowy-sqlite/migrations/2022-08-08-110959_user-add-icon/down.sql

@@ -1 +0,0 @@
-ALTER TABLE user_table DROP COLUMN icon_url;

+ 0 - 1
frontend/rust-lib/flowy-sqlite/migrations/2022-08-08-110959_user-add-icon/up.sql

@@ -1 +0,0 @@
-ALTER TABLE user_table ADD COLUMN icon_url TEXT NOT NULL DEFAULT '';

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

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

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

@@ -1,11 +0,0 @@
--- Your SQL goes here
-
-
-CREATE TABLE grid_view_rev_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
-);

+ 0 - 2
frontend/rust-lib/flowy-sqlite/migrations/2022-10-22-033122_document/down.sql

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

+ 0 - 9
frontend/rust-lib/flowy-sqlite/migrations/2022-10-22-033122_document/up.sql

@@ -1,9 +0,0 @@
--- Your SQL goes here
-CREATE TABLE document_rev_table (
-   id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
-   document_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
-);

+ 0 - 2
frontend/rust-lib/flowy-sqlite/migrations/2022-12-08-011428_grid_rev_snapshot/down.sql

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

+ 0 - 9
frontend/rust-lib/flowy-sqlite/migrations/2022-12-08-011428_grid_rev_snapshot/up.sql

@@ -1,9 +0,0 @@
--- Your SQL goes here
-CREATE TABLE grid_rev_snapshot (
-      snapshot_id TEXT NOT NULL PRIMARY KEY DEFAULT '',
-      object_id TEXT NOT NULL DEFAULT '',
-      rev_id BIGINT NOT NULL DEFAULT 0,
-      base_rev_id BIGINT NOT NULL DEFAULT 0,
-      timestamp BIGINT NOT NULL DEFAULT 0,
-      data BLOB NOT NULL DEFAULT (x'')
-);

+ 0 - 2
frontend/rust-lib/flowy-sqlite/migrations/2023-01-06-032859_folder_rev_snapshot/down.sql

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

+ 0 - 9
frontend/rust-lib/flowy-sqlite/migrations/2023-01-06-032859_folder_rev_snapshot/up.sql

@@ -1,9 +0,0 @@
--- Your SQL goes here
-CREATE TABLE folder_rev_snapshot (
-   snapshot_id TEXT NOT NULL PRIMARY KEY DEFAULT '',
-   object_id TEXT NOT NULL DEFAULT '',
-   rev_id BIGINT NOT NULL DEFAULT 0,
-   base_rev_id BIGINT NOT NULL DEFAULT 0,
-   timestamp BIGINT NOT NULL DEFAULT 0,
-   data BLOB NOT NULL DEFAULT (x'')
-);

+ 0 - 2
frontend/rust-lib/flowy-sqlite/migrations/2023-01-12-131717_document_rev_snapshot/down.sql

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

+ 0 - 9
frontend/rust-lib/flowy-sqlite/migrations/2023-01-12-131717_document_rev_snapshot/up.sql

@@ -1,9 +0,0 @@
--- Your SQL goes here
-CREATE TABLE document_rev_snapshot (
-    snapshot_id TEXT NOT NULL PRIMARY KEY DEFAULT '',
-    object_id TEXT NOT NULL DEFAULT '',
-    rev_id BIGINT NOT NULL DEFAULT 0,
-    base_rev_id BIGINT NOT NULL DEFAULT 0,
-    timestamp BIGINT NOT NULL DEFAULT 0,
-    data BLOB NOT NULL DEFAULT (x'')
-);

+ 0 - 1
frontend/rust-lib/flowy-sqlite/migrations/2023-02-13-102237_user-add-openai_key/down.sql

@@ -1 +0,0 @@
-ALTER TABLE user_table DROP COLUMN openai_key;

+ 0 - 1
frontend/rust-lib/flowy-sqlite/migrations/2023-02-13-102237_user-add-openai_key/up.sql

@@ -1 +0,0 @@
-ALTER TABLE user_table ADD COLUMN openai_key TEXT NOT NULL DEFAULT '';

+ 0 - 2
frontend/rust-lib/flowy-sqlite/migrations/2023-02-25-022539_database_refs/down.sql

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

+ 0 - 8
frontend/rust-lib/flowy-sqlite/migrations/2023-02-25-022539_database_refs/up.sql

@@ -1,8 +0,0 @@
--- Your SQL goes here
-CREATE TABLE database_refs (
- ref_id TEXT NOT NULL PRIMARY KEY DEFAULT '',
- name TEXT NOT NULL DEFAULT '',
- is_base Boolean NOT NULL DEFAULT false,
- view_id TEXT NOT NULL DEFAULT '',
- database_id TEXT NOT NULL DEFAULT ''
-);

+ 1 - 1
frontend/rust-lib/flowy-sqlite/migrations/2021-09-22-074638_revision/down.sql → frontend/rust-lib/flowy-sqlite/migrations/2023-06-05-023648_user/down.sql

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

+ 10 - 0
frontend/rust-lib/flowy-sqlite/migrations/2023-06-05-023648_user/up.sql

@@ -0,0 +1,10 @@
+-- Your SQL goes here
+CREATE TABLE user_table (
+ id TEXT NOT NULL PRIMARY KEY,
+ name TEXT NOT NULL DEFAULT '',
+ workspace TEXT NOT NULL DEFAULT '',
+ icon_url TEXT NOT NULL DEFAULT '',
+ openai_key TEXT NOT NULL DEFAULT '',
+ token TEXT NOT NULL DEFAULT '',
+ email TEXT NOT NULL DEFAULT ''
+);

+ 2 - 198
frontend/rust-lib/flowy-sqlite/src/schema.rs

@@ -1,209 +1,13 @@
 // @generated automatically by Diesel CLI.
 
-diesel::table! {
-    app_table (id) {
-        id -> Text,
-        workspace_id -> Text,
-        name -> Text,
-        desc -> Text,
-        color_style -> Binary,
-        last_view_id -> Nullable<Text>,
-        modified_time -> BigInt,
-        create_time -> BigInt,
-        version -> BigInt,
-        is_trash -> Bool,
-    }
-}
-
-diesel::table! {
-    database_refs (ref_id) {
-        ref_id -> Text,
-        name -> Text,
-        is_base -> Bool,
-        view_id -> Text,
-        database_id -> Text,
-    }
-}
-
-diesel::table! {
-    document_rev_snapshot (snapshot_id) {
-        snapshot_id -> Text,
-        object_id -> Text,
-        rev_id -> BigInt,
-        base_rev_id -> BigInt,
-        timestamp -> BigInt,
-        data -> Binary,
-    }
-}
-
-diesel::table! {
-    document_rev_table (id) {
-        id -> Integer,
-        document_id -> Text,
-        base_rev_id -> BigInt,
-        rev_id -> BigInt,
-        data -> Binary,
-        state -> Integer,
-    }
-}
-
-diesel::table! {
-    folder_rev_snapshot (snapshot_id) {
-        snapshot_id -> Text,
-        object_id -> Text,
-        rev_id -> BigInt,
-        base_rev_id -> BigInt,
-        timestamp -> BigInt,
-        data -> Binary,
-    }
-}
-
-diesel::table! {
-    grid_block_index_table (row_id) {
-        row_id -> Text,
-        block_id -> Text,
-    }
-}
-
-diesel::table! {
-    grid_meta_rev_table (id) {
-        id -> Integer,
-        object_id -> Text,
-        base_rev_id -> BigInt,
-        rev_id -> BigInt,
-        data -> Binary,
-        state -> Integer,
-    }
-}
-
-diesel::table! {
-    grid_rev_snapshot (snapshot_id) {
-        snapshot_id -> Text,
-        object_id -> Text,
-        rev_id -> BigInt,
-        base_rev_id -> BigInt,
-        timestamp -> BigInt,
-        data -> Binary,
-    }
-}
-
-diesel::table! {
-    grid_rev_table (id) {
-        id -> Integer,
-        object_id -> Text,
-        base_rev_id -> BigInt,
-        rev_id -> BigInt,
-        data -> Binary,
-        state -> Integer,
-    }
-}
-
-diesel::table! {
-    grid_view_rev_table (id) {
-        id -> Integer,
-        object_id -> Text,
-        base_rev_id -> BigInt,
-        rev_id -> BigInt,
-        data -> Binary,
-        state -> Integer,
-    }
-}
-
-diesel::table! {
-    kv_table (key) {
-        key -> Text,
-        value -> Binary,
-    }
-}
-
-diesel::table! {
-    rev_snapshot (id) {
-        id -> Integer,
-        object_id -> Text,
-        rev_id -> BigInt,
-        data -> Binary,
-    }
-}
-
-diesel::table! {
-    rev_table (id) {
-        id -> Integer,
-        doc_id -> Text,
-        base_rev_id -> BigInt,
-        rev_id -> BigInt,
-        data -> Binary,
-        state -> Integer,
-        ty -> Integer,
-    }
-}
-
-diesel::table! {
-    trash_table (id) {
-        id -> Text,
-        name -> Text,
-        desc -> Text,
-        modified_time -> BigInt,
-        create_time -> BigInt,
-        ty -> Integer,
-    }
-}
-
 diesel::table! {
     user_table (id) {
         id -> Text,
         name -> Text,
-        token -> Text,
-        email -> Text,
         workspace -> Text,
         icon_url -> Text,
         openai_key -> Text,
+        token -> Text,
+        email -> Text,
     }
 }
-
-diesel::table! {
-    view_table (id) {
-        id -> Text,
-        belong_to_id -> Text,
-        name -> Text,
-        desc -> Text,
-        modified_time -> BigInt,
-        create_time -> BigInt,
-        thumbnail -> Text,
-        view_type -> Integer,
-        version -> BigInt,
-        is_trash -> Bool,
-        ext_data -> Text,
-    }
-}
-
-diesel::table! {
-    workspace_table (id) {
-        id -> Text,
-        name -> Text,
-        desc -> Text,
-        modified_time -> BigInt,
-        create_time -> BigInt,
-        user_id -> Text,
-        version -> BigInt,
-    }
-}
-
-diesel::allow_tables_to_appear_in_same_query!(
-  app_table,
-  database_refs,
-  document_rev_snapshot,
-  document_rev_table,
-  folder_rev_snapshot,
-  grid_block_index_table,
-  grid_meta_rev_table,
-  grid_rev_snapshot,
-  grid_rev_table,
-  grid_view_rev_table,
-  kv_table,
-  rev_snapshot,
-  rev_table,
-  trash_table,
-  user_table,
-  view_table,
-  workspace_table,
-);

+ 4 - 2
frontend/rust-lib/flowy-user/src/services/database.rs

@@ -105,16 +105,18 @@ lazy_static! {
   static ref COLLAB_DB_MAP: RwLock<HashMap<i64, Arc<RocksCollabDB>>> = RwLock::new(HashMap::new());
 }
 
+/// The order of the fields in the struct must be the same as the order of the fields in the table.
+/// Check out the [schema.rs] for table schema.
 #[derive(Clone, Default, Queryable, Identifiable, Insertable)]
 #[table_name = "user_table"]
 pub struct UserTable {
   pub(crate) id: String,
   pub(crate) name: String,
-  pub(crate) token: String,
-  pub(crate) email: String,
   pub(crate) workspace: String,
   pub(crate) icon_url: String,
   pub(crate) openai_key: String,
+  pub(crate) token: String,
+  pub(crate) email: String,
 }
 
 impl UserTable {