-- Widen questions.question_id and set AUTO_INCREMENT; align statements.question_id; fix FK

-- Drop FK if exists to allow column type change
ALTER TABLE `statements` DROP FOREIGN KEY `fk_q`;

-- Widen PK and enable AUTO_INCREMENT on questions
ALTER TABLE `questions`
  MODIFY `question_id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT;

-- Align statements FK column type
ALTER TABLE `statements`
  MODIFY `question_id` INT(10) UNSIGNED NOT NULL;

-- Recreate FK
ALTER TABLE `statements`
  ADD CONSTRAINT `fk_q` FOREIGN KEY (`question_id`) REFERENCES `questions`(`question_id`);

