Rails Schema Generator 1.0.0
It’s taken forever, but I finally have a version of my schema generator that works with Rails 1.0. The actual fix was fairly minor (7 lines), but getting to a point where I could test it has been amazingly difficult–my new PowerBook had a bit of disk corruption and Ruby stopped working. Rebuilding the entire Ruby distribution from DarwinPorts wasn’t enough to fix the problem, somehow, but installing a new copy of REXML did the trick for reasons that are too obscure for understanding.
So, go and enjoy.
Update: I just bumped it to 1.0.1 to fix a MySQL dependancy bug that I’d forgotten about for 1.0.0. Have fun.
Trackbacks
Use the following link to trackback from your own site:
http://scottstuff.net/blog/trackbacks?article_id=588
On Windows XP with rails 1.0 it runs withour error, but the result is not what I expect. From a mgigration series (which works fine to install all the schema with rake migrate) I just get the schema entries for schema_info. My migrations are named:
001_initial_schema.rb,002_add_something,002_add_anotherthing. I get from generate schema: “Found 0 migration classes”oh, I have a “typo” at my original post, the migrations are named: 001initialschema.rb, 002addsomething, 002addanotherthing, with underscore after the 3 digit number at the begin
it’s not a “typo”, but typo (the blog) is not printing my underscores !
I mailed Scott about this problem earlier. Until an official fix comes out, you need to change line 42 in schema_generator.rb.
Line 42 should start:
globname = “db/migrate/0*#{mig
rather than
globname = “db/migrate/#{mig
You’ll find that the above is used on line 47, but not in 42. Change that, things will work for you.
The reason the underscores are disappearing is that the comments (and probably the posts) are being parsed by “Textile”:http://textism.com/tools/textile/, and underscores have meaning in that.
I just released 1.0.2 with a slightly different version of this fix. Thanks.
It’s actually Markdown, not Textile, but the result is similar.
Short fix: enclose your migration names in backticks, and they’ll end up looking like this:
001_migrate.rb