Delete post fix, proper cascading on comments
This commit is contained in:
parent
61ab9e072e
commit
d2eac68638
2 changed files with 10 additions and 3 deletions
|
|
@ -6,9 +6,9 @@ CREATE TABLE IF NOT EXISTS comments (
|
|||
content TEXT NOT NULL,
|
||||
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY (parent_post_id) REFERENCES posts (id),
|
||||
FOREIGN KEY (parent_post_id) REFERENCES posts (id) ON DELETE CASCADE,
|
||||
-- FOREIGN KEY (parent_comment_id) REFERENCES comments (id),
|
||||
FOREIGN KEY (author_user_id) REFERENCES users (id)
|
||||
FOREIGN KEY (author_user_id) REFERENCES users (id) ON DELETE CASCADE
|
||||
);
|
||||
|
||||
-- Create a function to set created_at and updated_at on INSERT
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue