Вопрос

I am trying deploy like this:

bundle exec cap deploy:cold
RAILS_ENV=production rake db:migrate
bundle exec cap deploy:migrate

but all the time shows error in log file:

I, [2014-04-14T14:15:14.853543 #10769]  INFO -- : Started GET "/users/sign_up" for     
176.192.228.14 at 2014-04-14 14:15:14 -0400
I, [2014-04-14T14:15:14.856055 #10769]  INFO -- : Processing by  
Devise::RegistrationsController#new as HTML
I, [2014-04-14T14:15:14.857398 #10769]  INFO -- : Completed 500 Internal Server Error 
in 1ms
F, [2014-04-14T14:15:14.860844 #10769] FATAL -- : 
ActiveRecord::StatementInvalid (Could not find table 'users')

but in the current/db folder was created production.sqlite3 .

In the localhost:3000 it works fine.

How can i migrate db for production with capistrano?

I use nginx and unicorn and this is my repo https://github.com/EgorkZe/bh

Это было полезно?

Решение 2

Working with Sqlite in production is very problematic because each time you deploy new version you entiredb is stay on the old release folder, what you can do is when you deploy add this command:

task :copy_sqlite, roles: :app do
    run "cp #{current_path}/db/production.sqlite3 #{release_path}/db/"
end

just add this the before rake db:migrate and it will solve your problem.

My strong suggestion move to PostgreSQL/MySQL.

Другие советы

Better yet, change up your db configuration:

production:
  adapter: sqlite3
  database: /absolute/path/to/shared/db/production.sqlite3 # instead of db/production.sqlite3
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top