From 15cda1aab433dfe84853d65883c9e4413771d239 Mon Sep 17 00:00:00 2001 From: ZOI-dayo Date: Sat, 28 Dec 2024 16:31:42 +0900 Subject: [PATCH] regenerate db docs --- docs/dbschema/README.md | 13 ++++++------- docs/dbschema/contest_team_user_belongings.md | 2 +- docs/dbschema/contest_teams.md | 8 ++++---- docs/dbschema/contests.md | 8 ++++---- docs/dbschema/project_members.md | 17 ++++++----------- docs/dbschema/projects.md | 11 +++++------ docs/dbschema/schema.json | 2 +- docs/dbschema/users.md | 5 ++--- 8 files changed, 29 insertions(+), 37 deletions(-) diff --git a/docs/dbschema/README.md b/docs/dbschema/README.md index b2c976c1..e2125846 100644 --- a/docs/dbschema/README.md +++ b/docs/dbschema/README.md @@ -14,7 +14,7 @@ | [group_user_belongings](group_user_belongings.md) | 8 | グループとユーザー関係テーブル | BASE TABLE | | [migrations](migrations.md) | 1 | gormigrate用のデータベースバージョンテーブル | BASE TABLE | | [projects](projects.md) | 10 | プロジェクトテーブル | BASE TABLE | -| [project_members](project_members.md) | 9 | プロジェクト所属者テーブル | BASE TABLE | +| [project_members](project_members.md) | 8 | プロジェクト所属者テーブル | BASE TABLE | | [users](users.md) | 7 | ユーザーテーブル | BASE TABLE | ## Relations @@ -44,7 +44,7 @@ erDiagram } "contests" { char_36_ id PK - varchar_32_ name + varchar_128_ name text description text link datetime_6_ since @@ -55,7 +55,7 @@ erDiagram "contest_teams" { char_36_ id PK char_36_ contest_id FK - varchar_32_ name + varchar_128_ name text description text result text link @@ -103,7 +103,7 @@ erDiagram } "projects" { char_36_ id PK - varchar_32_ name + varchar_128_ name text description text link smallint_4_ since_year @@ -114,9 +114,8 @@ erDiagram datetime_6_ updated_at } "project_members" { - char_36_ id PK - char_36_ project_id FK - char_36_ user_id FK + char_36_ project_id PK + char_36_ user_id PK smallint_4_ since_year tinyint_1_ since_semester smallint_4_ until_year diff --git a/docs/dbschema/contest_team_user_belongings.md b/docs/dbschema/contest_team_user_belongings.md index 280f9e81..57f2102e 100644 --- a/docs/dbschema/contest_team_user_belongings.md +++ b/docs/dbschema/contest_team_user_belongings.md @@ -63,7 +63,7 @@ erDiagram "contest_teams" { char_36_ id PK char_36_ contest_id FK - varchar_32_ name + varchar_128_ name text description text result text link diff --git a/docs/dbschema/contest_teams.md b/docs/dbschema/contest_teams.md index c87e265c..20f997c3 100644 --- a/docs/dbschema/contest_teams.md +++ b/docs/dbschema/contest_teams.md @@ -11,7 +11,7 @@ CREATE TABLE `contest_teams` ( `id` char(36) NOT NULL, `contest_id` char(36) NOT NULL, - `name` varchar(32) DEFAULT NULL, + `name` varchar(128) DEFAULT NULL, `description` text DEFAULT NULL, `result` text DEFAULT NULL, `link` text DEFAULT NULL, @@ -31,7 +31,7 @@ CREATE TABLE `contest_teams` ( | ---- | ---- | ------- | -------- | -------- | ------- | ------- | | id | char(36) | | false | [contest_team_user_belongings](contest_team_user_belongings.md) | | コンテストチームUUID | | contest_id | char(36) | | false | | [contests](contests.md) | コンテストUUID | -| name | varchar(32) | NULL | true | | | チーム名 | +| name | varchar(128) | NULL | true | | | チーム名 | | description | text | NULL | true | | | チーム情報 | | result | text | NULL | true | | | 順位などの結果 | | link | text | NULL | true | | | コンテストチームの詳細が載っているページへのリンク | @@ -63,7 +63,7 @@ erDiagram "contest_teams" { char_36_ id PK char_36_ contest_id FK - varchar_32_ name + varchar_128_ name text description text result text link @@ -78,7 +78,7 @@ erDiagram } "contests" { char_36_ id PK - varchar_32_ name + varchar_128_ name text description text link datetime_6_ since diff --git a/docs/dbschema/contests.md b/docs/dbschema/contests.md index cc88df90..5a0d53cd 100644 --- a/docs/dbschema/contests.md +++ b/docs/dbschema/contests.md @@ -10,7 +10,7 @@ ```sql CREATE TABLE `contests` ( `id` char(36) NOT NULL, - `name` varchar(32) DEFAULT NULL, + `name` varchar(128) DEFAULT NULL, `description` text DEFAULT NULL, `link` text DEFAULT NULL, `since` datetime(6) DEFAULT NULL, @@ -28,7 +28,7 @@ CREATE TABLE `contests` ( | Name | Type | Default | Nullable | Children | Parents | Comment | | ---- | ---- | ------- | -------- | -------- | ------- | ------- | | id | char(36) | | false | [contest_teams](contest_teams.md) | | コンテストUUID | -| name | varchar(32) | NULL | true | | | コンテスト名 | +| name | varchar(128) | NULL | true | | | コンテスト名 | | description | text | NULL | true | | | コンテスト説明 | | link | text | NULL | true | | | コンテスト情報のリンク | | since | datetime(6) | NULL | true | | | 期間始まり | @@ -57,7 +57,7 @@ erDiagram "contests" { char_36_ id PK - varchar_32_ name + varchar_128_ name text description text link datetime_6_ since @@ -68,7 +68,7 @@ erDiagram "contest_teams" { char_36_ id PK char_36_ contest_id FK - varchar_32_ name + varchar_128_ name text description text result text link diff --git a/docs/dbschema/project_members.md b/docs/dbschema/project_members.md index c2b99093..cfd97267 100644 --- a/docs/dbschema/project_members.md +++ b/docs/dbschema/project_members.md @@ -9,7 +9,6 @@ ```sql CREATE TABLE `project_members` ( - `id` char(36) NOT NULL, `project_id` char(36) NOT NULL, `user_id` char(36) NOT NULL, `since_year` smallint(4) NOT NULL, @@ -18,8 +17,7 @@ CREATE TABLE `project_members` ( `until_semester` tinyint(1) NOT NULL, `created_at` datetime(6) DEFAULT NULL, `updated_at` datetime(6) DEFAULT NULL, - PRIMARY KEY (`id`), - KEY `fk_project_members_project` (`project_id`), + PRIMARY KEY (`project_id`,`user_id`), KEY `fk_project_members_user` (`user_id`), CONSTRAINT `fk_project_members_project` FOREIGN KEY (`project_id`) REFERENCES `projects` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `fk_project_members_user` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE @@ -32,7 +30,6 @@ CREATE TABLE `project_members` ( | Name | Type | Default | Nullable | Children | Parents | Comment | | ---- | ---- | ------- | -------- | -------- | ------- | ------- | -| id | char(36) | | false | | | | | project_id | char(36) | | false | | [projects](projects.md) | プロジェクトUUID | | user_id | char(36) | | false | | [users](users.md) | ユーザーUUID | | since_year | smallint(4) | | false | | | プロジェクト所属開始年 | @@ -48,15 +45,14 @@ CREATE TABLE `project_members` ( | ---- | ---- | ---------- | | fk_project_members_project | FOREIGN KEY | FOREIGN KEY (project_id) REFERENCES projects (id) | | fk_project_members_user | FOREIGN KEY | FOREIGN KEY (user_id) REFERENCES users (id) | -| PRIMARY | PRIMARY KEY | PRIMARY KEY (id) | +| PRIMARY | PRIMARY KEY | PRIMARY KEY (project_id, user_id) | ## Indexes | Name | Definition | | ---- | ---------- | -| fk_project_members_project | KEY fk_project_members_project (project_id) USING BTREE | | fk_project_members_user | KEY fk_project_members_user (user_id) USING BTREE | -| PRIMARY | PRIMARY KEY (id) USING BTREE | +| PRIMARY | PRIMARY KEY (project_id, user_id) USING BTREE | ## Relations @@ -67,9 +63,8 @@ erDiagram "project_members" }o--|| "users" : "FOREIGN KEY (user_id) REFERENCES users (id)" "project_members" { - char_36_ id PK - char_36_ project_id FK - char_36_ user_id FK + char_36_ project_id PK + char_36_ user_id PK smallint_4_ since_year tinyint_1_ since_semester smallint_4_ until_year @@ -79,7 +74,7 @@ erDiagram } "projects" { char_36_ id PK - varchar_32_ name + varchar_128_ name text description text link smallint_4_ since_year diff --git a/docs/dbschema/projects.md b/docs/dbschema/projects.md index 70aeb6da..3353f4b7 100644 --- a/docs/dbschema/projects.md +++ b/docs/dbschema/projects.md @@ -10,7 +10,7 @@ ```sql CREATE TABLE `projects` ( `id` char(36) NOT NULL, - `name` varchar(32) DEFAULT NULL, + `name` varchar(128) DEFAULT NULL, `description` text DEFAULT NULL, `link` text DEFAULT NULL, `since_year` smallint(4) NOT NULL, @@ -30,7 +30,7 @@ CREATE TABLE `projects` ( | Name | Type | Default | Nullable | Children | Parents | Comment | | ---- | ---- | ------- | -------- | -------- | ------- | ------- | | id | char(36) | | false | [project_members](project_members.md) | | プロジェクトUUID | -| name | varchar(32) | NULL | true | | | プロジェクト名 | +| name | varchar(128) | NULL | true | | | プロジェクト名 | | description | text | NULL | true | | | プロジェクト説明 | | link | text | NULL | true | | | プロジェクト情報のリンク | | since_year | smallint(4) | | false | | | プロジェクト開始年 | @@ -61,7 +61,7 @@ erDiagram "projects" { char_36_ id PK - varchar_32_ name + varchar_128_ name text description text link smallint_4_ since_year @@ -72,9 +72,8 @@ erDiagram datetime_6_ updated_at } "project_members" { - char_36_ id PK - char_36_ project_id FK - char_36_ user_id FK + char_36_ project_id PK + char_36_ user_id PK smallint_4_ since_year tinyint_1_ since_semester smallint_4_ until_year diff --git a/docs/dbschema/schema.json b/docs/dbschema/schema.json index 23017333..163e5371 100644 --- a/docs/dbschema/schema.json +++ b/docs/dbschema/schema.json @@ -1 +1 @@ -{"name":"portfolio","desc":"","tables":[{"name":"accounts","type":"BASE TABLE","comment":"Twitterなどのアカウントテーブル","columns":[{"name":"id","type":"char(36)","nullable":false,"default":null,"comment":"アカウントUUID"},{"name":"type","type":"tinyint(1)","nullable":false,"default":null,"comment":"アカウントのハードコードID"},{"name":"name","type":"varchar(256)","nullable":true,"default":"NULL","comment":"アカウント名"},{"name":"url","type":"text","nullable":true,"default":"NULL","comment":"アカウントのURL"},{"name":"user_id","type":"char(36)","nullable":false,"default":null,"comment":"ユーザーUUID"},{"name":"check","type":"tinyint(1)","nullable":false,"default":"0","comment":"公開可能かどうか"},{"name":"created_at","type":"datetime(6)","nullable":true,"default":"NULL","comment":""},{"name":"updated_at","type":"datetime(6)","nullable":true,"default":"NULL","comment":""}],"indexes":[{"name":"fk_users_accounts","def":"KEY fk_users_accounts (user_id) USING BTREE","table":"accounts","columns":["user_id"],"comment":""},{"name":"PRIMARY","def":"PRIMARY KEY (id) USING BTREE","table":"accounts","columns":["id"],"comment":""}],"constraints":[{"name":"fk_users_accounts","type":"FOREIGN KEY","def":"FOREIGN KEY (user_id) REFERENCES users (id)","table":"accounts","referenced_table":"users","columns":["user_id"],"referenced_columns":["id"],"comment":""},{"name":"PRIMARY","type":"PRIMARY KEY","def":"PRIMARY KEY (id)","table":"accounts","referenced_table":null,"columns":["id"],"referenced_columns":null,"comment":""}],"triggers":[],"def":"CREATE TABLE `accounts` (\n `id` char(36) NOT NULL,\n `type` tinyint(1) NOT NULL,\n `name` varchar(256) DEFAULT NULL,\n `url` text DEFAULT NULL,\n `user_id` char(36) NOT NULL,\n `check` tinyint(1) NOT NULL DEFAULT 0,\n `created_at` datetime(6) DEFAULT NULL,\n `updated_at` datetime(6) DEFAULT NULL,\n PRIMARY KEY (`id`),\n KEY `fk_users_accounts` (`user_id`),\n CONSTRAINT `fk_users_accounts` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3"},{"name":"contests","type":"BASE TABLE","comment":"コンテストテーブル","columns":[{"name":"id","type":"char(36)","nullable":false,"default":null,"comment":"コンテストUUID"},{"name":"name","type":"varchar(32)","nullable":true,"default":"NULL","comment":"コンテスト名"},{"name":"description","type":"text","nullable":true,"default":"NULL","comment":"コンテスト説明"},{"name":"link","type":"text","nullable":true,"default":"NULL","comment":"コンテスト情報のリンク"},{"name":"since","type":"datetime(6)","nullable":true,"default":"NULL","comment":"期間始まり"},{"name":"until","type":"datetime(6)","nullable":true,"default":"NULL","comment":"期間終わり"},{"name":"created_at","type":"datetime(6)","nullable":true,"default":"NULL","comment":"コンテスト作成日時"},{"name":"updated_at","type":"datetime(6)","nullable":true,"default":"NULL","comment":"コンテスト更新日時"}],"indexes":[{"name":"PRIMARY","def":"PRIMARY KEY (id) USING BTREE","table":"contests","columns":["id"],"comment":""}],"constraints":[{"name":"PRIMARY","type":"PRIMARY KEY","def":"PRIMARY KEY (id)","table":"contests","referenced_table":null,"columns":["id"],"referenced_columns":null,"comment":""}],"triggers":[],"def":"CREATE TABLE `contests` (\n `id` char(36) NOT NULL,\n `name` varchar(32) DEFAULT NULL,\n `description` text DEFAULT NULL,\n `link` text DEFAULT NULL,\n `since` datetime(6) DEFAULT NULL,\n `until` datetime(6) DEFAULT NULL,\n `created_at` datetime(6) DEFAULT NULL,\n `updated_at` datetime(6) DEFAULT NULL,\n PRIMARY KEY (`id`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3"},{"name":"contest_teams","type":"BASE TABLE","comment":"コンテスト参加チームテーブル","columns":[{"name":"id","type":"char(36)","nullable":false,"default":null,"comment":"コンテストチームUUID"},{"name":"contest_id","type":"char(36)","nullable":false,"default":null,"comment":"コンテストUUID"},{"name":"name","type":"varchar(32)","nullable":true,"default":"NULL","comment":"チーム名"},{"name":"description","type":"text","nullable":true,"default":"NULL","comment":"チーム情報"},{"name":"result","type":"text","nullable":true,"default":"NULL","comment":"順位などの結果"},{"name":"link","type":"text","nullable":true,"default":"NULL","comment":"コンテストチームの詳細が載っているページへのリンク"},{"name":"created_at","type":"datetime(6)","nullable":true,"default":"NULL","comment":"コンテストチーム作成日時"},{"name":"updated_at","type":"datetime(6)","nullable":true,"default":"NULL","comment":"コンテストチーム更新日時"}],"indexes":[{"name":"fk_contest_teams_contest","def":"KEY fk_contest_teams_contest (contest_id) USING BTREE","table":"contest_teams","columns":["contest_id"],"comment":""},{"name":"PRIMARY","def":"PRIMARY KEY (id) USING BTREE","table":"contest_teams","columns":["id"],"comment":""}],"constraints":[{"name":"fk_contest_teams_contest","type":"FOREIGN KEY","def":"FOREIGN KEY (contest_id) REFERENCES contests (id)","table":"contest_teams","referenced_table":"contests","columns":["contest_id"],"referenced_columns":["id"],"comment":""},{"name":"PRIMARY","type":"PRIMARY KEY","def":"PRIMARY KEY (id)","table":"contest_teams","referenced_table":null,"columns":["id"],"referenced_columns":null,"comment":""}],"triggers":[],"def":"CREATE TABLE `contest_teams` (\n `id` char(36) NOT NULL,\n `contest_id` char(36) NOT NULL,\n `name` varchar(32) DEFAULT NULL,\n `description` text DEFAULT NULL,\n `result` text DEFAULT NULL,\n `link` text DEFAULT NULL,\n `created_at` datetime(6) DEFAULT NULL,\n `updated_at` datetime(6) DEFAULT NULL,\n PRIMARY KEY (`id`),\n KEY `fk_contest_teams_contest` (`contest_id`),\n CONSTRAINT `fk_contest_teams_contest` FOREIGN KEY (`contest_id`) REFERENCES `contests` (`id`) ON DELETE CASCADE ON UPDATE CASCADE\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3"},{"name":"contest_team_user_belongings","type":"BASE TABLE","comment":"コンテストチームとユーザー関係テーブル","columns":[{"name":"team_id","type":"char(36)","nullable":false,"default":null,"comment":"コンテストチームUUID"},{"name":"user_id","type":"char(36)","nullable":false,"default":null,"comment":"ユーザーUUID"},{"name":"created_at","type":"datetime(6)","nullable":true,"default":"NULL","comment":"関係テーブル作成日時"},{"name":"updated_at","type":"datetime(6)","nullable":true,"default":"NULL","comment":"関係テーブル更新日時"}],"indexes":[{"name":"fk_contest_team_user_belongings_user","def":"KEY fk_contest_team_user_belongings_user (user_id) USING BTREE","table":"contest_team_user_belongings","columns":["user_id"],"comment":""},{"name":"PRIMARY","def":"PRIMARY KEY (team_id, user_id) USING BTREE","table":"contest_team_user_belongings","columns":["team_id","user_id"],"comment":""}],"constraints":[{"name":"fk_contest_team_user_belongings_contest_team","type":"FOREIGN KEY","def":"FOREIGN KEY (team_id) REFERENCES contest_teams (id)","table":"contest_team_user_belongings","referenced_table":"contest_teams","columns":["team_id"],"referenced_columns":["id"],"comment":""},{"name":"fk_contest_team_user_belongings_user","type":"FOREIGN KEY","def":"FOREIGN KEY (user_id) REFERENCES users (id)","table":"contest_team_user_belongings","referenced_table":"users","columns":["user_id"],"referenced_columns":["id"],"comment":""},{"name":"PRIMARY","type":"PRIMARY KEY","def":"PRIMARY KEY (team_id, user_id)","table":"contest_team_user_belongings","referenced_table":null,"columns":["team_id","user_id"],"referenced_columns":null,"comment":""}],"triggers":[],"def":"CREATE TABLE `contest_team_user_belongings` (\n `team_id` char(36) NOT NULL,\n `user_id` char(36) NOT NULL,\n `created_at` datetime(6) DEFAULT NULL,\n `updated_at` datetime(6) DEFAULT NULL,\n PRIMARY KEY (`team_id`,`user_id`),\n KEY `fk_contest_team_user_belongings_user` (`user_id`),\n CONSTRAINT `fk_contest_team_user_belongings_contest_team` FOREIGN KEY (`team_id`) REFERENCES `contest_teams` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,\n CONSTRAINT `fk_contest_team_user_belongings_user` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3"},{"name":"event_level_relations","type":"BASE TABLE","comment":"knoQイベントと公開レベルの関係テーブル","columns":[{"name":"id","type":"char(36)","nullable":false,"default":null,"comment":"knoQイベントUUID"},{"name":"level","type":"tinyint(3) unsigned","nullable":false,"default":"0","comment":"公開レベル。0なら匿名、1ならそのまま公開、2なら外部に非公開"},{"name":"created_at","type":"datetime(6)","nullable":true,"default":"NULL","comment":"関係テーブル作成日時"},{"name":"updated_at","type":"datetime(6)","nullable":true,"default":"NULL","comment":"関係テーブル更新日時"}],"indexes":[{"name":"PRIMARY","def":"PRIMARY KEY (id) USING BTREE","table":"event_level_relations","columns":["id"],"comment":""}],"constraints":[{"name":"PRIMARY","type":"PRIMARY KEY","def":"PRIMARY KEY (id)","table":"event_level_relations","referenced_table":null,"columns":["id"],"referenced_columns":null,"comment":""}],"triggers":[],"def":"CREATE TABLE `event_level_relations` (\n `id` char(36) NOT NULL,\n `level` tinyint(3) unsigned NOT NULL DEFAULT 0,\n `created_at` datetime(6) DEFAULT NULL,\n `updated_at` datetime(6) DEFAULT NULL,\n PRIMARY KEY (`id`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3"},{"name":"groups","type":"BASE TABLE","comment":"グループテーブル","columns":[{"name":"group_id","type":"char(36)","nullable":false,"default":null,"comment":"グループUUID"},{"name":"name","type":"varchar(32)","nullable":true,"default":"NULL","comment":"グループ名"},{"name":"link","type":"text","nullable":true,"default":"NULL","comment":"グループのリンク"},{"name":"description","type":"text","nullable":true,"default":"NULL","comment":"グループの説明文"},{"name":"created_at","type":"datetime(6)","nullable":true,"default":"NULL","comment":"グループ作成日時"},{"name":"updated_at","type":"datetime(6)","nullable":true,"default":"NULL","comment":"グループ更新日時"}],"indexes":[{"name":"PRIMARY","def":"PRIMARY KEY (group_id) USING BTREE","table":"groups","columns":["group_id"],"comment":""}],"constraints":[{"name":"PRIMARY","type":"PRIMARY KEY","def":"PRIMARY KEY (group_id)","table":"groups","referenced_table":null,"columns":["group_id"],"referenced_columns":null,"comment":""}],"triggers":[],"def":"CREATE TABLE `groups` (\n `group_id` char(36) NOT NULL,\n `name` varchar(32) DEFAULT NULL,\n `link` text DEFAULT NULL,\n `description` text DEFAULT NULL,\n `created_at` datetime(6) DEFAULT NULL,\n `updated_at` datetime(6) DEFAULT NULL,\n PRIMARY KEY (`group_id`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3"},{"name":"group_user_admins","type":"BASE TABLE","comment":"グループと管理者関係テーブル","columns":[{"name":"user_id","type":"char(36)","nullable":false,"default":null,"comment":"ユーザーUUID"},{"name":"group_id","type":"char(36)","nullable":false,"default":null,"comment":"グループUUID"},{"name":"created_at","type":"datetime(6)","nullable":true,"default":"NULL","comment":"関係テーブル作成日時"},{"name":"updated_at","type":"datetime(6)","nullable":true,"default":"NULL","comment":"関係テーブル更新日時"}],"indexes":[{"name":"fk_group_user_admins_group","def":"KEY fk_group_user_admins_group (group_id) USING BTREE","table":"group_user_admins","columns":["group_id"],"comment":""},{"name":"PRIMARY","def":"PRIMARY KEY (user_id, group_id) USING BTREE","table":"group_user_admins","columns":["user_id","group_id"],"comment":""}],"constraints":[{"name":"fk_group_user_admins_group","type":"FOREIGN KEY","def":"FOREIGN KEY (group_id) REFERENCES groups (group_id)","table":"group_user_admins","referenced_table":"groups","columns":["group_id"],"referenced_columns":["group_id"],"comment":""},{"name":"PRIMARY","type":"PRIMARY KEY","def":"PRIMARY KEY (user_id, group_id)","table":"group_user_admins","referenced_table":null,"columns":["user_id","group_id"],"referenced_columns":null,"comment":""}],"triggers":[],"def":"CREATE TABLE `group_user_admins` (\n `user_id` char(36) NOT NULL,\n `group_id` char(36) NOT NULL,\n `created_at` datetime(6) DEFAULT NULL,\n `updated_at` datetime(6) DEFAULT NULL,\n PRIMARY KEY (`user_id`,`group_id`),\n KEY `fk_group_user_admins_group` (`group_id`),\n CONSTRAINT `fk_group_user_admins_group` FOREIGN KEY (`group_id`) REFERENCES `groups` (`group_id`) ON DELETE CASCADE ON UPDATE CASCADE\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3"},{"name":"group_user_belongings","type":"BASE TABLE","comment":"グループとユーザー関係テーブル","columns":[{"name":"user_id","type":"char(36)","nullable":false,"default":null,"comment":"ユーザーUUID"},{"name":"group_id","type":"char(36)","nullable":false,"default":null,"comment":"グループUUID"},{"name":"since_year","type":"smallint(4)","nullable":false,"default":null,"comment":"ユーザー所属開始年"},{"name":"since_semester","type":"tinyint(1)","nullable":false,"default":null,"comment":"ユーザー所属開始学期(0:前期 1:後期)"},{"name":"until_year","type":"smallint(4)","nullable":false,"default":null,"comment":"ユーザー所属終了年"},{"name":"until_semester","type":"tinyint(1)","nullable":false,"default":null,"comment":"ユーザー所属終了学期(0:前期 1:後期)"},{"name":"created_at","type":"datetime(6)","nullable":true,"default":"NULL","comment":"関係テーブル作成日時"},{"name":"updated_at","type":"datetime(6)","nullable":true,"default":"NULL","comment":"関係テーブル更新日時"}],"indexes":[{"name":"fk_group_user_belongings_group","def":"KEY fk_group_user_belongings_group (group_id) USING BTREE","table":"group_user_belongings","columns":["group_id"],"comment":""},{"name":"PRIMARY","def":"PRIMARY KEY (user_id, group_id) USING BTREE","table":"group_user_belongings","columns":["user_id","group_id"],"comment":""}],"constraints":[{"name":"fk_group_user_belongings_group","type":"FOREIGN KEY","def":"FOREIGN KEY (group_id) REFERENCES groups (group_id)","table":"group_user_belongings","referenced_table":"groups","columns":["group_id"],"referenced_columns":["group_id"],"comment":""},{"name":"fk_group_user_belongings_user","type":"FOREIGN KEY","def":"FOREIGN KEY (user_id) REFERENCES users (id)","table":"group_user_belongings","referenced_table":"users","columns":["user_id"],"referenced_columns":["id"],"comment":""},{"name":"PRIMARY","type":"PRIMARY KEY","def":"PRIMARY KEY (user_id, group_id)","table":"group_user_belongings","referenced_table":null,"columns":["user_id","group_id"],"referenced_columns":null,"comment":""}],"triggers":[],"def":"CREATE TABLE `group_user_belongings` (\n `user_id` char(36) NOT NULL,\n `group_id` char(36) NOT NULL,\n `since_year` smallint(4) NOT NULL,\n `since_semester` tinyint(1) NOT NULL,\n `until_year` smallint(4) NOT NULL,\n `until_semester` tinyint(1) NOT NULL,\n `created_at` datetime(6) DEFAULT NULL,\n `updated_at` datetime(6) DEFAULT NULL,\n PRIMARY KEY (`user_id`,`group_id`),\n KEY `fk_group_user_belongings_group` (`group_id`),\n CONSTRAINT `fk_group_user_belongings_group` FOREIGN KEY (`group_id`) REFERENCES `groups` (`group_id`) ON DELETE CASCADE ON UPDATE CASCADE,\n CONSTRAINT `fk_group_user_belongings_user` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3"},{"name":"migrations","type":"BASE TABLE","comment":"gormigrate用のデータベースバージョンテーブル","columns":[{"name":"id","type":"varchar(255)","nullable":false,"default":null,"comment":""}],"indexes":[{"name":"PRIMARY","def":"PRIMARY KEY (id) USING BTREE","table":"migrations","columns":["id"],"comment":""}],"constraints":[{"name":"PRIMARY","type":"PRIMARY KEY","def":"PRIMARY KEY (id)","table":"migrations","referenced_table":null,"columns":["id"],"referenced_columns":null,"comment":""}],"triggers":[],"def":"CREATE TABLE `migrations` (\n `id` varchar(255) NOT NULL,\n PRIMARY KEY (`id`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3"},{"name":"projects","type":"BASE TABLE","comment":"プロジェクトテーブル","columns":[{"name":"id","type":"char(36)","nullable":false,"default":null,"comment":"プロジェクトUUID"},{"name":"name","type":"varchar(32)","nullable":true,"default":"NULL","comment":"プロジェクト名"},{"name":"description","type":"text","nullable":true,"default":"NULL","comment":"プロジェクト説明"},{"name":"link","type":"text","nullable":true,"default":"NULL","comment":"プロジェクト情報のリンク"},{"name":"since_year","type":"smallint(4)","nullable":false,"default":null,"comment":"プロジェクト開始年"},{"name":"since_semester","type":"tinyint(1)","nullable":false,"default":null,"comment":"プロジェクト開始学期(0:前期 1:後期)"},{"name":"until_year","type":"smallint(4)","nullable":false,"default":null,"comment":"プロジェクト終了年"},{"name":"until_semester","type":"tinyint(1)","nullable":false,"default":null,"comment":"プロジェクト終了学期(0:前期 1:後期)"},{"name":"created_at","type":"datetime(6)","nullable":true,"default":"NULL","comment":"プロジェクト作成日時"},{"name":"updated_at","type":"datetime(6)","nullable":true,"default":"NULL","comment":"プロジェクト更新日時"}],"indexes":[{"name":"PRIMARY","def":"PRIMARY KEY (id) USING BTREE","table":"projects","columns":["id"],"comment":""}],"constraints":[{"name":"PRIMARY","type":"PRIMARY KEY","def":"PRIMARY KEY (id)","table":"projects","referenced_table":null,"columns":["id"],"referenced_columns":null,"comment":""}],"triggers":[],"def":"CREATE TABLE `projects` (\n `id` char(36) NOT NULL,\n `name` varchar(32) DEFAULT NULL,\n `description` text DEFAULT NULL,\n `link` text DEFAULT NULL,\n `since_year` smallint(4) NOT NULL,\n `since_semester` tinyint(1) NOT NULL,\n `until_year` smallint(4) NOT NULL,\n `until_semester` tinyint(1) NOT NULL,\n `created_at` datetime(6) DEFAULT NULL,\n `updated_at` datetime(6) DEFAULT NULL,\n PRIMARY KEY (`id`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3"},{"name":"project_members","type":"BASE TABLE","comment":"プロジェクト所属者テーブル","columns":[{"name":"id","type":"char(36)","nullable":false,"default":null,"comment":""},{"name":"project_id","type":"char(36)","nullable":false,"default":null,"comment":"プロジェクトUUID"},{"name":"user_id","type":"char(36)","nullable":false,"default":null,"comment":"ユーザーUUID"},{"name":"since_year","type":"smallint(4)","nullable":false,"default":null,"comment":"プロジェクト所属開始年"},{"name":"since_semester","type":"tinyint(1)","nullable":false,"default":null,"comment":"プロジェクト所属開始学期(0:前期 1:後期)"},{"name":"until_year","type":"smallint(4)","nullable":false,"default":null,"comment":"プロジェクト所属終了年"},{"name":"until_semester","type":"tinyint(1)","nullable":false,"default":null,"comment":"プロジェクト所属終了学期(0:前期 1:後期)"},{"name":"created_at","type":"datetime(6)","nullable":true,"default":"NULL","comment":""},{"name":"updated_at","type":"datetime(6)","nullable":true,"default":"NULL","comment":""}],"indexes":[{"name":"fk_project_members_project","def":"KEY fk_project_members_project (project_id) USING BTREE","table":"project_members","columns":["project_id"],"comment":""},{"name":"fk_project_members_user","def":"KEY fk_project_members_user (user_id) USING BTREE","table":"project_members","columns":["user_id"],"comment":""},{"name":"PRIMARY","def":"PRIMARY KEY (id) USING BTREE","table":"project_members","columns":["id"],"comment":""}],"constraints":[{"name":"fk_project_members_project","type":"FOREIGN KEY","def":"FOREIGN KEY (project_id) REFERENCES projects (id)","table":"project_members","referenced_table":"projects","columns":["project_id"],"referenced_columns":["id"],"comment":""},{"name":"fk_project_members_user","type":"FOREIGN KEY","def":"FOREIGN KEY (user_id) REFERENCES users (id)","table":"project_members","referenced_table":"users","columns":["user_id"],"referenced_columns":["id"],"comment":""},{"name":"PRIMARY","type":"PRIMARY KEY","def":"PRIMARY KEY (id)","table":"project_members","referenced_table":null,"columns":["id"],"referenced_columns":null,"comment":""}],"triggers":[],"def":"CREATE TABLE `project_members` (\n `id` char(36) NOT NULL,\n `project_id` char(36) NOT NULL,\n `user_id` char(36) NOT NULL,\n `since_year` smallint(4) NOT NULL,\n `since_semester` tinyint(1) NOT NULL,\n `until_year` smallint(4) NOT NULL,\n `until_semester` tinyint(1) NOT NULL,\n `created_at` datetime(6) DEFAULT NULL,\n `updated_at` datetime(6) DEFAULT NULL,\n PRIMARY KEY (`id`),\n KEY `fk_project_members_project` (`project_id`),\n KEY `fk_project_members_user` (`user_id`),\n CONSTRAINT `fk_project_members_project` FOREIGN KEY (`project_id`) REFERENCES `projects` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,\n CONSTRAINT `fk_project_members_user` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3"},{"name":"users","type":"BASE TABLE","comment":"ユーザーテーブル","columns":[{"name":"id","type":"char(36)","nullable":false,"default":null,"comment":"ユーザーUUID"},{"name":"description","type":"text","nullable":false,"default":null,"comment":"自己紹介文"},{"name":"check","type":"tinyint(1)","nullable":false,"default":"0","comment":"氏名を公開するかどうかの可否 (0: 停止, 1: 有効, 2: 一時停止)"},{"name":"name","type":"varchar(32)","nullable":false,"default":null,"comment":"ユーザー名"},{"name":"state","type":"tinyint(1)","nullable":false,"default":null,"comment":"traQのユーザーアカウント状態"},{"name":"created_at","type":"datetime(6)","nullable":true,"default":"NULL","comment":""},{"name":"updated_at","type":"datetime(6)","nullable":true,"default":"NULL","comment":""}],"indexes":[{"name":"PRIMARY","def":"PRIMARY KEY (id) USING BTREE","table":"users","columns":["id"],"comment":""},{"name":"uni_users_name","def":"UNIQUE KEY uni_users_name (name) USING BTREE","table":"users","columns":["name"],"comment":""}],"constraints":[{"name":"PRIMARY","type":"PRIMARY KEY","def":"PRIMARY KEY (id)","table":"users","referenced_table":null,"columns":["id"],"referenced_columns":null,"comment":""},{"name":"uni_users_name","type":"UNIQUE","def":"UNIQUE KEY uni_users_name (name)","table":"users","referenced_table":null,"columns":["name"],"referenced_columns":null,"comment":""}],"triggers":[],"def":"CREATE TABLE `users` (\n `id` char(36) NOT NULL,\n `description` text NOT NULL,\n `check` tinyint(1) NOT NULL DEFAULT 0,\n `name` varchar(32) NOT NULL,\n `state` tinyint(1) NOT NULL,\n `created_at` datetime(6) DEFAULT NULL,\n `updated_at` datetime(6) DEFAULT NULL,\n PRIMARY KEY (`id`),\n UNIQUE KEY `uni_users_name` (`name`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3"}],"relations":[{"table":"accounts","columns":["user_id"],"cardinality":"Zero or more","parent_table":"users","parent_columns":["id"],"parent_cardinality":"Exactly one","def":"FOREIGN KEY (user_id) REFERENCES users (id)","virtual":false},{"table":"contest_teams","columns":["contest_id"],"cardinality":"Zero or more","parent_table":"contests","parent_columns":["id"],"parent_cardinality":"Exactly one","def":"FOREIGN KEY (contest_id) REFERENCES contests (id)","virtual":false},{"table":"contest_team_user_belongings","columns":["team_id"],"cardinality":"Zero or more","parent_table":"contest_teams","parent_columns":["id"],"parent_cardinality":"Exactly one","def":"FOREIGN KEY (team_id) REFERENCES contest_teams (id)","virtual":false},{"table":"contest_team_user_belongings","columns":["user_id"],"cardinality":"Zero or more","parent_table":"users","parent_columns":["id"],"parent_cardinality":"Exactly one","def":"FOREIGN KEY (user_id) REFERENCES users (id)","virtual":false},{"table":"group_user_admins","columns":["group_id"],"cardinality":"Zero or more","parent_table":"groups","parent_columns":["group_id"],"parent_cardinality":"Exactly one","def":"FOREIGN KEY (group_id) REFERENCES groups (group_id)","virtual":false},{"table":"group_user_belongings","columns":["group_id"],"cardinality":"Zero or more","parent_table":"groups","parent_columns":["group_id"],"parent_cardinality":"Exactly one","def":"FOREIGN KEY (group_id) REFERENCES groups (group_id)","virtual":false},{"table":"group_user_belongings","columns":["user_id"],"cardinality":"Zero or more","parent_table":"users","parent_columns":["id"],"parent_cardinality":"Exactly one","def":"FOREIGN KEY (user_id) REFERENCES users (id)","virtual":false},{"table":"project_members","columns":["project_id"],"cardinality":"Zero or more","parent_table":"projects","parent_columns":["id"],"parent_cardinality":"Exactly one","def":"FOREIGN KEY (project_id) REFERENCES projects (id)","virtual":false},{"table":"project_members","columns":["user_id"],"cardinality":"Zero or more","parent_table":"users","parent_columns":["id"],"parent_cardinality":"Exactly one","def":"FOREIGN KEY (user_id) REFERENCES users (id)","virtual":false}],"functions":[],"driver":{"name":"mariadb","database_version":"10.6.4-MariaDB-1:10.6.4+maria~focal","meta":{"dict":{"Functions":"Stored procedures and functions"}}}} +{"name":"portfolio","desc":"","tables":[{"name":"accounts","type":"BASE TABLE","comment":"Twitterなどのアカウントテーブル","columns":[{"name":"id","type":"char(36)","nullable":false,"default":null,"comment":"アカウントUUID"},{"name":"type","type":"tinyint(1)","nullable":false,"default":null,"comment":"アカウントのハードコードID"},{"name":"name","type":"varchar(256)","nullable":true,"default":"NULL","comment":"アカウント名"},{"name":"url","type":"text","nullable":true,"default":"NULL","comment":"アカウントのURL"},{"name":"user_id","type":"char(36)","nullable":false,"default":null,"comment":"ユーザーUUID"},{"name":"check","type":"tinyint(1)","nullable":false,"default":"0","comment":"公開可能かどうか"},{"name":"created_at","type":"datetime(6)","nullable":true,"default":"NULL","comment":""},{"name":"updated_at","type":"datetime(6)","nullable":true,"default":"NULL","comment":""}],"indexes":[{"name":"fk_users_accounts","def":"KEY fk_users_accounts (user_id) USING BTREE","table":"accounts","columns":["user_id"],"comment":""},{"name":"PRIMARY","def":"PRIMARY KEY (id) USING BTREE","table":"accounts","columns":["id"],"comment":""}],"constraints":[{"name":"fk_users_accounts","type":"FOREIGN KEY","def":"FOREIGN KEY (user_id) REFERENCES users (id)","table":"accounts","referenced_table":"users","columns":["user_id"],"referenced_columns":["id"],"comment":""},{"name":"PRIMARY","type":"PRIMARY KEY","def":"PRIMARY KEY (id)","table":"accounts","referenced_table":null,"columns":["id"],"referenced_columns":null,"comment":""}],"triggers":[],"def":"CREATE TABLE `accounts` (\n `id` char(36) NOT NULL,\n `type` tinyint(1) NOT NULL,\n `name` varchar(256) DEFAULT NULL,\n `url` text DEFAULT NULL,\n `user_id` char(36) NOT NULL,\n `check` tinyint(1) NOT NULL DEFAULT 0,\n `created_at` datetime(6) DEFAULT NULL,\n `updated_at` datetime(6) DEFAULT NULL,\n PRIMARY KEY (`id`),\n KEY `fk_users_accounts` (`user_id`),\n CONSTRAINT `fk_users_accounts` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3"},{"name":"contests","type":"BASE TABLE","comment":"コンテストテーブル","columns":[{"name":"id","type":"char(36)","nullable":false,"default":null,"comment":"コンテストUUID"},{"name":"name","type":"varchar(128)","nullable":true,"default":"NULL","comment":"コンテスト名"},{"name":"description","type":"text","nullable":true,"default":"NULL","comment":"コンテスト説明"},{"name":"link","type":"text","nullable":true,"default":"NULL","comment":"コンテスト情報のリンク"},{"name":"since","type":"datetime(6)","nullable":true,"default":"NULL","comment":"期間始まり"},{"name":"until","type":"datetime(6)","nullable":true,"default":"NULL","comment":"期間終わり"},{"name":"created_at","type":"datetime(6)","nullable":true,"default":"NULL","comment":"コンテスト作成日時"},{"name":"updated_at","type":"datetime(6)","nullable":true,"default":"NULL","comment":"コンテスト更新日時"}],"indexes":[{"name":"PRIMARY","def":"PRIMARY KEY (id) USING BTREE","table":"contests","columns":["id"],"comment":""}],"constraints":[{"name":"PRIMARY","type":"PRIMARY KEY","def":"PRIMARY KEY (id)","table":"contests","referenced_table":null,"columns":["id"],"referenced_columns":null,"comment":""}],"triggers":[],"def":"CREATE TABLE `contests` (\n `id` char(36) NOT NULL,\n `name` varchar(128) DEFAULT NULL,\n `description` text DEFAULT NULL,\n `link` text DEFAULT NULL,\n `since` datetime(6) DEFAULT NULL,\n `until` datetime(6) DEFAULT NULL,\n `created_at` datetime(6) DEFAULT NULL,\n `updated_at` datetime(6) DEFAULT NULL,\n PRIMARY KEY (`id`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3"},{"name":"contest_teams","type":"BASE TABLE","comment":"コンテスト参加チームテーブル","columns":[{"name":"id","type":"char(36)","nullable":false,"default":null,"comment":"コンテストチームUUID"},{"name":"contest_id","type":"char(36)","nullable":false,"default":null,"comment":"コンテストUUID"},{"name":"name","type":"varchar(128)","nullable":true,"default":"NULL","comment":"チーム名"},{"name":"description","type":"text","nullable":true,"default":"NULL","comment":"チーム情報"},{"name":"result","type":"text","nullable":true,"default":"NULL","comment":"順位などの結果"},{"name":"link","type":"text","nullable":true,"default":"NULL","comment":"コンテストチームの詳細が載っているページへのリンク"},{"name":"created_at","type":"datetime(6)","nullable":true,"default":"NULL","comment":"コンテストチーム作成日時"},{"name":"updated_at","type":"datetime(6)","nullable":true,"default":"NULL","comment":"コンテストチーム更新日時"}],"indexes":[{"name":"fk_contest_teams_contest","def":"KEY fk_contest_teams_contest (contest_id) USING BTREE","table":"contest_teams","columns":["contest_id"],"comment":""},{"name":"PRIMARY","def":"PRIMARY KEY (id) USING BTREE","table":"contest_teams","columns":["id"],"comment":""}],"constraints":[{"name":"fk_contest_teams_contest","type":"FOREIGN KEY","def":"FOREIGN KEY (contest_id) REFERENCES contests (id)","table":"contest_teams","referenced_table":"contests","columns":["contest_id"],"referenced_columns":["id"],"comment":""},{"name":"PRIMARY","type":"PRIMARY KEY","def":"PRIMARY KEY (id)","table":"contest_teams","referenced_table":null,"columns":["id"],"referenced_columns":null,"comment":""}],"triggers":[],"def":"CREATE TABLE `contest_teams` (\n `id` char(36) NOT NULL,\n `contest_id` char(36) NOT NULL,\n `name` varchar(128) DEFAULT NULL,\n `description` text DEFAULT NULL,\n `result` text DEFAULT NULL,\n `link` text DEFAULT NULL,\n `created_at` datetime(6) DEFAULT NULL,\n `updated_at` datetime(6) DEFAULT NULL,\n PRIMARY KEY (`id`),\n KEY `fk_contest_teams_contest` (`contest_id`),\n CONSTRAINT `fk_contest_teams_contest` FOREIGN KEY (`contest_id`) REFERENCES `contests` (`id`) ON DELETE CASCADE ON UPDATE CASCADE\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3"},{"name":"contest_team_user_belongings","type":"BASE TABLE","comment":"コンテストチームとユーザー関係テーブル","columns":[{"name":"team_id","type":"char(36)","nullable":false,"default":null,"comment":"コンテストチームUUID"},{"name":"user_id","type":"char(36)","nullable":false,"default":null,"comment":"ユーザーUUID"},{"name":"created_at","type":"datetime(6)","nullable":true,"default":"NULL","comment":"関係テーブル作成日時"},{"name":"updated_at","type":"datetime(6)","nullable":true,"default":"NULL","comment":"関係テーブル更新日時"}],"indexes":[{"name":"fk_contest_team_user_belongings_user","def":"KEY fk_contest_team_user_belongings_user (user_id) USING BTREE","table":"contest_team_user_belongings","columns":["user_id"],"comment":""},{"name":"PRIMARY","def":"PRIMARY KEY (team_id, user_id) USING BTREE","table":"contest_team_user_belongings","columns":["team_id","user_id"],"comment":""}],"constraints":[{"name":"fk_contest_team_user_belongings_contest_team","type":"FOREIGN KEY","def":"FOREIGN KEY (team_id) REFERENCES contest_teams (id)","table":"contest_team_user_belongings","referenced_table":"contest_teams","columns":["team_id"],"referenced_columns":["id"],"comment":""},{"name":"fk_contest_team_user_belongings_user","type":"FOREIGN KEY","def":"FOREIGN KEY (user_id) REFERENCES users (id)","table":"contest_team_user_belongings","referenced_table":"users","columns":["user_id"],"referenced_columns":["id"],"comment":""},{"name":"PRIMARY","type":"PRIMARY KEY","def":"PRIMARY KEY (team_id, user_id)","table":"contest_team_user_belongings","referenced_table":null,"columns":["team_id","user_id"],"referenced_columns":null,"comment":""}],"triggers":[],"def":"CREATE TABLE `contest_team_user_belongings` (\n `team_id` char(36) NOT NULL,\n `user_id` char(36) NOT NULL,\n `created_at` datetime(6) DEFAULT NULL,\n `updated_at` datetime(6) DEFAULT NULL,\n PRIMARY KEY (`team_id`,`user_id`),\n KEY `fk_contest_team_user_belongings_user` (`user_id`),\n CONSTRAINT `fk_contest_team_user_belongings_contest_team` FOREIGN KEY (`team_id`) REFERENCES `contest_teams` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,\n CONSTRAINT `fk_contest_team_user_belongings_user` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3"},{"name":"event_level_relations","type":"BASE TABLE","comment":"knoQイベントと公開レベルの関係テーブル","columns":[{"name":"id","type":"char(36)","nullable":false,"default":null,"comment":"knoQイベントUUID"},{"name":"level","type":"tinyint(3) unsigned","nullable":false,"default":"0","comment":"公開レベル。0なら匿名、1ならそのまま公開、2なら外部に非公開"},{"name":"created_at","type":"datetime(6)","nullable":true,"default":"NULL","comment":"関係テーブル作成日時"},{"name":"updated_at","type":"datetime(6)","nullable":true,"default":"NULL","comment":"関係テーブル更新日時"}],"indexes":[{"name":"PRIMARY","def":"PRIMARY KEY (id) USING BTREE","table":"event_level_relations","columns":["id"],"comment":""}],"constraints":[{"name":"PRIMARY","type":"PRIMARY KEY","def":"PRIMARY KEY (id)","table":"event_level_relations","referenced_table":null,"columns":["id"],"referenced_columns":null,"comment":""}],"triggers":[],"def":"CREATE TABLE `event_level_relations` (\n `id` char(36) NOT NULL,\n `level` tinyint(3) unsigned NOT NULL DEFAULT 0,\n `created_at` datetime(6) DEFAULT NULL,\n `updated_at` datetime(6) DEFAULT NULL,\n PRIMARY KEY (`id`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3"},{"name":"groups","type":"BASE TABLE","comment":"グループテーブル","columns":[{"name":"group_id","type":"char(36)","nullable":false,"default":null,"comment":"グループUUID"},{"name":"name","type":"varchar(32)","nullable":true,"default":"NULL","comment":"グループ名"},{"name":"link","type":"text","nullable":true,"default":"NULL","comment":"グループのリンク"},{"name":"description","type":"text","nullable":true,"default":"NULL","comment":"グループの説明文"},{"name":"created_at","type":"datetime(6)","nullable":true,"default":"NULL","comment":"グループ作成日時"},{"name":"updated_at","type":"datetime(6)","nullable":true,"default":"NULL","comment":"グループ更新日時"}],"indexes":[{"name":"PRIMARY","def":"PRIMARY KEY (group_id) USING BTREE","table":"groups","columns":["group_id"],"comment":""}],"constraints":[{"name":"PRIMARY","type":"PRIMARY KEY","def":"PRIMARY KEY (group_id)","table":"groups","referenced_table":null,"columns":["group_id"],"referenced_columns":null,"comment":""}],"triggers":[],"def":"CREATE TABLE `groups` (\n `group_id` char(36) NOT NULL,\n `name` varchar(32) DEFAULT NULL,\n `link` text DEFAULT NULL,\n `description` text DEFAULT NULL,\n `created_at` datetime(6) DEFAULT NULL,\n `updated_at` datetime(6) DEFAULT NULL,\n PRIMARY KEY (`group_id`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3"},{"name":"group_user_admins","type":"BASE TABLE","comment":"グループと管理者関係テーブル","columns":[{"name":"user_id","type":"char(36)","nullable":false,"default":null,"comment":"ユーザーUUID"},{"name":"group_id","type":"char(36)","nullable":false,"default":null,"comment":"グループUUID"},{"name":"created_at","type":"datetime(6)","nullable":true,"default":"NULL","comment":"関係テーブル作成日時"},{"name":"updated_at","type":"datetime(6)","nullable":true,"default":"NULL","comment":"関係テーブル更新日時"}],"indexes":[{"name":"fk_group_user_admins_group","def":"KEY fk_group_user_admins_group (group_id) USING BTREE","table":"group_user_admins","columns":["group_id"],"comment":""},{"name":"PRIMARY","def":"PRIMARY KEY (user_id, group_id) USING BTREE","table":"group_user_admins","columns":["user_id","group_id"],"comment":""}],"constraints":[{"name":"fk_group_user_admins_group","type":"FOREIGN KEY","def":"FOREIGN KEY (group_id) REFERENCES groups (group_id)","table":"group_user_admins","referenced_table":"groups","columns":["group_id"],"referenced_columns":["group_id"],"comment":""},{"name":"PRIMARY","type":"PRIMARY KEY","def":"PRIMARY KEY (user_id, group_id)","table":"group_user_admins","referenced_table":null,"columns":["user_id","group_id"],"referenced_columns":null,"comment":""}],"triggers":[],"def":"CREATE TABLE `group_user_admins` (\n `user_id` char(36) NOT NULL,\n `group_id` char(36) NOT NULL,\n `created_at` datetime(6) DEFAULT NULL,\n `updated_at` datetime(6) DEFAULT NULL,\n PRIMARY KEY (`user_id`,`group_id`),\n KEY `fk_group_user_admins_group` (`group_id`),\n CONSTRAINT `fk_group_user_admins_group` FOREIGN KEY (`group_id`) REFERENCES `groups` (`group_id`) ON DELETE CASCADE ON UPDATE CASCADE\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3"},{"name":"group_user_belongings","type":"BASE TABLE","comment":"グループとユーザー関係テーブル","columns":[{"name":"user_id","type":"char(36)","nullable":false,"default":null,"comment":"ユーザーUUID"},{"name":"group_id","type":"char(36)","nullable":false,"default":null,"comment":"グループUUID"},{"name":"since_year","type":"smallint(4)","nullable":false,"default":null,"comment":"ユーザー所属開始年"},{"name":"since_semester","type":"tinyint(1)","nullable":false,"default":null,"comment":"ユーザー所属開始学期(0:前期 1:後期)"},{"name":"until_year","type":"smallint(4)","nullable":false,"default":null,"comment":"ユーザー所属終了年"},{"name":"until_semester","type":"tinyint(1)","nullable":false,"default":null,"comment":"ユーザー所属終了学期(0:前期 1:後期)"},{"name":"created_at","type":"datetime(6)","nullable":true,"default":"NULL","comment":"関係テーブル作成日時"},{"name":"updated_at","type":"datetime(6)","nullable":true,"default":"NULL","comment":"関係テーブル更新日時"}],"indexes":[{"name":"fk_group_user_belongings_group","def":"KEY fk_group_user_belongings_group (group_id) USING BTREE","table":"group_user_belongings","columns":["group_id"],"comment":""},{"name":"PRIMARY","def":"PRIMARY KEY (user_id, group_id) USING BTREE","table":"group_user_belongings","columns":["user_id","group_id"],"comment":""}],"constraints":[{"name":"fk_group_user_belongings_group","type":"FOREIGN KEY","def":"FOREIGN KEY (group_id) REFERENCES groups (group_id)","table":"group_user_belongings","referenced_table":"groups","columns":["group_id"],"referenced_columns":["group_id"],"comment":""},{"name":"fk_group_user_belongings_user","type":"FOREIGN KEY","def":"FOREIGN KEY (user_id) REFERENCES users (id)","table":"group_user_belongings","referenced_table":"users","columns":["user_id"],"referenced_columns":["id"],"comment":""},{"name":"PRIMARY","type":"PRIMARY KEY","def":"PRIMARY KEY (user_id, group_id)","table":"group_user_belongings","referenced_table":null,"columns":["user_id","group_id"],"referenced_columns":null,"comment":""}],"triggers":[],"def":"CREATE TABLE `group_user_belongings` (\n `user_id` char(36) NOT NULL,\n `group_id` char(36) NOT NULL,\n `since_year` smallint(4) NOT NULL,\n `since_semester` tinyint(1) NOT NULL,\n `until_year` smallint(4) NOT NULL,\n `until_semester` tinyint(1) NOT NULL,\n `created_at` datetime(6) DEFAULT NULL,\n `updated_at` datetime(6) DEFAULT NULL,\n PRIMARY KEY (`user_id`,`group_id`),\n KEY `fk_group_user_belongings_group` (`group_id`),\n CONSTRAINT `fk_group_user_belongings_group` FOREIGN KEY (`group_id`) REFERENCES `groups` (`group_id`) ON DELETE CASCADE ON UPDATE CASCADE,\n CONSTRAINT `fk_group_user_belongings_user` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3"},{"name":"migrations","type":"BASE TABLE","comment":"gormigrate用のデータベースバージョンテーブル","columns":[{"name":"id","type":"varchar(255)","nullable":false,"default":null,"comment":""}],"indexes":[{"name":"PRIMARY","def":"PRIMARY KEY (id) USING BTREE","table":"migrations","columns":["id"],"comment":""}],"constraints":[{"name":"PRIMARY","type":"PRIMARY KEY","def":"PRIMARY KEY (id)","table":"migrations","referenced_table":null,"columns":["id"],"referenced_columns":null,"comment":""}],"triggers":[],"def":"CREATE TABLE `migrations` (\n `id` varchar(255) NOT NULL,\n PRIMARY KEY (`id`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3"},{"name":"projects","type":"BASE TABLE","comment":"プロジェクトテーブル","columns":[{"name":"id","type":"char(36)","nullable":false,"default":null,"comment":"プロジェクトUUID"},{"name":"name","type":"varchar(128)","nullable":true,"default":"NULL","comment":"プロジェクト名"},{"name":"description","type":"text","nullable":true,"default":"NULL","comment":"プロジェクト説明"},{"name":"link","type":"text","nullable":true,"default":"NULL","comment":"プロジェクト情報のリンク"},{"name":"since_year","type":"smallint(4)","nullable":false,"default":null,"comment":"プロジェクト開始年"},{"name":"since_semester","type":"tinyint(1)","nullable":false,"default":null,"comment":"プロジェクト開始学期(0:前期 1:後期)"},{"name":"until_year","type":"smallint(4)","nullable":false,"default":null,"comment":"プロジェクト終了年"},{"name":"until_semester","type":"tinyint(1)","nullable":false,"default":null,"comment":"プロジェクト終了学期(0:前期 1:後期)"},{"name":"created_at","type":"datetime(6)","nullable":true,"default":"NULL","comment":"プロジェクト作成日時"},{"name":"updated_at","type":"datetime(6)","nullable":true,"default":"NULL","comment":"プロジェクト更新日時"}],"indexes":[{"name":"PRIMARY","def":"PRIMARY KEY (id) USING BTREE","table":"projects","columns":["id"],"comment":""}],"constraints":[{"name":"PRIMARY","type":"PRIMARY KEY","def":"PRIMARY KEY (id)","table":"projects","referenced_table":null,"columns":["id"],"referenced_columns":null,"comment":""}],"triggers":[],"def":"CREATE TABLE `projects` (\n `id` char(36) NOT NULL,\n `name` varchar(128) DEFAULT NULL,\n `description` text DEFAULT NULL,\n `link` text DEFAULT NULL,\n `since_year` smallint(4) NOT NULL,\n `since_semester` tinyint(1) NOT NULL,\n `until_year` smallint(4) NOT NULL,\n `until_semester` tinyint(1) NOT NULL,\n `created_at` datetime(6) DEFAULT NULL,\n `updated_at` datetime(6) DEFAULT NULL,\n PRIMARY KEY (`id`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3"},{"name":"project_members","type":"BASE TABLE","comment":"プロジェクト所属者テーブル","columns":[{"name":"project_id","type":"char(36)","nullable":false,"default":null,"comment":"プロジェクトUUID"},{"name":"user_id","type":"char(36)","nullable":false,"default":null,"comment":"ユーザーUUID"},{"name":"since_year","type":"smallint(4)","nullable":false,"default":null,"comment":"プロジェクト所属開始年"},{"name":"since_semester","type":"tinyint(1)","nullable":false,"default":null,"comment":"プロジェクト所属開始学期(0:前期 1:後期)"},{"name":"until_year","type":"smallint(4)","nullable":false,"default":null,"comment":"プロジェクト所属終了年"},{"name":"until_semester","type":"tinyint(1)","nullable":false,"default":null,"comment":"プロジェクト所属終了学期(0:前期 1:後期)"},{"name":"created_at","type":"datetime(6)","nullable":true,"default":"NULL","comment":""},{"name":"updated_at","type":"datetime(6)","nullable":true,"default":"NULL","comment":""}],"indexes":[{"name":"fk_project_members_user","def":"KEY fk_project_members_user (user_id) USING BTREE","table":"project_members","columns":["user_id"],"comment":""},{"name":"PRIMARY","def":"PRIMARY KEY (project_id, user_id) USING BTREE","table":"project_members","columns":["project_id","user_id"],"comment":""}],"constraints":[{"name":"fk_project_members_project","type":"FOREIGN KEY","def":"FOREIGN KEY (project_id) REFERENCES projects (id)","table":"project_members","referenced_table":"projects","columns":["project_id"],"referenced_columns":["id"],"comment":""},{"name":"fk_project_members_user","type":"FOREIGN KEY","def":"FOREIGN KEY (user_id) REFERENCES users (id)","table":"project_members","referenced_table":"users","columns":["user_id"],"referenced_columns":["id"],"comment":""},{"name":"PRIMARY","type":"PRIMARY KEY","def":"PRIMARY KEY (project_id, user_id)","table":"project_members","referenced_table":null,"columns":["project_id","user_id"],"referenced_columns":null,"comment":""}],"triggers":[],"def":"CREATE TABLE `project_members` (\n `project_id` char(36) NOT NULL,\n `user_id` char(36) NOT NULL,\n `since_year` smallint(4) NOT NULL,\n `since_semester` tinyint(1) NOT NULL,\n `until_year` smallint(4) NOT NULL,\n `until_semester` tinyint(1) NOT NULL,\n `created_at` datetime(6) DEFAULT NULL,\n `updated_at` datetime(6) DEFAULT NULL,\n PRIMARY KEY (`project_id`,`user_id`),\n KEY `fk_project_members_user` (`user_id`),\n CONSTRAINT `fk_project_members_project` FOREIGN KEY (`project_id`) REFERENCES `projects` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,\n CONSTRAINT `fk_project_members_user` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3"},{"name":"users","type":"BASE TABLE","comment":"ユーザーテーブル","columns":[{"name":"id","type":"char(36)","nullable":false,"default":null,"comment":"ユーザーUUID"},{"name":"description","type":"text","nullable":false,"default":null,"comment":"自己紹介文"},{"name":"check","type":"tinyint(1)","nullable":false,"default":"0","comment":"氏名を公開するかどうかの可否 (0: 停止, 1: 有効, 2: 一時停止)"},{"name":"name","type":"varchar(32)","nullable":false,"default":null,"comment":"ユーザー名"},{"name":"state","type":"tinyint(1)","nullable":false,"default":null,"comment":"traQのユーザーアカウント状態"},{"name":"created_at","type":"datetime(6)","nullable":true,"default":"NULL","comment":""},{"name":"updated_at","type":"datetime(6)","nullable":true,"default":"NULL","comment":""}],"indexes":[{"name":"PRIMARY","def":"PRIMARY KEY (id) USING BTREE","table":"users","columns":["id"],"comment":""},{"name":"uni_users_name","def":"UNIQUE KEY uni_users_name (name) USING BTREE","table":"users","columns":["name"],"comment":""}],"constraints":[{"name":"PRIMARY","type":"PRIMARY KEY","def":"PRIMARY KEY (id)","table":"users","referenced_table":null,"columns":["id"],"referenced_columns":null,"comment":""},{"name":"uni_users_name","type":"UNIQUE","def":"UNIQUE KEY uni_users_name (name)","table":"users","referenced_table":null,"columns":["name"],"referenced_columns":null,"comment":""}],"triggers":[],"def":"CREATE TABLE `users` (\n `id` char(36) NOT NULL,\n `description` text NOT NULL,\n `check` tinyint(1) NOT NULL DEFAULT 0,\n `name` varchar(32) NOT NULL,\n `state` tinyint(1) NOT NULL,\n `created_at` datetime(6) DEFAULT NULL,\n `updated_at` datetime(6) DEFAULT NULL,\n PRIMARY KEY (`id`),\n UNIQUE KEY `uni_users_name` (`name`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3"}],"relations":[{"table":"accounts","columns":["user_id"],"cardinality":"Zero or more","parent_table":"users","parent_columns":["id"],"parent_cardinality":"Exactly one","def":"FOREIGN KEY (user_id) REFERENCES users (id)","virtual":false},{"table":"contest_teams","columns":["contest_id"],"cardinality":"Zero or more","parent_table":"contests","parent_columns":["id"],"parent_cardinality":"Exactly one","def":"FOREIGN KEY (contest_id) REFERENCES contests (id)","virtual":false},{"table":"contest_team_user_belongings","columns":["team_id"],"cardinality":"Zero or more","parent_table":"contest_teams","parent_columns":["id"],"parent_cardinality":"Exactly one","def":"FOREIGN KEY (team_id) REFERENCES contest_teams (id)","virtual":false},{"table":"contest_team_user_belongings","columns":["user_id"],"cardinality":"Zero or more","parent_table":"users","parent_columns":["id"],"parent_cardinality":"Exactly one","def":"FOREIGN KEY (user_id) REFERENCES users (id)","virtual":false},{"table":"group_user_admins","columns":["group_id"],"cardinality":"Zero or more","parent_table":"groups","parent_columns":["group_id"],"parent_cardinality":"Exactly one","def":"FOREIGN KEY (group_id) REFERENCES groups (group_id)","virtual":false},{"table":"group_user_belongings","columns":["group_id"],"cardinality":"Zero or more","parent_table":"groups","parent_columns":["group_id"],"parent_cardinality":"Exactly one","def":"FOREIGN KEY (group_id) REFERENCES groups (group_id)","virtual":false},{"table":"group_user_belongings","columns":["user_id"],"cardinality":"Zero or more","parent_table":"users","parent_columns":["id"],"parent_cardinality":"Exactly one","def":"FOREIGN KEY (user_id) REFERENCES users (id)","virtual":false},{"table":"project_members","columns":["project_id"],"cardinality":"Zero or more","parent_table":"projects","parent_columns":["id"],"parent_cardinality":"Exactly one","def":"FOREIGN KEY (project_id) REFERENCES projects (id)","virtual":false},{"table":"project_members","columns":["user_id"],"cardinality":"Zero or more","parent_table":"users","parent_columns":["id"],"parent_cardinality":"Exactly one","def":"FOREIGN KEY (user_id) REFERENCES users (id)","virtual":false}],"functions":[],"driver":{"name":"mariadb","database_version":"10.6.4-MariaDB-1:10.6.4+maria~focal","meta":{"dict":{"Functions":"Stored procedures and functions"}}}} diff --git a/docs/dbschema/users.md b/docs/dbschema/users.md index e16b757b..99598ba5 100644 --- a/docs/dbschema/users.md +++ b/docs/dbschema/users.md @@ -95,9 +95,8 @@ erDiagram datetime_6_ updated_at } "project_members" { - char_36_ id PK - char_36_ project_id FK - char_36_ user_id FK + char_36_ project_id PK + char_36_ user_id PK smallint_4_ since_year tinyint_1_ since_semester smallint_4_ until_year