My personal-knowledge-system, with deeply integrated task tracking and long term goal planning capabilities.
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat/db: tag table

+55 -1
+2
crates/dto/migration/src/lib.rs
··· 5 5 mod m20260318_233726_group_table; 6 6 mod m20260319_002245_task_table; 7 7 mod m20260323_002518_zettel_table; 8 + mod m20260327_175853_tag_table; 8 9 9 10 pub struct Migrator; 10 11 ··· 15 16 Box::new(m20260318_233726_group_table::Migration), 16 17 Box::new(m20260319_002245_task_table::Migration), 17 18 Box::new(m20260323_002518_zettel_table::Migration), 19 + Box::new(m20260327_175853_tag_table::Migration), 18 20 ] 19 21 } 20 22 }
+1 -1
crates/dto/migration/src/m20260323_002518_zettel_table.rs
··· 43 43 .await?; 44 44 45 45 manager 46 - .drop_table(Table::drop().table("post").to_owned()) 46 + .drop_table(Table::drop().table(Zettel::Table).to_owned()) 47 47 .await 48 48 } 49 49 }
+52
crates/dto/migration/src/m20260327_175853_tag_table.rs
··· 1 + use sea_orm_migration::{prelude::*, schema::*}; 2 + 3 + use crate::types::NANO_ID_LEN; 4 + 5 + #[derive(DeriveMigrationName)] 6 + pub struct Migration; 7 + 8 + #[async_trait::async_trait] 9 + impl MigrationTrait for Migration { 10 + async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> { 11 + manager 12 + .create_table( 13 + Table::create() 14 + .table(Tag::Table) 15 + .if_not_exists() 16 + .col(pk_auto(Tag::Id)) 17 + .col( 18 + string(Tag::NanoId) 19 + .string_len(NANO_ID_LEN as u32) 20 + .unique_key() 21 + .not_null(), 22 + ) 23 + .col(string(Tag::Name).not_null()) 24 + .col(string(Tag::Color).not_null()) 25 + .to_owned(), 26 + ) 27 + .await 28 + } 29 + 30 + async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> { 31 + manager 32 + .drop_table(Table::drop().table(Tag::Table).to_owned()) 33 + .await 34 + } 35 + } 36 + 37 + #[derive(DeriveIden)] 38 + pub enum Tag { 39 + Table, 40 + 41 + /// Unique integer id 42 + Id, 43 + 44 + /// Unique userfacing nano-id 45 + NanoId, 46 + 47 + /// Name of the tag (case sensitive) 48 + Name, 49 + 50 + /// Color of this tag 51 + Color, 52 + }