diff --git a/doc/Django博客系统数据模型设计文档.docx b/doc/Django博客系统数据模型设计文档.docx new file mode 100644 index 0000000..5d21d0e Binary files /dev/null and b/doc/Django博客系统数据模型设计文档.docx differ diff --git a/doc/images/graph_10.png b/doc/images/graph_10.png new file mode 100644 index 0000000..450bec9 Binary files /dev/null and b/doc/images/graph_10.png differ diff --git a/doc/images/graph_9.png b/doc/images/graph_9.png new file mode 100644 index 0000000..4aa90c8 Binary files /dev/null and b/doc/images/graph_9.png differ diff --git a/doc/mermaid/graph_10.mmd b/doc/mermaid/graph_10.mmd new file mode 100644 index 0000000..40082d3 --- /dev/null +++ b/doc/mermaid/graph_10.mmd @@ -0,0 +1,162 @@ +--- +config: + layout: elk +--- +erDiagram + BlogUser { + int id PK + string username + string email + string nickname + datetime creation_time + datetime last_modify_time + string source + } + + Article { + int id PK + string title + text body + datetime pub_time + char status + char comment_status + char type + int views + int author_id FK + int article_order + boolean show_toc + int category_id FK + } + + Category { + int id PK + string name + int parent_category_id FK + string slug + int index + } + + Tag { + int id PK + string name + string slug + } + + Comment { + int id PK + text body + datetime creation_time + datetime last_modify_time + int author_id FK + int article_id FK + int parent_comment_id FK + boolean is_enable + } + + OAuthUser { + int id PK + int author_id FK + string openid + string nickname + string token + string picture + string type + string email + text metadata + datetime creation_time + datetime last_modify_time + } + + OAuthConfig { + int id PK + string type + string appkey + string appsecret + string callback_url + boolean is_enable + datetime creation_time + datetime last_modify_time + } + + BlogSettings { + int id PK + string site_name + text site_description + text site_seo_description + text site_keywords + int article_sub_length + int sidebar_article_count + int sidebar_comment_count + int article_comment_count + boolean show_google_adsense + text google_adsense_codes + boolean open_site_comment + text global_header + text global_footer + string beian_code + text analytics_code + boolean show_gongan_code + text gongan_beiancode + boolean comment_need_review + } + + SideBar { + int id PK + string name + text content + int sequence + boolean is_enable + datetime creation_time + datetime last_mod_time + } + + Links { + int id PK + string name + string link + int sequence + boolean is_enable + char show_type + datetime creation_time + datetime last_mod_time + } + + OwnTrackLog { + int id PK + string tid + float lat + float lon + datetime creation_time + } + + commands { + int id PK + string title + string command + string describe + datetime creation_time + datetime last_modify_time + } + + EmailSendLog { + int id PK + string emailto + string title + text content + boolean send_result + datetime creation_time + } + + BlogUser ||--o{ Article : "作者发表" + BlogUser ||--o{ Comment : "用户评论" + BlogUser ||--o{ OAuthUser : "关联第三方账号" + + Article ||--o{ Comment : "文章拥有评论" + Article }o--|| Category : "属于分类" + Article }o--o{ Tag : "包含标签" + + Category ||--o{ Category : "父分类" + + Comment ||--o{ Comment : "父评论" + + OAuthUser }o--|| OAuthConfig : "使用配置" \ No newline at end of file diff --git a/doc/mermaid/graph_9.dot b/doc/mermaid/graph_9.dot new file mode 100644 index 0000000..caf0781 --- /dev/null +++ b/doc/mermaid/graph_9.dot @@ -0,0 +1,53 @@ +digraph "djangoblog" { + +splines = ortho; +fontname = "Inconsolata"; + +node [colorscheme = ylgnbu4]; +edge [colorscheme = dark28, dir = both]; + +accounts_bloguser [shape = record, pos = "6.458,23.583!" , label = "{ accounts_bloguser | password : varchar(128)\l last_login : datetime(6)\l is_superuser : tinyint(1)\l username : varchar(150)\l first_name : varchar(150)\l last_name : varchar(150)\l email : varchar(254)\l is_staff : tinyint(1)\l is_active : tinyint(1)\l date_joined : datetime(6)\l nickname : varchar(100)\l source : varchar(100)\l creation_time : datetime(6)\l last_modify_time : datetime(6)\l| id : bigint(20)\l }"]; +accounts_bloguser_groups [shape = record, pos = "2.597,19.375!" , label = "{ accounts_bloguser_groups | bloguser_id : bigint(20)\l group_id : int(11)\l| id : bigint(20)\l }"]; +accounts_bloguser_user_permissions [shape = record, pos = "1.444,22.750!" , label = "{ accounts_bloguser_user_permissions | bloguser_id : bigint(20)\l permission_id : int(11)\l| id : bigint(20)\l }"]; +auth_group [shape = record, pos = "0.069,19.778!" , label = "{ auth_group | name : varchar(150)\l| id : int(11)\l }"]; +auth_group_permissions [shape = record, pos = "-2.167,22.111!" , label = "{ auth_group_permissions | group_id : int(11)\l permission_id : int(11)\l| id : bigint(20)\l }"]; +auth_permission [shape = record, pos = "-0.556,25.153!" , label = "{ auth_permission | name : varchar(255)\l content_type_id : int(11)\l codename : varchar(100)\l| id : int(11)\l }"]; +blog_article [shape = record, pos = "10.875,25.528!" , label = "{ blog_article | title : varchar(200)\l body : longtext\l pub_time : datetime(6)\l status : varchar(1)\l comment_status : varchar(1)\l type : varchar(1)\l views : int(10) unsigned\l article_order : int(11)\l show_toc : tinyint(1)\l author_id : bigint(20)\l category_id : int(11)\l creation_time : datetime(6)\l last_modify_time : datetime(6)\l| id : int(11)\l }"]; +blog_article_tags [shape = record, pos = "14.750,22.736!" , label = "{ blog_article_tags | article_id : int(11)\l tag_id : int(11)\l| id : bigint(20)\l }"]; +blog_blogsettings [shape = record, pos = "-2.167,12.972!" , label = "{ blog_blogsettings | site_name : varchar(200)\l site_description : longtext\l site_seo_description : longtext\l site_keywords : longtext\l article_sub_length : int(11)\l sidebar_article_count : int(11)\l sidebar_comment_count : int(11)\l article_comment_count : int(11)\l show_google_adsense : tinyint(1)\l google_adsense_codes : longtext\l open_site_comment : tinyint(1)\l beian_code : varchar(2000)\l analytics_code : longtext\l show_gongan_code : tinyint(1)\l gongan_beiancode : longtext\l global_footer : longtext\l global_header : longtext\l comment_need_review : tinyint(1)\l| id : bigint(20)\l }"]; +blog_category [shape = record, pos = "12.556,28.889!" , label = "{ blog_category | name : varchar(30)\l slug : varchar(60)\l index : int(11)\l parent_category_id : int(11)\l creation_time : datetime(6)\l last_modify_time : datetime(6)\l| id : int(11)\l }"]; +blog_links [shape = record, pos = "5.097,12.972!" , label = "{ blog_links | name : varchar(30)\l link : varchar(200)\l sequence : int(11)\l is_enable : tinyint(1)\l show_type : varchar(1)\l last_mod_time : datetime(6)\l creation_time : datetime(6)\l| id : bigint(20)\l }"]; +blog_sidebar [shape = record, pos = "8.361,12.972!" , label = "{ blog_sidebar | name : varchar(100)\l content : longtext\l sequence : int(11)\l is_enable : tinyint(1)\l last_mod_time : datetime(6)\l creation_time : datetime(6)\l| id : bigint(20)\l }"]; +blog_tag [shape = record, pos = "17.569,22.014!" , label = "{ blog_tag | name : varchar(30)\l slug : varchar(60)\l creation_time : datetime(6)\l last_modify_time : datetime(6)\l| id : int(11)\l }"]; +comments_comment [shape = record, pos = "10.292,19.931!" , label = "{ comments_comment | body : longtext\l is_enable : tinyint(1)\l article_id : int(11)\l author_id : bigint(20)\l parent_comment_id : bigint(20)\l creation_time : datetime(6)\l last_modify_time : datetime(6)\l| id : bigint(20)\l }"]; +django_admin_log [shape = record, pos = "4.917,27.264!" , label = "{ django_admin_log | action_time : datetime(6)\l object_id : longtext\l object_repr : varchar(200)\l action_flag : smallint(5) unsigned\l change_message : longtext\l content_type_id : int(11)\l user_id : bigint(20)\l| id : int(11)\l }"]; +django_content_type [shape = record, pos = "1.625,27.236!" , label = "{ django_content_type | app_label : varchar(100)\l model : varchar(100)\l| id : int(11)\l }"]; +django_migrations [shape = record, pos = "-2.167,5.722!" , label = "{ django_migrations | app : varchar(255)\l name : varchar(255)\l applied : datetime(6)\l| id : bigint(20)\l }"]; +django_session [shape = record, pos = "0.917,5.722!" , label = "{ django_session | session_data : longtext\l expire_date : datetime(6)\l| session_key : varchar(40)\l }"]; +django_site [shape = record, pos = "3.931,5.722!" , label = "{ django_site | domain : varchar(100)\l name : varchar(50)\l| id : int(11)\l }"]; +oauth_oauthconfig [shape = record, pos = "1.611,12.972!" , label = "{ oauth_oauthconfig | type : varchar(10)\l appkey : varchar(200)\l appsecret : varchar(200)\l callback_url : varchar(200)\l is_enable : tinyint(1)\l creation_time : datetime(6)\l last_modify_time : datetime(6)\l| id : bigint(20)\l }"]; +oauth_oauthuser [shape = record, pos = "6.472,17.667!" , label = "{ oauth_oauthuser | openid : varchar(50)\l nickname : varchar(50)\l token : varchar(150)\l picture : varchar(350)\l type : varchar(50)\l email : varchar(50)\l metadata : longtext\l author_id : bigint(20)\l creation_time : datetime(6)\l last_modify_time : datetime(6)\l| id : bigint(20)\l }"]; +owntracks_owntracklog [shape = record, pos = "19.708,12.972!" , label = "{ owntracks_owntracklog | tid : varchar(100)\l lat : double\l lon : double\l creation_time : datetime(6)\l| id : bigint(20)\l }"]; +servermanager_commands [shape = record, pos = "15.792,12.972!" , label = "{ servermanager_commands | title : varchar(300)\l command : varchar(2000)\l describe : varchar(300)\l creation_time : datetime(6)\l last_modify_time : datetime(6)\l| id : bigint(20)\l }"]; +servermanager_emailsendlog [shape = record, pos = "11.625,12.972!" , label = "{ servermanager_emailsendlog | emailto : varchar(300)\l title : varchar(2000)\l content : longtext\l send_result : tinyint(1)\l creation_time : datetime(6)\l| id : bigint(20)\l }"]; + +accounts_bloguser_groups -> accounts_bloguser [color = "#595959", style = solid , arrowtail = none , arrowhead = normal , taillabel = "", label = "bloguser_id:id", headlabel = ""]; +accounts_bloguser_groups -> auth_group [color = "#595959", style = solid , arrowtail = none , arrowhead = normal , taillabel = "", label = "group_id:id", headlabel = ""]; +accounts_bloguser_user_permissions -> accounts_bloguser [color = "#595959", style = solid , arrowtail = none , arrowhead = normal , taillabel = "", label = "bloguser_id:id", headlabel = ""]; +accounts_bloguser_user_permissions -> auth_permission [color = "#595959", style = solid , arrowtail = none , arrowhead = normal , taillabel = "", label = "permission_id:id", headlabel = ""]; +auth_group_permissions -> auth_group [color = "#595959", style = solid , arrowtail = none , arrowhead = normal , taillabel = "", label = "group_id:id", headlabel = ""]; +auth_group_permissions -> auth_permission [color = "#595959", style = solid , arrowtail = none , arrowhead = normal , taillabel = "", label = "permission_id:id", headlabel = ""]; +auth_permission -> django_content_type [color = "#595959", style = solid , arrowtail = none , arrowhead = normal , taillabel = "", label = "content_type_id:id", headlabel = ""]; +blog_article -> accounts_bloguser [color = "#595959", style = solid , arrowtail = none , arrowhead = normal , taillabel = "", label = "author_id:id", headlabel = ""]; +blog_article -> blog_category [color = "#595959", style = solid , arrowtail = none , arrowhead = normal , taillabel = "", label = "category_id:id", headlabel = ""]; +blog_article_tags -> blog_article [color = "#595959", style = solid , arrowtail = none , arrowhead = normal , taillabel = "", label = "article_id:id", headlabel = ""]; +blog_article_tags -> blog_tag [color = "#595959", style = solid , arrowtail = none , arrowhead = normal , taillabel = "", label = "tag_id:id", headlabel = ""]; +blog_category -> blog_category [color = "#595959", style = solid , arrowtail = none , arrowhead = normal , taillabel = "", label = "parent_category_id:id", headlabel = ""]; +comments_comment -> accounts_bloguser [color = "#595959", style = solid , arrowtail = none , arrowhead = normal , taillabel = "", label = "author_id:id", headlabel = ""]; +comments_comment -> blog_article [color = "#595959", style = solid , arrowtail = none , arrowhead = normal , taillabel = "", label = "article_id:id", headlabel = ""]; +comments_comment -> comments_comment [color = "#595959", style = solid , arrowtail = none , arrowhead = normal , taillabel = "", label = "parent_comment_id:id", headlabel = ""]; +django_admin_log -> accounts_bloguser [color = "#595959", style = solid , arrowtail = none , arrowhead = normal , taillabel = "", label = "user_id:id", headlabel = ""]; +django_admin_log -> django_content_type [color = "#595959", style = solid , arrowtail = none , arrowhead = normal , taillabel = "", label = "content_type_id:id", headlabel = ""]; +oauth_oauthuser -> accounts_bloguser [color = "#595959", style = solid , arrowtail = none , arrowhead = normal , taillabel = "", label = "author_id:id", headlabel = ""]; + +}