Venomoustoad
Venomoustoad

Reputation: 1213

ruby on rails - git repository, database handling

  1. I am currently using Bitbucket and am handling a Ruby on Rails repository across users. By default, when one user pushes the repository(default command - git push origin master -entire rails folder), I assume that the db also gets pushed to bit bucket, right?
  2. When a second user downloads the repository off git, shouldn't i expect all the db files to also get downloaded?
  3. Is it necessary for the second user to run rake db migrate commands again after downloading the file?
  4. In the specific case above, I am the second user and I get the following error message upon downloading the repository off BitBucket, while the file run perfectly on the uploaders computer:

    ActiveRecord::StatementInvalid in StaticPagesController#home

    Could not find table 'users'

I want to make sure that both of us are working on the same DB and are not working in parallel on different datasets.

Upvotes: 0

Views: 447

Answers (2)

Tzu ng
Tzu ng

Reputation: 9244

I guess you are new to Rails. The way Rails handle database in development is :

with database structure:

  1. You maintain the structure through migrations file.

  2. Yes, if you pull new code that does contain new migration file, you need to run rake db:migrate. You will notified if you don't.

with database data:

  1. In development, you can maintain data to test through seed file. You can watch this great screencast here: http://railscasts.com/episodes/179-seed-data

  2. Better, you should use seed_fu gem https://github.com/mbleigh/seed-fu

Upvotes: 1

Jason Kim
Jason Kim

Reputation: 19041

Data in your database will reside only in database. It will not be in git repository. The repository contains database config files and migration files to create databases on the fly. Again, it doesn't contain data.

If you want to work on the same database, I would look into using Amazon AWS RDS. Setting up RDS is not undoable, but it's not trivial enough for me to expound on exactly how you do that here.

Upvotes: 1

Related Questions