I will post about how to run rails db: create
, rails db: migrate
, etc. in the local environment in the production environment.
First, in the production environment, move to the current directory
with the following command.
Terminal.
[ec2-user@******* ~]$ cd /var/www/app name/current
Terminal.
//Delete database
[ec2-user@******* current]$ RAILS_ENV=production DISABLE_DATABASE_ENVIRONMENT_CHECK=1 bundle exec rake db:drop
//Database creation
[ec2-user@******* current]$ rails db:create RAILS_ENV=production
//Creating tables and columns
[ec2-user@******* current]$ rails db:migrate RAILS_ENV=production
//If you want to send information to a column in the database
[ec2-user@******* current]$ rails db:seed RAILS_ENV=production
It's easy to forget the commands in the production environment, so I hope you'll find it helpful!
Recommended Posts