aboutsummaryrefslogtreecommitdiffstats
path: root/core/db/migrations/5.sql
blob: 8e8ecd7a0c01b9df9f600e73b28646d3059b04b8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
ALTER TABLE `page` DROP FOREIGN KEY `page_user`;
ALTER TABLE `post` DROP FOREIGN KEY `post_user`;

ALTER TABLE `page` MODIFY `id` SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT,
	MODIFY `user` TINYINT UNSIGNED NOT NULL;
ALTER TABLE `post` MODIFY `id` SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT,
	MODIFY `user` TINYINT UNSIGNED NOT NULL;
ALTER TABLE `user` MODIFY `id` TINYINT UNSIGNED NOT NULL AUTO_INCREMENT;

ALTER TABLE `page` ADD CONSTRAINT `page_user` FOREIGN KEY (`user`)
	REFERENCES `user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE `post` ADD CONSTRAINT `post_user` FOREIGN KEY (`user`)
	REFERENCES `user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;