]> uap-core.de Git - note.git/commitdiff
add note table to migration
authorOlaf Wintermann <olaf.wintermann@gmail.com>
Fri, 22 May 2026 15:08:21 +0000 (17:08 +0200)
committerOlaf Wintermann <olaf.wintermann@gmail.com>
Fri, 22 May 2026 15:08:21 +0000 (17:08 +0200)
entity/src/note.rs
migration/src/m20260502_184134_create_settings.rs

index 8d5bfe16484096cc5f2ef5562b4c455ff7dc8d8d..53f4c5e7887b0c95038cb4476698b2343bad1da9 100644 (file)
@@ -13,7 +13,7 @@ pub struct Model {
     pub content: String,
 
     pub lastmodified: DateTimeWithTimeZone,
-    pub created_at: DateTimeWithTimeZone,
+    pub created: DateTimeWithTimeZone,
 }
 
 #[derive(EnumIter, DeriveActiveEnum, Clone, Debug, PartialEq)]
index 33e01c46e892ad99d86df5985b9db2a1277cffc4..1d997c1ef78f56d0595346eb438d00c0557803b6 100644 (file)
@@ -39,10 +39,27 @@ impl MigrationTrait for Migration {
                              .on_update(ForeignKeyAction::Cascade))
                     .to_owned(),
             )
-            .await
+            .await?;
+
+        manager
+            .create_table(
+                Table::create()
+                    .table("note")
+                    .if_not_exists()
+                    .col(pk_auto("note_id"))
+                    .col(integer("collection_id"))
+                    .col(integer("kind"))
+                    .col(string("title"))
+                    .col(string_null("content"))
+                    .col(timestamp_with_time_zone("lastmodified"))
+                    .col(timestamp_with_time_zone("created"))
+                    .to_owned()
+            ).await
     }
 
     async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
+        manager
+            .drop_table(Table::drop().table("note").to_owned()).await?;
         manager
             .drop_table(Table::drop().table("collection").to_owned()).await?;
         manager