Created
March 5, 2013 12:36
-
-
Save daum/5090032 to your computer and use it in GitHub Desktop.
Quick Example
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
CREATE TABLE IF NOT EXISTS `post` ( | |
`id` INT NOT NULL AUTO_INCREMENT , | |
`name` VARCHAR(32) NULL , | |
PRIMARY KEY (`id`) ) | |
ENGINE = InnoDB | |
CREATE TABLE IF NOT EXISTS `post_attachment` ( | |
`id` INT NOT NULL AUTO_INCREMENT , | |
`name` VARCHAR(32) NULL , | |
`url` VARCHAR(32) NULL , | |
`post_id` INT NOT NULL , | |
PRIMARY KEY (`id`) , | |
INDEX `fk_post_attachment_post_idx` (`post_id` ASC) , | |
CONSTRAINT `fk_post_attachment_post` | |
FOREIGN KEY (`post_id` ) | |
REFERENCES `post` (`id` ) | |
ON DELETE CASCADE | |
ON UPDATE CASCADE) | |
ENGINE = InnoDB |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment