aboutsummaryrefslogtreecommitdiffstats
path: root/core/db/migrations
diff options
context:
space:
mode:
Diffstat (limited to 'core/db/migrations')
-rw-r--r--core/db/migrations/5.sql13
1 files changed, 13 insertions, 0 deletions
diff --git a/core/db/migrations/5.sql b/core/db/migrations/5.sql
new file mode 100644
index 0000000..8e8ecd7
--- /dev/null
+++ b/core/db/migrations/5.sql
@@ -0,0 +1,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;