Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
bytebase-demo
Blog
Commits
d7f3b88b
Commit
d7f3b88b
authored
Jun 28, 2021
by
tianzhou
Browse files
Create user, post, comment table for dev environment
parent
c4233a36
Changes
1
Hide whitespace changes
Inline
Side-by-side
bytebase/dev/202106280000__blog__baseline__add_initial_schema.sql
0 → 100644
View file @
d7f3b88b
CREATE
TABLE
`user`
(
id
INTEGER
PRIMARY
KEY
AUTO_INCREMENT
,
name
TEXT
NOT
NULL
,
email
TEXT
NOT
NULL
);
CREATE
TABLE
post
(
id
INTEGER
PRIMARY
KEY
AUTO_INCREMENT
,
name
TEXT
NOT
NULL
,
content
TEXT
NOT
NULL
,
author_id
INTEGER
NOT
NULL
,
FOREIGN
KEY
(
author_id
)
REFERENCES
`user`
(
id
)
ON
DELETE
RESTRICT
);
CREATE
TABLE
comment
(
id
INTEGER
PRIMARY
KEY
AUTO_INCREMENT
,
content
TEXT
NOT
NULL
,
post_id
INTEGER
NOT
NULL
,
author_id
INTEGER
NOT
NULL
,
FOREIGN
KEY
(
post_id
)
REFERENCES
post
(
id
)
ON
DELETE
CASCADE
,
FOREIGN
KEY
(
author_id
)
REFERENCES
`user`
(
id
)
ON
DELETE
RESTRICT
);
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment