-
Notifications
You must be signed in to change notification settings - Fork 171
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #74 from k1LoW/primary-key-and-foreign-key
Fix the bug that foreign key constraints are not listed in the document and ER diagram in the case of primary key and foreign key
- Loading branch information
Showing
41 changed files
with
547 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# user_options | ||
|
||
## Description | ||
|
||
User options table | ||
|
||
## Columns | ||
|
||
| Name | Type | Default | Nullable | Children | Parents | Comment | | ||
| ---------- | --------------------------- | ------- | -------- | -------- | ----------------- | ------- | | ||
| user_id | integer | | false | | [users](users.md) | | | ||
| show_email | boolean | false | false | | | | | ||
| created | timestamp without time zone | | false | | | | | ||
| updated | timestamp without time zone | | true | | | | | ||
|
||
## Constraints | ||
|
||
| Name | Type | Definition | | ||
| ----------------------- | ----------- | ------------------------------------------------------------ | | ||
| user_options_user_id_fk | FOREIGN KEY | FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE | | ||
| user_options_pkey | PRIMARY KEY | PRIMARY KEY (user_id) | | ||
|
||
## Indexes | ||
|
||
| Name | Definition | | ||
| ----------------- | ---------------------------------------------------------------------------------- | | ||
| user_options_pkey | CREATE UNIQUE INDEX user_options_pkey ON public.user_options USING btree (user_id) | | ||
|
||
## Relations | ||
|
||
 | ||
