Search code examples
mysqlruby-on-railsrubydatabaserubymine

Existing .rb files to create local MySQL database


I downloaded source code from BitBucket and I am trying to set up a local MySQL database with an existing .rb files in RubyMine. Is there a direct way to do so or do I need to set up all the tables manually?


Solution

  • You can create the database for a Rails project in one command:

    $ rails db:create
    

    (for Rails 5 only; if you're using Rails <= 4, s/rails/rake/)

    You'll also need to load the schema in, which is one more command:

    $ rails db:schema:load
    

    If you have seeding data in seeds.rb, you can load that with one further command:

    $ rails db:seed