feat: save snapshot to sqlite db (#2718)

* chore: snapshot

* chore: impl sqlite snapshot

* feat: snapshot config

* feat: update patch

* ci: fix tauri ci

* ci: add cache path

* chore: save snapshot

* chore: update patch

* ci: fix s fmt
This commit is contained in:
Nathan.fooo
2023-06-06 16:03:29 +08:00
committed by GitHub
parent f2dd58a4f1
commit bf121623ae
20 changed files with 323 additions and 98 deletions

View File

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

View File

@ -0,0 +1,8 @@
-- Your SQL goes here
CREATE TABLE collab_snapshot (
id TEXT NOT NULL PRIMARY KEY DEFAULT '',
object_id TEXT NOT NULL DEFAULT '',
desc TEXT NOT NULL DEFAULT '',
timestamp BIGINT NOT NULL DEFAULT 0,
data BLOB NOT NULL DEFAULT (x'')
);

View File

@ -1,31 +1,35 @@
#[macro_use]
pub extern crate diesel;
#[macro_use]
pub extern crate diesel_derives;
#[macro_use]
extern crate diesel_migrations;
use std::{fmt::Debug, io, path::Path};
pub use diesel::*;
pub use diesel_derives::*;
use diesel_migrations::*;
use std::{fmt::Debug, io, path::Path};
pub mod kv;
mod sqlite;
use crate::sqlite::PoolConfig;
pub use crate::sqlite::{ConnectionPool, DBConnection, Database};
pub mod kv;
mod sqlite;
pub mod schema;
#[macro_use]
pub mod macros;
#[macro_use]
extern crate diesel;
#[macro_use]
extern crate diesel_derives;
#[macro_use]
extern crate diesel_migrations;
pub type Error = diesel::result::Error;
pub mod prelude {
pub use super::UserDatabaseConnection;
pub use crate::*;
pub use diesel::SqliteConnection;
pub use diesel::{query_dsl::*, BelongingToDsl, ExpressionMethods, RunQueryDsl};
pub use crate::*;
pub use super::UserDatabaseConnection;
}
embed_migrations!("../flowy-sqlite/migrations/");

View File

@ -1,5 +1,15 @@
// @generated automatically by Diesel CLI.
diesel::table! {
collab_snapshot (id) {
id -> Text,
object_id -> Text,
desc -> Text,
timestamp -> BigInt,
data -> Binary,
}
}
diesel::table! {
user_table (id) {
id -> Text,
@ -11,3 +21,5 @@ diesel::table! {
email -> Text,
}
}
diesel::allow_tables_to_appear_in_same_query!(collab_snapshot, user_table,);