1

$ 耙分贝:迁移

==  ChangeFriendListToText: migrating -  ======================================
-- change_column(:profiles, :friend_list, :text)
rake aborted!
An error has occurred, all later migrations canceled:

Can't find file: './shadow_development/profiles.frm' (errno: 13)
/Users/me/.rvm/gems/ruby-1.9.3-p194/gems/mysql2-0.2.18/lib/active_record/connection_adapters/mysql2_adapter.rb:263:in `query'
    /Users/me/.rvm/gems/ruby-1.9.3-p194/gems/mysql2-0.2.18/lib/active_record/connection_adapters/mysql2_adapter.rb:263:in `execute'
    /Users/me/.rvm/gems/ruby-1.9.3-p194/gems/mysql2-0.2.18/lib/active_record/connection_adapters/mysql2_adapter.rb:413:in `columns'
    /Users/me/.rvm/gems/ruby-1.9.3-p194/gems/mysql2-0.2.18/lib/active_record/connection_adapters/mysql2_adapter.rb:598:in `column_for'
    /Users/me/.rvm/gems/ruby-1.9.3-p194/gems/mysql2-0.2.18/lib/active_record/connection_adapters/mysql2_adapter.rb:451:in `change_column'
    /Users/me/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-2.3.14/lib/active_record/migration.rb:352:in `block in method_missing'
    /Users/me/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-2.3.14/lib/active_record/migration.rb:328:in `block in say_with_time'
    /Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mechmark.rb:280:in `measure'
    /Users/me/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-2.3.14/lib/active_record/migration.rb:328:in `say_with_time'
    /Users/me/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-2.3.14/lib/active_record/migration.rb:348:in `method_missing'
    db/migrate//20130110234754_change_friend_list_to_text.rb:3:in `up'
    /Users/me/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-2.3.14/lib/active_record/migration.rb:282:in `block in migrate'
    /Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mechmark.rb:280:in `measure'
    /Users/me/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-2.3.14/lib/active_record/migration.rb:282:in `migrate'
    /Users/me/.rvm/gems/ruby-1.9.3-p194/gems/ar-octopus-0.3.4/lib/octopus/migration.rb:52:in `migrate_with_octopus'
    /Users/me/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-2.3.14/lib/active_record/migration.rb:365:in `migrate'
    /Users/me/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-2.3.14/lib/active_record/migration.rb:491:in `block (2 levels) in migrate'
    /Users/me/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-2.3.14/lib/active_record/migration.rb:567:in `call'
    /Users/me/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-2.3.14/lib/active_record/migration.rb:567:in `ddl_transaction'
    /Users/me/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-2.3.14/lib/active_record/migration.rb:490:in `block in migrate'
    /Users/me/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-2.3.14/lib/active_record/migration.rb:477:in `each'
    /Users/me/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-2.3.14/lib/active_record/migration.rb:477:in `migrate'
    /Users/me/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-2.3.14/lib/active_record/migration.rb:401:in `up'
    /Users/me/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-2.3.14/lib/active_record/migration.rb:383:in `migrate'
    /Users/me/.rvm/gems/ruby-1.9.3-p194/gems/rails-2.3.14/lib/tasks/databases.rake:112:in `block (2 levels) in <top (required)>'
    /Users/me/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'
    /Users/me/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `block in execute'
    /Users/me/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
    /Users/me/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
    /Users/me/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
    /Users/me/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
    /Users/me/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
    /Users/me/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
    /Users/me/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task'
    /Users/me/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block (2 levels) in top_level'
    /Users/me/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each'
    /Users/me/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block in top_level'
    /Users/me/sources/shadow/lib/rake_exceptional.rb:7:in `standard_exception_handling'
    /Users/me/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'
    /Users/me/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `block in run'
    /Users/me/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
    /Users/me/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
    /Users/me/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/bin/rake:33:in `<top (required)>'
    /Users/me/.rvm/gems/ruby-1.9.3-p194@global/bin/rake:19:in `load'
    /Users/me/.rvm/gems/ruby-1.9.3-p194@global/bin/rake:19:in `<main>'
    /Users/me/.rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper:14:in `eval'
    /Users/me/.rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper:14:in `<main>'

$哪个mysql

/usr/local/mysql-5.5.24-osx10.6-x86_64/bin/mysql

$ ls /usr/local/mysql-5.5.24-osx10.6-x86_64/data/shadow_development/profiles.frm

/usr/local/mysql-5.5.24-osx10.6-x86_64/data/shadow_development/profiles.frm

在 Mac OS X 10.7.5 上使用 ruby​​ 1.9.3p194(2012-04-20 修订版 35410)[x86_64-darwin11.3.0] 和 Rails 2.3.14

更新:这是迁移文件:

class ChangeFriendListToText < ActiveRecord::Migration
  def self.up
    change_column :profiles, :friend_list, :text
  end

  def self.down
    change_column :profiles, :friend_list, :string
  end
end
4

1 回答 1

3

原来这是一个权限问题。在该文件上使用chmod允许迁移发生。权限关闭的原因是因为我们最近更改了启动 mysql 的方式,所以以前在我的帐户下创建的东西现在由用户创建_mysql

对于将来遇到此问题的任何其他人,请使用该ls -l命令来识别权限差异。

于 2013-01-24T22:55:27.703 回答