swordray
2014-Jul-03 08:24 UTC
Rails migration files generate into corresponding modular directories
In a Ruby on Rails project, all migration files generate into the same
directory <em>db/migrate</em>. It's enough for simple projects,
but not
that good for large modulized projects. It is inconvenient to review
thousands of files in the same directory for one project.
It looks like:
<img
src="https://ruby-china-files.b0.upaiyun.com/photo/2014/1c58bc1196dfe04f6e4a1f6819ce2549.png"
/>
Since MVC directories are modular, the migration directory should the same.
It's expected to be structured and clear. That's the reason I release
the
gem <a
href="https://github.com/swordray/modular_migration">modular_migration</a>.
Just include it in your Gemfile:
<code>gem 'modular_migration'</code>
Using Rails generator as usual:
<code>$ rails generate model Core::User name:string
invoke active_record
create app/models/core/user.rb
create app/models/core.rb
create db/migrate/core/user/20140324105328_create_core_users.rb
</code>
It will look like:
<img
src="https://ruby-china-files.b0.upaiyun.com/photo/2014/b881fc62be420c8b81645dcdad40416d.png"
/>
Source code and issue tracking: <a
href="https://github.com/swordray/modular_migration">https://github.com/swordray/modular_migration</a>
Welcome to star, fork and pull request at GitHub.
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit
https://groups.google.com/d/msgid/rubyonrails-talk/73097c08-cd47-4d7c-8d40-be3421c9fae9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.