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: task and group entities

+124 -2
+3
Cargo.lock
··· 4318 4318 "glob", 4319 4319 "indoc", 4320 4320 "regex", 4321 + "sea-schema", 4322 + "sqlx", 4323 + "tokio", 4321 4324 "tracing", 4322 4325 "tracing-subscriber", 4323 4326 "url",
+2 -2
crates/db/migration/Cargo.toml
··· 17 17 # Enable at least one `ASYNC_RUNTIME` and `DATABASE_DRIVER` feature if you want to run migration via CLI. 18 18 # View the list of supported features at https://www.sea-ql.org/SeaORM/docs/install-and-config/database-and-async-runtime. 19 19 # e.g. 20 - # "runtime-tokio-rustls", # `ASYNC_RUNTIME` feature 21 - # "sqlx-postgres", # `DATABASE_DRIVER` feature 20 + "runtime-tokio", # `ASYNC_RUNTIME` feature 21 + "sqlx-sqlite", # `DATABASE_DRIVER` feature 22 22 ]
+1
crates/db/migration/src/m20260318_233726_group_table.rs
··· 20 20 .col(integer(Group::Priority).not_null().default(0)) 21 21 .col(timestamp(Group::CreatedAt).default(Expr::current_timestamp())) 22 22 .col(timestamp(Group::ModifiedAt).default(Expr::current_timestamp())) 23 + .col(string_null(Group::ParentGroupId)) 23 24 .foreign_key( 24 25 ForeignKey::create() 25 26 .name("fk_group_parent_id") // unique constraint name
+1
crates/db/migration/src/m20260319_002245_task_table.rs
··· 21 21 .col(timestamp(Task::Due).null()) 22 22 .col(timestamp(Task::CreatedAt).default(Expr::current_timestamp())) 23 23 .col(timestamp(Task::ModifiedAt).default(Expr::current_timestamp())) 24 + .col(string_null(Task::GroupId)) 24 25 .foreign_key( 25 26 ForeignKey::create() 26 27 .name("fk_task_group_id") // unique constraint name
+41
crates/db/src/entity/group.rs
··· 1 + //! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.19 2 + 3 + use sea_orm::entity::prelude::*; 4 + 5 + #[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)] 6 + #[sea_orm(table_name = "group")] 7 + pub struct Model { 8 + #[sea_orm(primary_key)] 9 + pub id: i32, 10 + #[sea_orm(unique)] 11 + pub nano_id: String, 12 + pub name: String, 13 + pub color: String, 14 + pub description_path: String, 15 + pub priority: i32, 16 + pub created_at: DateTimeUtc, 17 + pub modified_at: DateTimeUtc, 18 + pub parent_group_id: Option<String>, 19 + } 20 + 21 + #[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] 22 + pub enum Relation { 23 + #[sea_orm( 24 + belongs_to = "Entity", 25 + from = "Column::ParentGroupId", 26 + to = "Column::NanoId", 27 + on_update = "Cascade", 28 + on_delete = "Cascade" 29 + )] 30 + SelfRef, 31 + #[sea_orm(has_many = "super::task::Entity")] 32 + Task, 33 + } 34 + 35 + impl Related<super::task::Entity> for Entity { 36 + fn to() -> RelationDef { 37 + Relation::Task.def() 38 + } 39 + } 40 + 41 + impl ActiveModelBehavior for ActiveModel {}
+6
crates/db/src/entity/mod.rs
··· 1 + //! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.19 2 + 3 + pub mod prelude; 4 + 5 + pub mod group; 6 + pub mod task;
+4
crates/db/src/entity/prelude.rs
··· 1 + //! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.19 2 + 3 + pub use super::group::Entity as Group; 4 + pub use super::task::Entity as Task;
+39
crates/db/src/entity/task.rs
··· 1 + //! `SeaORM` Entity, @generated by sea-orm-codegen 1.1.19 2 + 3 + use sea_orm::entity::prelude::*; 4 + 5 + #[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)] 6 + #[sea_orm(table_name = "task")] 7 + pub struct Model { 8 + #[sea_orm(primary_key)] 9 + pub id: i32, 10 + #[sea_orm(unique)] 11 + pub nano_id: String, 12 + pub name: String, 13 + pub description_path: String, 14 + pub priority: i32, 15 + pub due: Option<DateTimeUtc>, 16 + pub created_at: DateTimeUtc, 17 + pub modified_at: DateTimeUtc, 18 + pub group_id: Option<String>, 19 + } 20 + 21 + #[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] 22 + pub enum Relation { 23 + #[sea_orm( 24 + belongs_to = "super::group::Entity", 25 + from = "Column::GroupId", 26 + to = "super::group::Column::NanoId", 27 + on_update = "Cascade", 28 + on_delete = "Cascade" 29 + )] 30 + Group, 31 + } 32 + 33 + impl Related<super::group::Entity> for Entity { 34 + fn to() -> RelationDef { 35 + Relation::Group.def() 36 + } 37 + } 38 + 39 + impl ActiveModelBehavior for ActiveModel {}
+4
crates/db/src/lib.rs
··· 11 11 12 12 /// Database Errors 13 13 mod errors; 14 + 15 + /// Database entities 16 + mod entity; 17 + 14 18 #[expect(unused_imports)] 15 19 pub use errors::*; 16 20
+23
justfile
··· 19 19 # Run all tests 20 20 test: 21 21 cargo test {{_cargo_flags}} 22 + 23 + 24 + # Only used to build / generate entities 25 + dev-db := "sqlite:///" + justfile_directory() + "/target/dev.db" 26 + 27 + # build entities from migrations 28 + [working-directory:"crates/db"] 29 + entity: 30 + touch ../../target/dev.db 31 + cd migration && cargo run -- -u {{dev-db}} 32 + sea-orm-cli generate entity \ 33 + --database-url {{dev-db}} \ 34 + --output-dir ./src/entity \ 35 + # --expanded-format # add flag if expanded format is needed for debugging 36 + 37 + 38 + 39 + 40 + 41 + 42 + 43 + 44 +