ci: add first draft of MySQL data schema
This commit is contained in:
parent
1862ccbbb6
commit
57d6d82be9
3 changed files with 60 additions and 5 deletions
|
@ -0,0 +1,48 @@
|
|||
|
||||
CREATE DATABASE dragon_fire;
|
||||
|
||||
USE dragon_fire;
|
||||
|
||||
CREATE TABLE posts (
|
||||
post_id INTEGER AUTO_INCREMENT,
|
||||
|
||||
post_path VARCHAR(255) NOT NULL,
|
||||
post_path_depth INTEGER NOT NULL DEFAULT 0,
|
||||
|
||||
post_title TEXT,
|
||||
post_description TEXT,
|
||||
post_brief TEXT,
|
||||
|
||||
post_content MEDIUMTEXT,
|
||||
post_content_type TEXT,
|
||||
|
||||
PRIMARY KEY(post_id),
|
||||
CONSTRAINT unique_post_path UNIQUE (post_path),
|
||||
|
||||
INDEX(post_path),
|
||||
INDEX(post_path_depth, post_path)
|
||||
);
|
||||
|
||||
CREATE TABLE post_tags (
|
||||
post_id INTEGER,
|
||||
tag VARCHAR(255),
|
||||
|
||||
CONSTRAINT post_fkey
|
||||
FOREIGN KEY(post_id) REFERENCES posts(post_id)
|
||||
ON DELETE CASCADE,
|
||||
|
||||
INDEX(post_id),
|
||||
INDEX(tag)
|
||||
);
|
||||
|
||||
|
||||
INSERT INTO posts (post_path, post_title, post_content)
|
||||
VALUES (
|
||||
'/about',
|
||||
'About the Dergs',
|
||||
'
|
||||
# About the dergs indeed
|
||||
|
||||
This is just a simple test. Might be nice, though!
|
||||
'
|
||||
);
|
Loading…
Add table
Add a link
Reference in a new issue