Re: [git-users] What to do when you get a conflict (rails) of schema.rb

2010-08-26 Thread Donovan Bray
The schema.rb is primarily used in the db:test:prepare rake task that 
bootstraps your :test database when you run rake spec or rake test. You can 
bootstrap a non test database but I don't recall the command because I don't 
use it. So if you don't check it in ; and if you clone a project and 
immediately run the tests it will be unable to prepare the test database.  If 
you db:migrate your dev database it will generate the schema.rb and your tests 
will be able to proceed. 

There are other reasons the schema.rb is useless to check in. 

Seed data; if your migrations add seed data that data won't be present in a 
database generated from the schema.rb. (rake db:seed is the new way to handle 
that problem)

Stored procedures; if you've added stored procedures in your migrations, they 
won't be in a database generated from the schema.rb, also applies to foreign 
key constraints I believe. 

The most insidious is that it allows bizarre artifacts into the schema.rb as a 
result of development unless you are really diligent about resetting your 
development databases every time you switch checkouts. If you use the schema.rb 
to initialize production databases beware, but it can also break tests and 
waste time with useless conflicts.  

Consider creating a new topic branch, xyz based on abc. In xyz you add a 
migration that adds table xyz. You need to work on a bug on abc so you checkout 
abc and commit some migration; if you check the schema.rb carefully you'll 
notice the table xyz is in the schema.rb for branch abc. If abc and xyz are 
ever merged or ancestors of those are merged you'll likely end up with 
conflicts, or worse just the silent little artifacts of garbage slowly 
polluting your schema.rb. 

If you doubt what I say take and old project; where there are different 
developers; a goodly number of migrations; and they have been checking in the 
schema.rb;

>From a clean checkout; reset the development database; rake db:migrate it; I 
>bet you will end up with a schema.rb that is different than the one checked 
>in. For extra credit try to find what induced the modifications. 

On Aug 26, 2010, at 7:48 AM, Pita Salas  wrote:

> Yeah it's a mystery to me: the question about checking in schema.rb is
> heavily debated and the rails code itself STRONGLY advises to check it
> in. But I don't know why because what you say makes perfect sense to
> me too.
> 
> -- Pito
> 
> 

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To post to this group, send email to git-us...@googlegroups.com.
To unsubscribe from this group, send email to 
git-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/git-users?hl=en.



[git-users] Re: What to do when you get a conflict (rails) of schema.rb

2010-08-26 Thread Konstantin Khomoutov
On Aug 26, 6:20 pm, Pito Salas  wrote:

> Hmm. But it's a git-users question. Thanks anyway.
[...]

My understanding is that the "-users" suffix is used to differentiate
this list from the Git list for developers (hosted at vger.kernel.org)
which for some reason is named just "git" and not "git-dev" which
could have more sense for its content.

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To post to this group, send email to git-us...@googlegroups.com.
To unsubscribe from this group, send email to 
git-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/git-users?hl=en.



Re: [git-users] What to do when you get a conflict (rails) of schema.rb

2010-08-26 Thread Pito Salas
Yeah it's a mystery to me: the question about checking in schema.rb is
heavily debated and the rails code itself STRONGLY advises to check it
in. But I don't know why because what you say makes perfect sense to
me too.

-- Pito

On Thu, Aug 26, 2010 at 10:40 AM, Donovan Bray  wrote:
> Fwiw I recommend .gitignore'ing the schema.rb. You don't need it checked in 
> its regenerated every migration and it's a magnet for useless conflicts.
>
> On Aug 26, 2010, at 7:20 AM, Pito Salas  wrote:
>
>> Hmm. But it's a git-users question. Thanks anyway.
>>
>> On Wed, Aug 25, 2010 at 6:52 PM, Michael P. Soulier
>>  wrote:
>>> On 25/08/10 Pito Salas said:
>>>
 Hi all,

 This happens from time to time and I am not sure the right solution:

 Working on a rails application, I am merging my branch (where I did
 some migrations) with your branch (where you did some migrations too).
 Inevitably there's a conflict with schema.rb.

 What to do? I can manually fix the merge conflict, but I am still stuck 
 with
