2012-03-13 3 views
0

Я бегу «Heroku запустить грабли БД: мигрировать» после того, как я развернуто мое приложение Heroku и я получаю это:RoR развертывания приложений

$ >> Heroku запустить грабли БД: мигрировать

Running rake db:migrate attached to terminal... up, run.1 
DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/01/04/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/Rakefile:7) 
DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/01/04/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/Rakefile:7) 
DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/01/04/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/Rakefile:7) 
rake aborted! 
Please install the postgresql adapter: `gem install activerecord-postgresql-adapter` (pg is not part of the bundle. Add it to Gemfile.) 

Tasks: TOP => db:migrate => db:load_config 
(See full trace by running task with --trace) 

Я пытаюсь установить упомянутый драгоценный камень, но ничего не происходит. Я использую rails3 в рубин 1.9.3, и мой файл database.yml содержит:

# SQLite version 3.x 
# gem install sqlite3 
# 
# Ensure the SQLite 3 gem is defined in your Gemfile 
# gem 'sqlite3' 
development: 
    adapter: sqlite3 
    database: db/development.sqlite3 
    pool: 5 
    timeout: 5000 

# Warning: The database defined as "test" will be erased and 
# re-generated from your development database when you run "rake". 
# Do not set this db to the same as development or production. 
test: 
    adapter: sqlite3 
    database: db/test.sqlite3 
    pool: 5 
    timeout: 5000 

production: 
    adapter: sqlite3 
    database: db/production.sqlite3 
    pool: 5 
    timeout: 5000 

Как я могу исправить эту ошибку?

EDIT:

работает установка $ >> Судо камень пг -v '0.13.2'

Building native extensions. This could take a while... 
ERROR: Error installing pg: 
    ERROR: Failed to build gem native extension. 

     /usr/bin/ruby1.8 extconf.rb 
checking for pg_config... no 
No pg_config... trying anyway. If building fails, please try again with 
--with-pg-config=/path/to/pg_config 
checking for libpq-fe.h... no 
Can't find the 'libpq-fe.h header 
*** extconf.rb failed *** 
Could not create Makefile due to some reason, probably lack of 
necessary libraries and/or headers. Check the mkmf.log file for more 
details. You may need configuration options. 

Provided configuration options: 
    --with-opt-dir 
    --without-opt-dir 
    --with-opt-include 
    --without-opt-include=${opt-dir}/include 
    --with-opt-lib 
    --without-opt-lib=${opt-dir}/lib 
    --with-make-prog 
    --without-make-prog 
    --srcdir=. 
    --curdir 
    --ruby=/usr/bin/ruby1.8 
    --with-pg 
    --without-pg 
    --with-pg-dir 
    --without-pg-dir 
    --with-pg-include 
    --without-pg-include=${pg-dir}/include 
    --with-pg-lib 
    --without-pg-lib=${pg-dir}/lib 
    --with-pg-config 
    --without-pg-config 
    --with-pg_config 
    --without-pg_config 


Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/pg-0.13.2 for inspection. 
Results logged to /usr/lib/ruby/gems/1.8/gems/pg-0.13.2/ext/gem_make.out 

Я получаю эту ошибку. Опять же я использую версию ruby ​​1.9.3.

+0

Вы пытаетесь использовать postgresql или sqlite3? –

ответ

1

Ваша база данных.yml настроена на использование sqlite3.

Если вы хотите использовать postgresql, вам нужно сначала установить postgres на свой компьютер.

Для Linux:

sudo apt-get install postgresql 

Для Max OS X:

brew install postgresql 

сделать у вас есть homebrew установлен первый.

heroku автогенерирует базу данных.yml при развертывании. Читает как: неважно, что вы вложили в свой файл database.yml, который для меня приятный, поскольку я могу включить его в git, не беспокоясь о паролях производства db.

Затем установите пг камень, поместив это в Gemfile:

камень «пг»: требуют => «пг»

, если вы используете старую версию Rails использовать самоцвет метод установки ,

+0

Его нет. btw Я редактировал вопрос –

+0

Эрик, Героку всегда использует Postgres, независимо от того, что вы положили в 'database.yml'. Но, если вы не загружаете свой собственный SQL, нет вреда для запуска SQLite локально и Postgres на Heroku.Первоначальная проблема OP была связана с развертыванием Heroku; теперь он столкнулся с другой проблемой, устанавливающей Postgres локально, что отличается от того, о чем был исходный вопрос. –

+0

ОК, я вижу, вы отредактировали свой ответ, чтобы отразить это. –

0

Попробуйте добавить драгоценный камень «pg» в свой Gemfile (а затем bundle install).

+0

Database.yml показывает, что он не использует postgresql @alex –

+0

, как его настроить для использования postgersql? –

+0

@Alex D: Я отредактировал свой вопрос –