“pg_dump: invalid option — i” when migrating

后端 未结 5 967
闹比i
闹比i 2021-01-11 10:01

When I run rake db:migrate on my Rails project (3.2.22.2) I get pg_dump: invalid option -- i. Here\'s the full trace:

Celluloid 0.1         


        
5条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-11 10:22

    This error because '-i' method depricated in 9.5.X and higher versions. Bug fixed in Rails -v '4.2.5' and you can update your Rails to this version or upper. But if you need fast method I think you'll satisfied with it (it's just hack, do not use it if you have little bit doubting or you don't agree with it!):

    1) find this file: 'postgresql_database_tasks.rb' (in my case it was):

    /Users/YourUserName/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activerecord-4.2.4/lib/active_record/tasks/postgresql_database_tasks.rb
    

    2) Open it, find and edit line below with remove '-i' from string:

    command = "pg_dump -s -x -O -f #{Shellwords.escape(filename)} #{search_path} #{Shellwords.escape(configuration['database'])}"
    

    3) save this file and start your rake task again! That it!

提交回复
热议问题