Google Groups Home
Help | Sign in
Migrations and SVN branches (comments requested)
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  15 messages - Collapse all
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
Brad Ediger  
View profile
 More options Dec 4 2006, 10:55 am
From: Brad Ediger <b...@bradediger.com>
Date: Mon, 4 Dec 2006 09:55:42 -0600
Local: Mon, Dec 4 2006 10:55 am
Subject: Migrations and SVN branches (comments requested)

I have a tentative fix for the issue of using Rails migrations with  
Subversion branches. I wrote a plugin, announced here:

http://www.bradediger.com/blog/2006/11/subverted_migrations.html

It is available at:

svn://svn.madriska.com/plugins/subverted_migrations

The plugin changes Rails's schema versioning to use version strings  
instead of integers, so you can have a version of "1-12,16-19" for  
example (with the missing versions being in another branch to be  
possibly merged in later). It also patches the db:migrate task to  
handle this versioning, as well as modifying the generate script to  
keep version numbers unique across all branches and trunk.

It is in alpha right now, but it is working well enough for me.

Is this something that would be a useful addition to Rails core? I'd  
appreciate some feedback / criticism.

Thanks,
Brad


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Manfred Stienstra  
View profile
 More options Dec 4 2006, 12:05 pm
From: Manfred Stienstra <manf...@gmail.com>
Date: Mon, 4 Dec 2006 18:05:59 +0100
Local: Mon, Dec 4 2006 12:05 pm
Subject: Re: [Rails-core] Migrations and SVN branches (comments requested)

On Dec 4, 2006, at 4:55, Brad Ediger wrote:

> Is this something that would be a useful addition to Rails core?  
> I'd appreciate some feedback / criticism.

Wow, this looks really complicated. I think the solution with all  
version control problems is communication, not complicated naming  
schemes. Whenever I have a problem with migration numbers I just:  
migrate down, merge, migrate up, commit.

Manfred


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Brad Ediger  
View profile
 More options Dec 4 2006, 12:31 pm
From: Brad Ediger <b...@bradediger.com>
Date: Mon, 4 Dec 2006 11:31:00 -0600
Subject: Re: [Rails-core] Re: Migrations and SVN branches (comments requested)
On Dec 4, 2006, at 11:05 AM, Manfred Stienstra wrote:

> On Dec 4, 2006, at 4:55, Brad Ediger wrote:

>> Is this something that would be a useful addition to Rails core?
>> I'd appreciate some feedback / criticism.

> Wow, this looks really complicated. I think the solution with all
> version control problems is communication, not complicated naming
> schemes. Whenever I have a problem with migration numbers I just:
> migrate down, merge, migrate up, commit.

Thanks for the feedback. I don't think it's terribly complicated once  
you get used to it. With this change, you shouldn't have to think  
about merges when writing migrations. I just created kind of a  
contrived example to show that everything Just Works. Perhaps the  
complicated example obscures understanding.

The reason I wrote the plugin is to keep from having to fudge the  
migration version numbers when merging. I think it's a messy solution  
to have to back out schema changes in order to keep your versions  
straight. That sounds like a programmer serving his tools, and it  
doesn't work if you have even one irreversible migration.

Is there a particular part of the documentation you think is  
complicated, or is it a specific part of the workflow that is confusing?

Thanks again for your comments.
Brad


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Rick Olson  
View profile
 More options Dec 4 2006, 2:36 pm
From: "Rick Olson" <technowee...@gmail.com>
Date: Mon, 4 Dec 2006 13:36:45 -0600
Local: Mon, Dec 4 2006 2:36 pm
Subject: Re: [Rails-core] Re: Migrations and SVN branches (comments requested)
On 12/4/06, Brad Ediger <b...@bradediger.com> wrote:

> On Dec 4, 2006, at 11:05 AM, Manfred Stienstra wrote:

> > On Dec 4, 2006, at 4:55, Brad Ediger wrote:

> >> Is this something that would be a useful addition to Rails core?
> >> I'd appreciate some feedback / criticism.

> > Wow, this looks really complicated. I think the solution with all
> > version control problems is communication, not complicated naming
> > schemes. Whenever I have a problem with migration numbers I just:
> > migrate down, merge, migrate up, commit.

I agree, it does look complicated.  I guess it depends on your
workflow though.  Usually, I work solo or in a small team, so there
aren't a lot of branches.  I haven't had any real issues with this as
long as I keep in contact.

--
Rick Olson
http://weblog.techno-weenie.net
http://mephistoblog.com


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Brad Ediger  
View profile
 More options Dec 4 2006, 2:48 pm
From: Brad Ediger <b...@bradediger.com>
Date: Mon, 4 Dec 2006 13:48:58 -0600
Local: Mon, Dec 4 2006 2:48 pm
Subject: Re: [Rails-core] Re: Migrations and SVN branches (comments requested)
On Dec 4, 2006, at 1:36 PM, Rick Olson wrote:

I also work solo / in small teams, but I tend to have long-lived  
feature branches that don't get merged into production for a while  
(weeks to months) while developing and testing. These branches  
typically involve large schema changes that should be isolated from  
the production branch. Is there a more Rails-ish way to do schema  
branches like this?

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Courtenay  
View profile
 More options Dec 8 2006, 4:30 am
From: Courtenay <court3...@gmail.com>
Date: Fri, 8 Dec 2006 01:30:44 -0800
Local: Fri, Dec 8 2006 4:30 am
Subject: Re: [Rails-core] Re: Migrations and SVN branches (comments requested)

