ALTER TABLE `qs_Post` DROP `authorType`, DROP `authorId`; ALTER TABLE `qs_PostComment` DROP `authorId`, DROP `authorType`; ALTER TABLE `qs_Post` ADD `createdById` INT NULL AFTER `id`; ALTER TABLE `qs_Post` ADD INDEX(`createdById`); ALTER TABLE `qs_Post` ADD FOREIGN KEY (`createdById`) REFERENCES `qs_Admin`(`id`) ON DELETE SET NULL ON UPDATE CASCADE; ALTER TABLE `qs_PostComment` ADD `createdBy` ENUM('admin','user') NULL AFTER `idPost`, ADD `createdById` INT NULL DEFAULT NULL AFTER `createdBy`;