运行了bin/rake db:migrate RAILS_ENV=development还是不行。 新手求指点,谢谢大家了!
bin/rake db:migrate RAILS_ENV=development
如果是测试数据库,直接把数据库文件删了重建就 OK 了
RAILS_ENV=development rake db:migrate
#2 楼 @amateur 报错如下
davidlee:smaple_app ft_david$ RAILS_ENV=development rake db:migrate == 20160705132939 AddIndexToUsersEmail: migrating ============================= -- add_index(:users, :email, {:unqiue=>true}) rake aborted! StandardError: An error has occurred, this and all later migrations canceled: Unknown key: :unqiue. Valid keys are: :unique, :order, :name, :where, :length, :internal, :using, :algorithm, :type /Users/ft_david/.rvm/gems/ruby-2.3.0/gems/activesupport-4.2.6/lib/active_support/core_ext/hash/keys.rb:75:in `block in assert_valid_keys'
很明显了,Unknown key: :unqiue. 是 unqiue 拼写错了,正确的是 unique
Unknown key: :unqiue.
unqiue
unique
新手请你先学会看日志,然后学会把关键信息贴到 google 搜下。
#4 楼 @jiemoon 改了之后还是出现 ActiveRecord::PendingMigrationError 这个错误。
#5 楼 @chenjau 恩恩!