我有迁移:
功能向上:
$this->createTable(
'vacancy_moderate',
array(
'id' => 'int(10) unsigned NOT NULL AUTO_INCREMENT',
'period_days' => 'tinyint(4) NOT NULL',
'title' => 'varchar(255) NOT NULL DEFAULT \'\'',
'price'=> 'int(11) DEFAULT NULL',
'requirements'=> 'text NOT NULL',
'conditions'=> 'text',
'contact_details'=> 'text NOT NULL',
'country_id'=> 'int(10) unsigned NOT NULL',
'city_id'=> 'int(10) unsigned DEFAULT NULL',
'user_id'=> 'int(10) unsigned DEFAULT NULL',
'club_id'=> 'int(10) DEFAULT NULL',
'PRIMARY KEY (`id`)',
'KEY `city_id` (`city_id`)',
'KEY `user_id` (`user_id`)',
'KEY `country_id` (`country_id`)',
'KEY `club_id` (`club_id`)',
'CONSTRAINT `vacancy_moderate_ibfk_1` FOREIGN KEY (`city_id`) REFERENCES `city` (`id`) ON UPDATE CASCADE',
'CONSTRAINT `vacancy_moderate_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE SET NULL ON UPDATE CASCADE',
'CONSTRAINT `vacancy_moderate_ibfk_3` FOREIGN KEY (`country_id`) REFERENCES `country` (`id`) ON UPDATE CASCADE',
'CONSTRAINT `vacancy_moderate_ibfk_4` FOREIGN KEY (`club_id`) REFERENCES `clubs` (`id`) ON UPDATE CASCADE'
),
'ENGINE=InnoDB DEFAULT CHARSET=utf8'
);
功能向下:
$this->dropTable('vacancy_moderate');
问题: 我应该手动删除所有外键还是将它们删除到 dropTable 中?