>>>
>>> This is not a Git question.
>>>
>>> Mike
>>> --
>>> Michael P. Soulier 
>>> "Any intelligent fool can make things bigger and more complex... It takes a
>>> touch of genius - and a lot of courage to move in the opposite direction."
>>> --Albert Einstein
>>>
>>> -BEGIN PGP SIGNATURE-
>>> Version: GnuPG v1.4.9 (GNU/Linux)
>>>
>>> iD8DBQFMdZ64KGqCc1vIvggRAjuFAJ43MMt6vUmiXnFedjGjf94Sbm73AQCfUXhd
>>> 6hVM8pVV+a7osWmzcb1V7oI=
>>> =TV0p
>>> -END PGP SIGNATURE-
>>>
>>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "Git for human beings" group.
>> To post to this group, send email to git-us...@googlegroups.com.
>> To unsubscribe from this group, send email to 
>> git-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at 
>> http://groups.google.com/group/git-users?hl=en.
>>
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Git for human beings" group.
> To post to this group, send email to git-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> git-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/git-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To post to this group, send email to git-us...@googlegroups.com.
To unsubscribe from this group, send email to 
git-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/git-users?hl=en.



Re: [git-users] What to do when you get a conflict (rails) of schema.rb

2010-08-26 Thread Donovan Bray
Fwiw I recommend .gitignore'ing the schema.rb. You don't need it checked in its 
regenerated every migration and it's a magnet for useless conflicts. 

On Aug 26, 2010, at 7:20 AM, Pito Salas  wrote:

> Hmm. But it's a git-users question. Thanks anyway.
> 
> On Wed, Aug 25, 2010 at 6:52 PM, Michael P. Soulier
>  wrote:
>> On 25/08/10 Pito Salas said:
>> 
>>> Hi all,
>>> 
>>> This happens from time to time and I am not sure the right solution:
>>> 
>>> Working on a rails application, I am merging my branch (where I did
>>> some migrations) with your branch (where you did some migrations too).
>>> Inevitably there's a conflict with schema.rb.
>>> 
>>> What to do? I can manually fix the merge conflict, but I am still stuck with
>> 
>> This is not a Git question.
>> 
>> Mike
>> --
>> Michael P. Soulier 
>> "Any intelligent fool can make things bigger and more complex... It takes a
>> touch of genius - and a lot of courage to move in the opposite direction."
>> --Albert Einstein
>> 
>> -BEGIN PGP SIGNATURE-
>> Version: GnuPG v1.4.9 (GNU/Linux)
>> 
>> iD8DBQFMdZ64KGqCc1vIvggRAjuFAJ43MMt6vUmiXnFedjGjf94Sbm73AQCfUXhd
>> 6hVM8pVV+a7osWmzcb1V7oI=
>> =TV0p
>> -END PGP SIGNATURE-
>> 
>> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Git for human beings" group.
> To post to this group, send email to git-us...@googlegroups.com.
> To unsubscribe from this group, send email to 
> git-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/git-users?hl=en.
> 

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To post to this group, send email to git-us...@googlegroups.com.
To unsubscribe from this group, send email to 
git-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/git-users?hl=en.



Re: [git-users] What to do when you get a conflict (rails) of schema.rb

2010-08-26 Thread Pito Salas
Hmm. But it's a git-users question. Thanks anyway.

On Wed, Aug 25, 2010 at 6:52 PM, Michael P. Soulier
 wrote:
> On 25/08/10 Pito Salas said:
>
>> Hi all,
>>
>> This happens from time to time and I am not sure the right solution:
>>
>> Working on a rails application, I am merging my branch (where I did
>> some migrations) with your branch (where you did some migrations too).
>> Inevitably there's a conflict with schema.rb.
>>
>> What to do? I can manually fix the merge conflict, but I am still stuck with
>
> This is not a Git question.
>
> Mike
> --
> Michael P. Soulier 
> "Any intelligent fool can make things bigger and more complex... It takes a
> touch of genius - and a lot of courage to move in the opposite direction."
> --Albert Einstein
>
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.9 (GNU/Linux)
>
> iD8DBQFMdZ64KGqCc1vIvggRAjuFAJ43MMt6vUmiXnFedjGjf94Sbm73AQCfUXhd
> 6hVM8pVV+a7osWmzcb1V7oI=
> =TV0p
> -END PGP SIGNATURE-
>
>

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To post to this group, send email to git-us...@googlegroups.com.
To unsubscribe from this group, send email to 
git-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/git-users?hl=en.