> >>>> Is this something that would be a useful addition to Rails core?
> >>>> I'd appreciate some feedback / criticism.

> >>> Wow, this looks really complicated. I think the solution with all

Why can't we just have a ParallelMigration (IndependentMigration)
subclass that doesn't check for duplicates in the numbering?

My most common use case is where I'm taking someone else's app,
checking it in locally with svk, adding some fields or models here and
there, but my changes are really in parallel with the original
changes.

In that case I'd have

067_create_monkey_table
068_add_banana_field_to_monkey.rb
068_add_product_table.rb
069_add_monkey_field_to_product

We would assume from looking at the numbering that both 068_* are
somewhat dependent on 067, and come before 069.  It would work only if
they are both this new independent migration class.

This opens up a whole new metaphor for thinking about migrations;
independent migration classes. So you'd add a few tables all at once,
but instead of putting then sequentially or in the same file, you make
3 parallel files.

I don't know if this solves the "long-running" branches issue, but
it's certainly simple..


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
court3...@gmail.com  
View profile
 More options Dec 8 2006, 4:40 am
From: court3...@gmail.com
Date: Fri, 08 Dec 2006 09:40:03 -0000
Local: Fri, Dec 8 2006 4:40 am
Subject: Re: Migrations and SVN branches (comments requested)
self-reply here, pre-empting questions..

I spend a lot of time doing branch-based development, where you make a
branch for each major feature.  It's powerful, but merging migrations
is horrible.

What happens if you migrate up or down and you never applied one of the
parallel patches? or, if you merge someone's code and it contains old
migrations that you've progressed over?
For example, you're at version=52 but someone else's merged code adds
47 and 51, which you haven't run..   In this case you just migrate down
and up again..

What if you only applied one of the migrations 068, but you want to go
down anyway?  I guess the IndependentMigration would have to specify if
you can skip it..otherwise, do what we all do when migrations half-run,
go in, comment out the offending code, migrate down, and uncomment it
again.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Courtenay  
View profile
 More options Dec 8 2006, 8:04 am
From: Courtenay <court3...@gmail.com>
Date: Fri, 8 Dec 2006 05:04:54 -0800
Local: Fri, Dec 8 2006 8:04 am
Subject: Re: Re: Migrations and SVN branches (comments requested)
On 12/8/06, court3...@gmail.com <court3...@gmail.com> wrote:

Damn, how'd it get to be 5am?

http://blog.caboo.se/articles/2006/12/08/simultaneous-migrations
http://dev.rubyonrails.org/ticket/6799

Here's the patch :)


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Brad Ediger  
View profile
 More options Dec 8 2006, 10:44 am
From: Brad Ediger <b...@bradediger.com>
Date: Fri, 8 Dec 2006 09:44:51 -0600
Local: Fri, Dec 8 2006 10:44 am
Subject: Re: [Rails-core] Re: Re: Migrations and SVN branches (comments requested)
On Dec 8, 2006, at 7:04 AM, Courtenay wrote:

That looks really neat. It's certainly simpler than my solution, and  
I can't think of any problems with that off the top of my head.

be


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Francois Beausoleil  
View profile
 More options Dec 8 2006, 12:53 pm
From: "Francois Beausoleil" <francois.beausol...@gmail.com>
Date: Fri, 8 Dec 2006 12:53:32 -0500
Local: Fri, Dec 8 2006 12:53 pm
Subject: Re: [Rails-core] Re: Migrations and SVN branches (comments requested)
2006/12/8, Brad Ediger <b...@bradediger.com>:

> On Dec 8, 2006, at 7:04 AM, Courtenay wrote:
> > Here's the patch :)

> That looks really neat. It's certainly simpler than my solution, and
> I can't think of any problems with that off the top of my head.

I don't know.  Maybe we should drop version numbers altogether ?

Take a look at my proposed solution:
http://blog.teksol.info/articles/2006/12/08/migrations-branches-and-d...

I'm in the process of writing it.  I don't have tests yet, but I can
migrate up and down with no problem at this moment.  I'll try and
release my patch as a plugin, so it can be tried.

Bye !
--
François Beausoleil
http://blog.teksol.info/
http://piston.rubyforge.org/


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Michael Schuerig  
View profile
 More options Dec 8 2006, 1:17 pm
From: Michael Schuerig <mich...@schuerig.de>
Date: Fri, 8 Dec 2006 19:17:08 +0100 (MET)
Local: Fri, Dec 8 2006 1:17 pm
Subject: Re: Migrations and SVN branches (comments requested)
On Friday 08 December 2006 18:53, Francois Beausoleil wrote:

> 2006/12/8, Brad Ediger <b...@bradediger.com>:
> > On Dec 8, 2006, at 7:04 AM, Courtenay wrote:
> > > Here's the patch :)

> > That looks really neat. It's certainly simpler than my solution,
> > and I can't think of any problems with that off the top of my head.

> I don't know.  Maybe we should drop version numbers altogether ?

> Take a look at my proposed solution:
> http://blog.teksol.info/articles/2006/12/08/migrations-branches-and-d
>ependencies

If I understand your suggestion correctly, it amounts to sorting and
applying migrations based on timestamp. I think real time is not the
right dimension for this as progress on different branches is not
coordinated by time. Rather, I suggest to apply migrations in the order
of their corresponding revision numbers. This approach doesn't
guarantee that there can be no conflicts when branches are merged, but
I think this can't be guaranteed anyway.

Michael

--
Michael Schuerig
mailto:mich...@schuerig.de
http://www.schuerig.de/michael/


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.