From 1c013183f0b09b9cac16a48efe0befc6e60919a7 Mon Sep 17 00:00:00 2001 From: Masahiko AMANO Date: Wed, 2 Jul 2025 20:14:09 +0300 Subject: [PATCH] docs(erd): addsurrogate PK to `mime` table and change some ID types to numeric --- docs/erd.puml | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/docs/erd.puml b/docs/erd.puml index 34d0698..bc073e3 100644 --- a/docs/erd.puml +++ b/docs/erd.puml @@ -6,7 +6,7 @@ ' ========== SYSTEM ========== entity "system.users" as usr { - * id : uuid <> + * id : smallserial <> -- * name : varchar(32) * password : text @@ -14,8 +14,9 @@ entity "system.users" as usr { } entity "system.mime" as mime { - * name : varchar(127) + * id : smallserial <> -- + * name : varchar(127) * extension : varchar(16) } @@ -29,7 +30,7 @@ entity "data.categories" as cty { notes : text color : char(6) * created_at : timestamptz <> - * creator_id : uuid + * creator_id : smallint ' * is_private : boolean } @@ -39,16 +40,16 @@ entity "data.files" as fle { * id : uuid <> -- name : varchar(256) - * mime : varchar(127) + * mime_id : smallint * datetime : timestamptz notes : text * metadata : jsonb * created_at : timestamptz <> - * creator_id : uuid + * creator_id : smallint ' * is_private : boolean } -fle::mime }o--|| mime::name +fle::mime_id }o--|| mime::id fle::creator_id }o--|| usr::id entity "data.tags" as tag { @@ -59,7 +60,7 @@ entity "data.tags" as tag { color : char(6) category_id : uuid * created_at : timestamptz <> - * creator_id : uuid + * creator_id : smallint ' * is_private : boolean } @@ -91,7 +92,7 @@ entity "data.pools" as pool { notes : text ' parent_id : uuid * created_at : timestamptz - * creator_id : uuid + * creator_id : smallint ' * is_private : boolean } @@ -101,7 +102,7 @@ pool::creator_id }o--|| usr::id entity "data.file_pool" as fp { * file_id : uuid * pool_id : uuid - * number : integer + * number : smallint } fp::file_id }o--|| fle::id @@ -111,7 +112,7 @@ fp::pool_id }o--|| pool::id ' ========== ACCESS ========== entity "access.files" as acl_f { - * user_id : uuid + * user_id : smallint * file_id : uuid -- * read : boolean @@ -122,7 +123,7 @@ acl_f::user_id }o--|| usr::id acl_f::file_id }o--|| fle::id entity "access.tags" as acl_t { - * user_id : uuid + * user_id : smallint * tag_id : uuid -- * read : boolean @@ -135,7 +136,7 @@ acl_t::user_id }o--|| usr::id acl_t::tag_id }o--|| tag::id entity "access.categories" as acl_c { - * user_id : uuid + * user_id : smallint * category_id : uuid -- * read : boolean @@ -148,7 +149,7 @@ acl_c::user_id }o--|| usr::id acl_c::category_id }o--|| cty::id entity "access.pools" as acl_p { - * user_id : uuid + * user_id : smallint * pool_id : uuid -- * read : boolean @@ -166,7 +167,7 @@ acl_p::pool_id }o--|| pool::id entity "activity.sessions" as ssn { * id : uuid <> -- - * user_id : uuid + * user_id : smallint * user_agent : varchar(512) * started_at : timestamptz expires_at : timestamptz @@ -178,7 +179,7 @@ ssn::user_id }o--|| usr::id entity "activity.file_views" as fv { * file_id : uuid * timestamp : timestamptz - * user_id : uuid + * user_id : smallint } fv::file_id }o--|| fle::id @@ -187,7 +188,7 @@ fv::user_id }o--|| usr::id entity "activity.tag_uses" as tu { * tag_id : uuid * timestamp : timestamptz - * user_id : uuid + * user_id : smallint -- * included : boolean } @@ -198,7 +199,7 @@ tu::user_id }o--|| usr::id entity "activity.pool_views" as pv { * pool_id : uuid * timestamp : timestamptz - * user_id : uuid + * user_id : smallint } pv::pool_id }o--|| pool::id