Rails 2.0 regex to convert old Migrations
Rails 2.0 is here! I’m going to try to move the app I’ve been working on (at DesignHammer) over to take advantage of it. Doesn’t seem like it should take that long? But we’ll see
While getting started on that I wanted to try the new method for Active Record DB migrations. So I decided to rewrite all my old migrations (or at least the ones adding tables). I ended up crafting this regex to allow for a quick find and replace of the old style to be like the new style:
Find:
\.column\s+\s*,\s+
Replace:
.$5 $1
Leave a Reply