Skip to content

Instantly share code, notes, and snippets.

@gabidavila
Created September 2, 2016 01:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gabidavila/8496c877fdbfbe8b24740bc4c2126a29 to your computer and use it in GitHub Desktop.
Save gabidavila/8496c877fdbfbe8b24740bc4c2126a29 to your computer and use it in GitHub Desktop.
--
-- 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