3

Hanami has some commands to create a database.

But both db create and db prepare are not available in production environment. http://hanamirb.org/guides/command-line/database/

How can I create a database in production?

1 Answers1

3

It depends.

We deliberately disabled these commands in production, because they can be potentially destructive and we can't guess where you're gonna deploy your project.

Is that Heroku? Well, add it via their CLI. Do you use a VPS? Is the database on the same node? Does the Unix user who runs the Ruby process have the permissions to create the database? We can't guess.

It depends where you're gonna deploy.

Luca Guidi
  • 1,201
  • 10
  • 10
  • I'd like to deploy to an EC2 instance. Database is on the same node and the PostgreSQL user specified in DATABASE_URL has the permissions to create database. But the commands are not work in production (I know it is for safety). Do I have to create database and tables manually? – OSA Shunsuke Oct 05 '17 at 01:59
  • Only the database has to be created manually. For the migrations you still have `hanami db migrate`. – Luca Guidi Oct 05 '17 at 14:15
  • OK, I see. Thanks a lot. – OSA Shunsuke Oct 07 '17 at 02:48