Skip to content

Instantly share code, notes, and snippets.

@gabidavila

gabidavila/blog.sql Secret

Created Sep 2, 2016
Embed
What would you like to do?
--
-- Table structure for table `users`
--
CREATE TABLE `users` (
`id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`name` VARCHAR(255) DEFAULT NULL,
`email` VARCHAR(255) DEFAULT NULL,
`country` CHAR(2) DEFAULT NULL,
`created` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
)
ENGINE = InnoDB;
--
-- Table structure for table `comments`
--
CREATE TABLE `comments` (
`id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`user_id` INT(11) UNSIGNED NOT NULL,
`post_id` INT(11) DEFAULT NULL,
`message` TEXT,
`created` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `fk_comments_user_id` (`user_id`),
CONSTRAINT `fk_comments_user_id` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
)
ENGINE = InnoDB;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.