|
||
--- | ||
|
||
> Generated by [tbls](https://github.com/k1LoW/tbls) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# user_options | ||
|
||
## Description | ||
|
||
User options table | ||
|
||
<details> | ||
<summary><strong>Table Definition</strong></summary> | ||
|
||
```sql | ||
CREATE TABLE `user_options` ( | ||
`user_id` int(11) NOT NULL, | ||
`show_email` tinyint(1) NOT NULL DEFAULT '0', | ||
`created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, | ||
`updated` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', | ||
PRIMARY KEY (`user_id`), | ||
CONSTRAINT `user_options_user_id_fk` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) | ||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='User options table' | ||
``` | ||
|
||
</details> | ||
|
||
## Columns | ||
|
||
| Name | Type | Default | Nullable | Children | Parents | Comment | | ||
| ---- | ---- | ------- | -------- | -------- | ------- | ------- | | ||
| user_id | int(11) | | false | | [users](users.md) | | | ||
| show_email | tinyint(1) | 0 | false | | | | | ||
| created | timestamp | CURRENT_TIMESTAMP | false | | | | | ||
| updated | timestamp | 0000-00-00 00:00:00 | false | | | | | ||
|
||
## Constraints | ||
|
||
| Name | Type | Definition | | ||
| ---- | ---- | ---------- | | ||
| PRIMARY | PRIMARY KEY | PRIMARY KEY (user_id) | | ||
| user_options_user_id_fk | FOREIGN KEY | FOREIGN KEY (user_id) REFERENCES users (id) | | ||
|
||
## Indexes | ||
|
||
| Name | Definition | | ||
| ---- | ---------- | | ||
| PRIMARY | PRIMARY KEY (user_id) USING BTREE | | ||
|
||
## Relations | ||
|
||
 | ||
|
||
--- | ||
|
||
> Generated by [tbls](https://github.com/k1LoW/tbls) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# user_options | ||
|
||
## Description | ||
|
||
User options table | ||
|
||
<details> | ||
<summary><strong>Table Definition</strong></summary> | ||
|
||
```sql | ||
CREATE TABLE `user_options` ( | ||
`user_id` int(11) NOT NULL, | ||
`show_email` tinyint(1) NOT NULL DEFAULT '0', | ||
`created` timestamp NOT NULL, | ||
`updated` timestamp NULL DEFAULT NULL, | ||
PRIMARY KEY (`user_id`), | ||
CONSTRAINT `user_options_user_id_fk` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE | ||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='User options table' | ||
``` | ||
|
||
</details> | ||
|
||
## Columns | ||
|
||
| Name | Type | Default | Nullable | Children | Parents | Comment | | ||
| ---- | ---- | ------- | -------- | -------- | ------- | ------- | | ||
| user_id | int(11) | | false | | [users](users.md) | | | ||
| show_email | tinyint(1) | 0 | false | | | | | ||
| created | timestamp | | false | | | | | ||
| updated | timestamp | | true | | | | | ||
|
||
## Constraints | ||
|
||
| Name | Type | Definition | | ||
| ---- | ---- | ---------- | | ||
| PRIMARY | PRIMARY KEY | PRIMARY KEY (user_id) | | ||
| user_options_user_id_fk | FOREIGN KEY | FOREIGN KEY (user_id) REFERENCES users (id) | | ||
|
||
## Indexes | ||
|
||
| Name | Definition | | ||
| ---- | ---------- | | ||
| PRIMARY | PRIMARY KEY (user_id) USING BTREE | | ||
|
||
## Relations | ||
|
||
 | ||
|
||
--- | ||
|
||
> Generated by [tbls](https://github.com/k1LoW/tbls) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# user_options | ||
|
||
## Description | ||
|
||
User options table | ||
|
||
## Columns | ||
|
||
| Name | Type | Default | Nullable | Children | Parents | Comment | | ||
| ---- | ---- | ------- | -------- | -------- | ------- | ------- | | ||
| user_id | integer | | false | | [users](users.md) | | | ||
| show_email | boolean | false | false | | | | | ||
| created | timestamp without time zone | | false | | | | | ||
| updated | timestamp without time zone | | true | | | | | ||
|
||
## Constraints | ||
|
||
| Name | Type | Definition | | ||
| ---- | ---- | ---------- | | ||
| user_options_user_id_fk | FOREIGN KEY | FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE | | ||
| user_options_pkey | PRIMARY KEY | PRIMARY KEY (user_id) | | ||
|
||
## Indexes | ||
|
||
| Name | Definition | | ||
| ---- | ---------- | | ||
| user_options_pkey | CREATE UNIQUE INDEX user_options_pkey ON public.user_options USING btree (user_id) | | ||
|
||
## Relations | ||
|
||
 | ||
|
||
--- | ||
|
||
> Generated by [tbls](https://github.com/k1LoW/tbls) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# user_options | ||
|
||
## Description | ||
|
||
<details> | ||
<summary><strong>Table Definition</strong></summary> | ||
|
||
```sql | ||
CREATE TABLE user_options ( | ||
user_id INTEGER PRIMARY KEY, | ||
show_email INTEGER NOT NULL DEFAULT 0, | ||
created NUMERIC NOT NULL, | ||
updated NUMERIC, | ||
CONSTRAINT user_options_user_id_fk FOREIGN KEY(user_id) REFERENCES users(id) MATCH NONE ON UPDATE NO ACTION ON DELETE CASCADE | ||
) | ||
``` | ||
|
||
</details> | ||
|
||
## Columns | ||
|
||
| Name | Type | Default | Nullable | Children | Parents | Comment | | ||
| ---- | ---- | ------- | -------- | -------- | ------- | ------- | | ||
| user_id | INTEGER | | true | | [users](users.md) | | | ||
| show_email | INTEGER | 0 | false | | | | | ||
| created | NUMERIC | | false | | | | | ||
| updated | NUMERIC | | true | | | | | ||
|
||
## Constraints | ||
|
||
| Name | Type | Definition | | ||
| ---- | ---- | ---------- | | ||
| user_id | PRIMARY KEY | PRIMARY KEY (user_id) | | ||
| - (Foreign key ID: 0) | FOREIGN KEY | FOREIGN KEY (user_id) REFERENCES users (id) ON UPDATE NO ACTION ON DELETE CASCADE MATCH NONE | | ||
|
||
## Relations | ||
|
||
 | ||
|
||
--- | ||
|
||
> Generated by [tbls](https://github.com/k1LoW/tbls) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.