•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the MySQL section within the Web Development category of DaniWeb, a massive community of 373,936 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,600 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our MySQL advertiser:
Views: 342 | Replies: 0 | Solved
![]() |
•
•
Join Date: Apr 2008
Posts: 1
Reputation:
Rep Power: 0
Solved Threads: 0
Hello all,
I am using MySQL version: 5.0.37
I am creating a forum. I am designing the tables for the threads and their replies and the relationship between them. Please have a look at these images and give me your thoughts. I have also included the schema.
http://i284.photobucket.com/albums/l...ableDesign.jpg
http://i284.photobucket.com/albums/l...ogicDesign.jpg
1) Is the on cascade correct, i have them in both tables? If a thread reply was deleted would it delete the actual thread - the first post?
Thanks all,
I am using MySQL version: 5.0.37
I am creating a forum. I am designing the tables for the threads and their replies and the relationship between them. Please have a look at these images and give me your thoughts. I have also included the schema.
http://i284.photobucket.com/albums/l...ableDesign.jpg
http://i284.photobucket.com/albums/l...ogicDesign.jpg
CREATE TABLE Threads (
threadID INT NOT NULL AUTO_INCREMENT
, threadSubject VARCHAR(100) NOT NULL
, threadContent TEXT NOT NULL
, link VARCHAR(200)
, poster VARCHAR(100) NOT NULL
, PRIMARY KEY (threadID)
);
CREATE TABLE ThreadReplies (
replyID INT NOT NULL AUTO_INCREMENT
, replySubject VARCHAR(100)
, replyContent TEXT NOT NULL
, poster VARCHAR(100) NOT NULL
, PRIMARY KEY (replyID)
);
CREATE TABLE ThreadsRepliesRelationship (
threadID INT NOT NULL
, replyID INT NOT NULL
, INDEX (threadID)
, CONSTRAINT ThreadsFK FOREIGN KEY (threadID)
REFERENCES Threads (threadID) ON DELETE CASCADE
, INDEX (replyID)
, CONSTRAINT RepliesFK FOREIGN KEY (replyID)
REFERENCES ThreadReplies (replyID) ON DELETE CASCADE
);1) Is the on cascade correct, i have them in both tables? If a thread reply was deleted would it delete the actual thread - the first post?
Thanks all,
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb MySQL Marketplace
- Previous Thread: saving image as longblob
- Next Thread: help for log files


Linear Mode