Skip to content

Commit

Permalink
Merge pull request #742 from traPtitech/docs/regen-db-docs
Browse files Browse the repository at this point in the history
DBのdocsを再生成した
  • Loading branch information
H1rono authored Dec 29, 2024
2 parents adea612 + a92bb0f commit afc205e
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 37 deletions.
13 changes: 6 additions & 7 deletions docs/dbschema/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -44,7 +44,7 @@ erDiagram
}
"contests" {
char_36_ id PK
varchar_32_ name
varchar_128_ name
text description
text link
datetime_6_ since
Expand All @@ -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
Expand Down Expand Up @@ -103,7 +103,7 @@ erDiagram
}
"projects" {
char_36_ id PK
varchar_32_ name
varchar_128_ name
text description
text link
smallint_4_ since_year
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/dbschema/contest_team_user_belongings.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions docs/dbschema/contest_teams.md
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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 | | | コンテストチームの詳細が載っているページへのリンク |
Expand Down Expand Up @@ -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
Expand All @@ -78,7 +78,7 @@ erDiagram
}
"contests" {
char_36_ id PK
varchar_32_ name
varchar_128_ name
text description
text link
datetime_6_ since
Expand Down
8 changes: 4 additions & 4 deletions docs/dbschema/contests.md
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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 | | | 期間始まり |
Expand Down Expand Up @@ -57,7 +57,7 @@ erDiagram
"contests" {
char_36_ id PK
varchar_32_ name
varchar_128_ name
text description
text link
datetime_6_ since
Expand All @@ -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
Expand Down
17 changes: 6 additions & 11 deletions docs/dbschema/project_members.md
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
Expand All @@ -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 | | | プロジェクト所属開始年 |
Expand All @@ -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

Expand All @@ -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
Expand All @@ -79,7 +74,7 @@ erDiagram
}
"projects" {
char_36_ id PK
varchar_32_ name
varchar_128_ name
text description
text link
smallint_4_ since_year
Expand Down
11 changes: 5 additions & 6 deletions docs/dbschema/projects.md
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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 | | | プロジェクト開始年 |
Expand Down Expand Up @@ -61,7 +61,7 @@ erDiagram
"projects" {
char_36_ id PK
varchar_32_ name
varchar_128_ name
text description
text link
smallint_4_ since_year
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/dbschema/schema.json

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions docs/dbschema/users.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit afc205e

Please sign in to comment.