From 78885b36562aa345d049f8493caa75b84ae43b7b Mon Sep 17 00:00:00 2001 From: Masahiko AMANO Date: Thu, 3 Jul 2025 18:57:53 +0300 Subject: [PATCH] docs(erd): add `is_deleted` column to `data.files` --- docs/erd.puml | 421 +++++++++++++++++++++++++------------------------- 1 file changed, 211 insertions(+), 210 deletions(-) diff --git a/docs/erd.puml b/docs/erd.puml index 75a45cf..6b9b8cb 100644 --- a/docs/erd.puml +++ b/docs/erd.puml @@ -1,210 +1,211 @@ -@startuml Tanabata File Manager entity relationship diagram - -' skinparam linetype ortho - - -' ========== SYSTEM ========== - -entity "system.users" as usr { - * id : smallserial <> - -- - * name : varchar(32) - * password : text - * is_admin : boolean -} - -entity "system.mime" as mime { - * id : smallserial <> - -- - * name : varchar(127) - * extension : varchar(16) -} - - -' ========== DATA ========== - -entity "data.categories" as cty { - * id : uuid <> - -- - * name : varchar(256) - notes : text - color : char(6) - ' * created_at : timestamptz <> - * creator_id : smallint - ' * is_private : boolean -} - -cty::creator_id }o--|| usr::id - -entity "data.files" as fle { - * id : uuid <> - -- - name : varchar(256) - * mime_id : smallint - * datetime : timestamptz - notes : text - * metadata : jsonb - ' * created_at : timestamptz <> - * creator_id : smallint - ' * is_private : boolean -} - -fle::mime_id }o--|| mime::id -fle::creator_id }o--|| usr::id - -entity "data.tags" as tag { - * id : uuid <> - -- - * name : varchar(256) - notes : text - color : char(6) - category_id : uuid - ' * created_at : timestamptz <> - * creator_id : smallint - ' * is_private : boolean -} - -tag::category_id }o--o| cty::id -tag::creator_id }o--|| usr::id - -entity "data.file_tag" as ft { - * file_id : uuid - * tag_id : uuid -} - -ft::file_id }o--|| fle::id -ft::tag_id }o--|| tag::id - -entity "data.autotags" as atg { - * trigger_tag_id : uuid - * add_tag_id : uuid - -- - * is_active : boolean -} - -atg::trigger_tag_id }o--|| tag::id -atg::add_tag_id }o--|| tag::id - -entity "data.pools" as pool { - * id : uuid <> - -- - * name : varchar(256) - notes : text - ' parent_id : uuid - ' * created_at : timestamptz - * creator_id : smallint - ' * is_private : boolean -} - -pool::creator_id }o--|| usr::id -' pool::parent_id }o--o| pool::id - -entity "data.file_pool" as fp { - * file_id : uuid - * pool_id : uuid - * number : smallint -} - -fp::file_id }o--|| fle::id -fp::pool_id }o--|| pool::id - - -' ========== ACL ========== - -entity "acl.files" as acl_f { - * user_id : smallint - * file_id : uuid - -- - * view : boolean - * edit : boolean -} - -acl_f::user_id }o--|| usr::id -acl_f::file_id }o--|| fle::id - -entity "acl.tags" as acl_t { - * user_id : smallint - * tag_id : uuid - -- - * view : boolean - * edit : boolean - ' * files_view : boolean - ' * files_edit : boolean -} - -acl_t::user_id }o--|| usr::id -acl_t::tag_id }o--|| tag::id - -entity "acl.categories" as acl_c { - * user_id : smallint - * category_id : uuid - -- - * view : boolean - * edit : boolean - ' * tags_view : boolean - ' * tags_edit : boolean -} - -acl_c::user_id }o--|| usr::id -acl_c::category_id }o--|| cty::id - -entity "acl.pools" as acl_p { - * user_id : smallint - * pool_id : uuid - -- - * view : boolean - * edit : boolean - ' * files_view : boolean - ' * files_edit : boolean -} - -acl_p::user_id }o--|| usr::id -acl_p::pool_id }o--|| pool::id - - -' ========== ACTIVITY ========== - -entity "activity.sessions" as ssn { - * id : serial <> - -- - * token : text - * user_id : smallint - * user_agent : varchar(512) - * started_at : timestamptz - expires_at : timestamptz - * last_activity : timestamptz -} - -ssn::user_id }o--|| usr::id - -entity "activity.file_views" as fv { - * file_id : uuid - * timestamp : timestamptz - * user_id : smallint -} - -fv::file_id }o--|| fle::id -fv::user_id }o--|| usr::id - -entity "activity.tag_uses" as tu { - * tag_id : uuid - * timestamp : timestamptz - * user_id : smallint - -- - * included : boolean -} - -tu::tag_id }o--|| tag::id -tu::user_id }o--|| usr::id - -entity "activity.pool_views" as pv { - * pool_id : uuid - * timestamp : timestamptz - * user_id : smallint -} - -pv::pool_id }o--|| pool::id -pv::user_id }o--|| usr::id - - -@enduml +@startuml Tanabata File Manager entity relationship diagram + +' skinparam linetype ortho + + +' ========== SYSTEM ========== + +entity "system.users" as usr { + * id : smallserial <> + -- + * name : varchar(32) + * password : text + * is_admin : boolean +} + +entity "system.mime" as mime { + * id : smallserial <> + -- + * name : varchar(127) + * extension : varchar(16) +} + + +' ========== DATA ========== + +entity "data.categories" as cty { + * id : uuid <> + -- + * name : varchar(256) + notes : text + color : char(6) + ' * created_at : timestamptz <> + * creator_id : smallint + ' * is_private : boolean +} + +cty::creator_id }o--|| usr::id + +entity "data.files" as fle { + * id : uuid <> + -- + name : varchar(256) + * mime_id : smallint + * datetime : timestamptz + notes : text + * metadata : jsonb + ' * created_at : timestamptz <> + * creator_id : smallint + ' * is_private : boolean + * is_deleted : boolean +} + +fle::mime_id }o--|| mime::id +fle::creator_id }o--|| usr::id + +entity "data.tags" as tag { + * id : uuid <> + -- + * name : varchar(256) + notes : text + color : char(6) + category_id : uuid + ' * created_at : timestamptz <> + * creator_id : smallint + ' * is_private : boolean +} + +tag::category_id }o--o| cty::id +tag::creator_id }o--|| usr::id + +entity "data.file_tag" as ft { + * file_id : uuid + * tag_id : uuid +} + +ft::file_id }o--|| fle::id +ft::tag_id }o--|| tag::id + +entity "data.autotags" as atg { + * trigger_tag_id : uuid + * add_tag_id : uuid + -- + * is_active : boolean +} + +atg::trigger_tag_id }o--|| tag::id +atg::add_tag_id }o--|| tag::id + +entity "data.pools" as pool { + * id : uuid <> + -- + * name : varchar(256) + notes : text + ' parent_id : uuid + ' * created_at : timestamptz + * creator_id : smallint + ' * is_private : boolean +} + +pool::creator_id }o--|| usr::id +' pool::parent_id }o--o| pool::id + +entity "data.file_pool" as fp { + * file_id : uuid + * pool_id : uuid + * number : smallint +} + +fp::file_id }o--|| fle::id +fp::pool_id }o--|| pool::id + + +' ========== ACL ========== + +entity "acl.files" as acl_f { + * user_id : smallint + * file_id : uuid + -- + * view : boolean + * edit : boolean +} + +acl_f::user_id }o--|| usr::id +acl_f::file_id }o--|| fle::id + +entity "acl.tags" as acl_t { + * user_id : smallint + * tag_id : uuid + -- + * view : boolean + * edit : boolean + ' * files_view : boolean + ' * files_edit : boolean +} + +acl_t::user_id }o--|| usr::id +acl_t::tag_id }o--|| tag::id + +entity "acl.categories" as acl_c { + * user_id : smallint + * category_id : uuid + -- + * view : boolean + * edit : boolean + ' * tags_view : boolean + ' * tags_edit : boolean +} + +acl_c::user_id }o--|| usr::id +acl_c::category_id }o--|| cty::id + +entity "acl.pools" as acl_p { + * user_id : smallint + * pool_id : uuid + -- + * view : boolean + * edit : boolean + ' * files_view : boolean + ' * files_edit : boolean +} + +acl_p::user_id }o--|| usr::id +acl_p::pool_id }o--|| pool::id + + +' ========== ACTIVITY ========== + +entity "activity.sessions" as ssn { + * id : serial <> + -- + * token : text + * user_id : smallint + * user_agent : varchar(512) + * started_at : timestamptz + expires_at : timestamptz + * last_activity : timestamptz +} + +ssn::user_id }o--|| usr::id + +entity "activity.file_views" as fv { + * file_id : uuid + * timestamp : timestamptz + * user_id : smallint +} + +fv::file_id }o--|| fle::id +fv::user_id }o--|| usr::id + +entity "activity.tag_uses" as tu { + * tag_id : uuid + * timestamp : timestamptz + * user_id : smallint + -- + * included : boolean +} + +tu::tag_id }o--|| tag::id +tu::user_id }o--|| usr::id + +entity "activity.pool_views" as pv { + * pool_id : uuid + * timestamp : timestamptz + * user_id : smallint +} + +pv::pool_id }o--|| pool::id +pv::user_id }o--|| usr::id + + +@enduml