feat: Get started doc migration (#3102)

* feat: migrate empty document

* chore: update collab rev

* chore: fmt
This commit is contained in:
Nathan.fooo
2023-08-03 09:14:52 +08:00
committed by GitHub
parent a40c639a96
commit 03b8f2ccb2
31 changed files with 546 additions and 170 deletions

View File

@ -6,7 +6,7 @@ edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
diesel = { version = "1.4.8", features = ["sqlite"] }
diesel = { version = "1.4.8", features = ["sqlite", "chrono"] }
diesel_derives = { version = "1.4.1", features = ["sqlite"] }
diesel_migrations = { version = "1.4.0", features = ["sqlite"] }
tracing = { version = "0.1", features = ["log"] }

View File

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

View File

@ -0,0 +1,6 @@
-- Your SQL goes here
CREATE TABLE user_data_migration_records (
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
migration_name TEXT NOT NULL,
executed_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
);

View File

@ -12,6 +12,14 @@ diesel::table! {
}
}
diesel::table! {
user_data_migration_records (id) {
id -> Integer,
migration_name -> Text,
executed_at -> Timestamp,
}
}
diesel::table! {
user_table (id) {
id -> Text,
@ -35,4 +43,9 @@ diesel::table! {
}
}
diesel::allow_tables_to_appear_in_same_query!(collab_snapshot, user_table, user_workspace_table,);
diesel::allow_tables_to_appear_in_same_query!(
collab_snapshot,
user_data_migration_records,
user_table,
user_workspace_table,
);