]> uap-core.de Git - note.git/commitdiff
add entity crate
authorOlaf Wintermann <olaf.wintermann@gmail.com>
Sun, 3 May 2026 15:21:44 +0000 (17:21 +0200)
committerOlaf Wintermann <olaf.wintermann@gmail.com>
Sun, 3 May 2026 15:21:44 +0000 (17:21 +0200)
entity/Cargo.toml [new file with mode: 0644]
entity/src/lib.rs [new file with mode: 0644]
entity/src/mod.rs [new file with mode: 0644]
entity/src/prelude.rs [new file with mode: 0644]
migration/src/m20260502_184134_create_settings.rs [new file with mode: 0644]

diff --git a/entity/Cargo.toml b/entity/Cargo.toml
new file mode 100644 (file)
index 0000000..0b259a8
--- /dev/null
@@ -0,0 +1,9 @@
+[package]
+name = "entity"
+version = "0.1.0"
+edition = "2024"
+
+[dependencies]
+ui-rs = { path = "../ui-rs" }
+sea-orm = { version = "2.0.0-rc", features = [ "with-chrono", "with-uuid", "macros" ] }
+
diff --git a/entity/src/lib.rs b/entity/src/lib.rs
new file mode 100644 (file)
index 0000000..5db23e3
--- /dev/null
@@ -0,0 +1,2 @@
+mod usersettings;
+mod prelude;
\ No newline at end of file
diff --git a/entity/src/mod.rs b/entity/src/mod.rs
new file mode 100644 (file)
index 0000000..e284bbf
--- /dev/null
@@ -0,0 +1,3 @@
+//! `SeaORM` Entity, @generated by sea-orm-codegen 2.0
+
+pub mod prelude;
diff --git a/entity/src/prelude.rs b/entity/src/prelude.rs
new file mode 100644 (file)
index 0000000..7ba689c
--- /dev/null
@@ -0,0 +1 @@
+//! `SeaORM` Entity, @generated by sea-orm-codegen 2.0
diff --git a/migration/src/m20260502_184134_create_settings.rs b/migration/src/m20260502_184134_create_settings.rs
new file mode 100644 (file)
index 0000000..ee9d079
--- /dev/null
@@ -0,0 +1,28 @@
+use sea_orm_migration::{prelude::*, schema::*};
+
+#[derive(DeriveMigrationName)]
+pub struct Migration;
+
+#[async_trait::async_trait]
+impl MigrationTrait for Migration {
+    async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
+        manager
+            .create_table(
+                Table::create()
+                    .table("user_settings")
+                    .if_not_exists()
+                    .col(pk_auto("id"))
+                    .col(string("host"))
+                    .col(string("user"))
+                    .col(string("profile"))
+                    .to_owned(),
+            )
+            .await
+    }
+
+    async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
+        manager
+            .drop_table(Table::drop().table("user_settings").to_owned())
+            .await
+    }
+}