1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| SET foreign_key_checks = 0;
DROP TABLE IF EXISTS `md_articles`;
CREATE TABLE `md_articles` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(128) NOT NULL,
`subtitle` mediumtext NOT NULL,
`content` mediumtext NOT NULL,
`created_at` datetime NOT NULL,
`updated_at` datetime DEFAULT NULL,
`deleted_at` datetime DEFAULT NULL,
`url` varchar(160) DEFAULT NULL,
`author_id` int(11) NOT NULL,
`category_id` int(11) NOT NULL,
PRIMARY KEY (`id`),
KEY `author_id` (`author_id`),
KEY `category_id` (`category_id`),
CONSTRAINT `articles_ibfk_1` FOREIGN KEY (`author_id`) REFERENCES `md_authors` (`id`),
CONSTRAINT `articles_ibfk_2` FOREIGN KEY (`category_id`) REFERENCES `md_categories` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; |
Partager