#218 new
George Ogata

auto_migrations: create db/migrate if it doesn't exist

Reported by George Ogata | May 12th, 2008 @ 10:13 AM

As git gains traction among rails developers, and since this directory isn't created by the rails application generator, it would be useful to create db/migrate if it does not yet exist.

--- auto_migrations/lib/auto_migrations.rb	2008-05-13 03:04:01.000000000 +1000
+++ auto_migrations.mkdir_p/lib/auto_migrations.rb	2008-05-13 03:04:45.000000000 +1000
@@ -28,6 +28,7 @@
               end.join
     schema << "  end\nend\n"
     migration_file = File.join(RAILS_ROOT, "db", "migrate", "001_initial_schema.rb")
+    FileUtils.mkdir_p File.dirname(migration_file)
     File.open(migration_file, "w") { |f| f << schema }
     puts "Migration created at db/migrate/001_initial_schema.rb"
   end

No comments found

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Shared Ticket Bins

People watching this ticket

Attachments

Pages