我刚接触过RoR。当我更新我的数据库时,我真的很困惑。我在数据库中添加了一些表,然后我想更新schema.rb,所以我使用rake db:schema:dump。一切都很顺利。在前面的命令之后,我立即使用了rake db:schema:load,但出现了一个错误:
Mysql2::Error: Incorrect column specifier for column 'partition': CREATE TABLE `ab_test_result` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `model_id` int(11), `group_id` int(11), `kpi` varchar(255), `related_info` varchar(255), `category` varchar(255), `task_group_run_id` int(11), `timestamp` datetime, `partition` float(64), `actual_partition` float(64)) ENGINE=InnoDB这是怎么发生的?我该怎么办?谢谢。
发布于 2014-02-19 14:04:20
schema.rb由迁移处理。您不需要每次都进行转储加载。
生成迁移:
rails generate migration foo_bar您可以编写迁移的代码,然后
rake db:migrate如果迁移成功,则更新schema.rb
https://stackoverflow.com/questions/21872264
复制相似问题