Capistrano deploy fail to do rake db migrate
I follow this tutorial from crabs code
and do all as in tutorial but when i do cap production deploy initial
capistrano fail to do rake db migrate. I think is because capistrano not do rake db create first.
This is my error while i run cap production deploy:initial
00:08 deploy:assets:backup_manifest
01 mkdir -p /home/deploy/apps/zblog/releases/20231023051929/assets_manifest_backup
â 01 deploy@15.228.170.12 0.037s
02 cp /home/deploy/apps/zblog/releases/20231023051929/public/assets/.sprockets-manifest-5b9904d6aa4792e6522a4d87bde00062.json /home/deploy/apps/zblog/releases/20231023051929/assets_manifest_backup
â 02 deploy@15.228.170.12 0.041s
00:08 deploy:migrate
[deploy:migrate] Run rake db:migrate
00:08 deploy:migrating
01 $HOME/.rbenv/bin/rbenv exec bundle exec rake db:migrate
01 rake aborted!
01
01 ActiveRecord::NoDatabaseError: We could not find your database: zblog_production. Which can be found in the database configuration file located at config/database.yml.
01
01
01 To resolve this issue:
01
01
01 - Did you create the database for this app, or delete it? You may need to create your database.
01
01 - Has the database name changed? Check your database.yml config has the correct database name.
01
01
01 To create your database, run:
01
01
01 bin/rails db:create
01
01 /home/deploy/apps/zblog/shared/bundle/ruby/3.0.0/gems/activerecord-7.0.8/lib/active_record/connection_adapters/mysql2_adapter.rb:47:in `rescue in new_client'
When i try to run cap production deploy:db:create i have this error
vagrant@vagrant:~/Desktop/zblog$ cap production deploy:db:create
deploy@15.228.170.12's password:
deploy@15.228.170.12's password:
terminated with exception (report_on_exception is true):
/home/vagrant/.rbenv/versions/3.0.6/lib/ruby/gems/3.0.0/gems/sshkit-1.21.5/lib/sshkit/runners/parallel.rb:15:in rescue in block (2 levels) in execute': Exception while executing on host 15.228.170.12: if test ! -d /home/deploy/apps/zblog/current; then echo "Directory does not exist '/home/deploy/apps/zblog/current'" 1>&2; false; fi exit status: 1 (SSHKit::Runner::ExecuteError)
block (2 levels) in execute'
if test ! -d /home/deploy/apps/zblog/current; then echo "Directory does not exist '/home/deploy/apps/zblog/current'" 1>&2; false; fi stdout: Directory does not exist '/home/deploy/apps/zblog/current'
if test ! -d /home/deploy/apps/zblog/current; then echo "Directory does not exist '/home/deploy/apps/zblog/current'" 1>&2; false; fi stderr: Nothing written
from /home/vagrant/.rbenv/versions/3.0.6/lib/ruby/gems/3.0.0/gems/sshkit-1.21.5/lib/sshkit/runners/parallel.rb:11:in
/home/vagrant/.rbenv/versions/3.0.6/lib/ruby/gems/3.0.0/gems/sshkit-1.21.5/lib/sshkit/command.rb:97:in `exit_status=': if test ! -d /home/deploy/apps/zblog/current; then echo "Directory does not exist '/home/deploy/apps/zblog/current'" 1>&2; false; fi exit status: 1 (SSHKit::Command::Failed)
if test ! -d /home/deploy/apps/zblog/current; then echo "Directory does not exist '/home/deploy/apps/zblog/current'" 1>&2; false; fi stdout: Directory does no