mina-deploy / mina

Blazing fast deployer and server automation tool
https://rubygems.org/gems/mina
Other
4.34k stars 491 forks source link

What's the correct way to load the DB schema? On "setup"? Or on first "deploy"? #651

Open jmuheim opened 4 years ago

jmuheim commented 4 years ago

Hello

I'm still unsure when to load my DB schema when setting up a new application using Mina.

I know about invoke :'rails:db_schema_load' in deploy, but I only need to run it the very first deploy. So why not move it to setup? Or at least only run it the very first time - because now I have to uncomment it manually after the first run, otherwise:

rake aborted!
       ActiveRecord::ProtectedEnvironmentError: You are attempting to run a destructive action against your 'production' database.

Thank you.

jmuheim commented 4 years ago

Is this an exotic question? Or why does nobody seem to care? I find my question a very basic one, and I don't find any explanation or further information about it anywhere else. Blog posts explaining how to set up a deployment using Mina seem to help themselves by manually loading the DB, or by uncommenting invoke :'rails:db_schema_load' the very first time a deployment is executed, but this all seems silly to me. There must be a fool-proof way for that?!

jmuheim commented 4 years ago

I asked on StackOverflow: https://stackoverflow.com/questions/58372477/deployment-of-a-rails-app-how-should-the-db-be-loaded-and-filled-during-the-ver