Felix
Felix

Reputation: 5619

Starting My Ruby on Rails application - How to fill database?

i'm tying to install my ruby on rails application on a new Server.

In the folder db theres is my schema.rb file.

But my problem ist how to run the schema.rb file to run the sql statements?

Upvotes: 0

Views: 722

Answers (2)

PJ Bergeron
PJ Bergeron

Reputation: 2998

You can do this:

  • rake db:create to create your DB (you do this only once)
  • rake db:migrate to migrate your BD (do this the first time and every time you want to apply changes, like removing a column)

And

  • rake db:seed to populate your DB, if you have something in you seeds.rb file

Upvotes: 1

NM Pennypacker
NM Pennypacker

Reputation: 6942

The schema file doesn't populate the data, rather it shows the structure of the database. You'll have to run:

rake:db:create rake:db:migrate

on the new server and then create a dump of the data you wish to import to the new database. Then import the data. Both of these processes can differ widely depending on what kind of database you're using.

For MySQL: Export and Import all MySQL databases at one time

For PostgreSQL: import sql dump into postgresql database

Upvotes: 1

Related Questions