views:

63

answers:

2

What is the common way of dealing with the development.sqlite3 files with VCS (in particular, git)?

If I commit this file to the VCS, will it be merged with another developer's copy?

Or should each developer run the db:migrate task each time a new migration file is created?

A: 

sqlite is file-based database, so, if you commit this file to VCS each developer will see same database, as you commit (not merged with db-file of other developers but replace their db) and they need no run any db:migrate task.

But this file change to often (on each data saving), so it is bed idea to put it to VCS.

potapuff
+1  A: 

The most common is to ignore this file. Moreover, we usually try to allow each developer use any database that is supported by Rails. Granted that this is not always possible, especially if there is a need to bypass ActiveRecord in some occasions. Nevertheless, for most simple applications this can be accomplished.

What we do is add these lines to .gitignore among other things we ignore:

db/*.sqlite3
config/database.yml

Then we include a database.yml.example file in config, where we keep the recommended way to configure the database for the application. Developers can copy that file as their database.yml, or select a different database.

Petros