2014-09-16 2 views
1

Я успешно создал приложение на nitrous.io и инициализировал базу данных postgres для этого приложения. Теперь я пытаюсь настроить базу данных для второго приложения в том же поле.Невозможно создать базу данных на Nitrous.io

Когда я бегу расслоение Exec грабли БД: создать для нового приложения, я получаю следующее сообщение об ошибке

rake aborted!
development database is not configured /home/action/.rvm/gems/ruby-2.0.0-p247/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_specification.rb:39:in `resolve_string_connection'
/home/action/.rvm/gems/ruby-2.0.0-p247/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_specification.rb:25:in `spec'
/home/action/.rvm/gems/ruby-2.0.0-p247/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_specification.rb:130:in `establish_connection'
/home/action/.rvm/gems/ruby-2.0.0-p247/gems/activerecord-3.2.13/lib/active_record/railties/databases.rake:63:in `block (2 levels) in <top (required)>'
Tasks: TOP => db:create
(See full trace by running task with --trace)

Если я бегу расслоение EXEC грабли БД: создать: все, я получаю следующее сообщение об ошибке сообщение:

rake aborted!
undefined method `[]' for nil:NilClass
/home/action/.rvm/gems/ruby-2.0.0-p247/gems/activerecord-3.2.13/lib/active_record/railties/databases.rake:50:in `block (4 levels) in <top (required)>'
/home/action/.rvm/gems/ruby-2.0.0-p247/gems/activerecord-3.2.13/lib/active_record/railties/databases.rake:38:in `each_value'
/home/action/.rvm/gems/ruby-2.0.0-p247/gems/activerecord-3.2.13/lib/active_record/railties/databases.rake:38:in `block (3 levels) in <top (required)>'
Tasks: TOP => db:create:all
(See full trace by running task with --trace
Итак, какой правильный метод для создания базы данных?

Мой дб/database.yml файл выглядит следующим образом:

# database configuration for Nitrous.io 
development: 
adapter: postgresql 
encoding: unicode 
database: better_life-dev 
pool: 5 
host: localhost 
username: action 
password: 
    # Connect on a TCP socket. Omitted by default since the client uses a 
    # domain socket that doesn't need configuration. Windows does not have 
    # domain sockets, so uncomment these lines. 
    #host: localhost 

    # The TCP port the server listens on. Defaults to 5432. 
    # If your server runs on a different port number, change accordingly. 
    #port: 5432 

    # Schema search path. The server defaults to $user,public 
    #schema_search_path: myapp,sharedapp,public 

    # Minimum log levels, in increasing order: 
    # debug5, debug4, debug3, debug2, debug1, 
    # log, notice, warning, error, fatal, and panic 
    # Defaults to warning. 
    #min_messages: notice 
# 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: postgresql 
database: better_life-test 
pool: 5 
host: localhost 
username: action 
password: 

production: 
    adapter: postgresql 
    encoding: unicode 
    database: better_life-prod 
    pool: 5 
    host: localhost 
    username: action 
    password: 

ответ

1

Вы должны убедиться, что у вас есть отступы для каждой настройки двух пространств для вашего файла config/database.yml. Попробуйте использовать эти настройки с точным форматированием:

development: 
    adapter: postgresql 
    encoding: unicode 
    database: better_life-dev 
    pool: 5 
    host: localhost 
    username: action 
    password: 

test: 
    adapter: postgresql 
    database: better_life-test 
    pool: 5 
    host: localhost 
    username: action 
    password: 

production: 
    adapter: postgresql 
    encoding: unicode 
    database: better_life-prod 
    pool: 5 
    host: localhost 
    username: action 
    password: 
+0

Это сработало спасибо. – Obromios

1

Вы пытаетесь использовать ту же базу данных для двух различных приложений? Содержание database.yml для прочее приложение должно отличаться от указанного.

+0

У меня есть преимущество, потому что стоит проверить одну и ту же базу данных в двух приложениях. В моем случае у гмана был ответ. – Obromios

+0

Благодарим вас за любезность. –

Смежные вопросы