Migration Assist plugin
Plugin details
Documentation
ruby script/plugin install http://svn.drotner.org/repos/rails/plugins/migration_assist/trunk/migration_assist/
rake migration:list
------------------------
Simply lists out the filenames of all migrations.
Example:
$ rake migration:list (in /Volumes/usr1/temp/mig) 001_create_users.rb 002_create_people.rb 003_create_foos.rb 004_create_bars.rb 005_create_bazs.rb 006_create_emails.rb 007_create_phones.rb 008_create_instant_messengers.rb 009_create_phone_types.rb 010_create_instant_messenger_types.rb 011_create_jobs.rb 012_create_job_types.rb
Nothing exciting…
rake migration:renumber FROM=number TO=number
----------------------------------------------------
This rake task will print out the commands needed to renumber the migration starting with the FROM=number to the TO=number as well as renumbering any other migrations needed to make TO=number fit.
Examples:
$ rake migration:renumber FROM=3 TO=6 (in /Volumes/usr1/temp/mig) Cut and paste the following... ----- BEGIN ----- rake db:migrate VERSION=002 cd db/migrate mv 004_create_bars.rb 003_create_bars.rb mv 005_create_bazs.rb 004_create_bazs.rb mv 006_create_emails.rb 005_create_emails.rb mv 003_create_foos.rb 006_create_foos.rb cd ../.. rake db:migrate ----- END ----- $ # Do the cut-n-paste $ rake migration:list (in /Volumes/usr1/temp/mig) 001_create_users.rb 002_create_people.rb 003_create_bars.rb 004_create_bazs.rb 005_create_emails.rb 006_create_foos.rb 007_create_phones.rb 008_create_instant_messengers.rb 009_create_phone_types.rb 010_create_instant_messenger_types.rb 011_create_jobs.rb 012_create_job_types.rb $ rake migration:renumber FROM=5 TO=10 (in /Volumes/usr1/temp/mig) Cut and paste the following... ----- BEGIN ----- rake db:migrate VERSION=004 cd db/migrate mv 006_create_foos.rb 005_create_foos.rb mv 007_create_phones.rb 006_create_phones.rb mv 008_create_instant_messengers.rb 007_create_instant_messengers.rb mv 009_create_phone_types.rb 008_create_phone_types.rb mv 010_create_instant_messenger_types.rb 009_create_instant_messenger_types.rb mv 005_create_emails.rb 010_create_emails.rb cd ../.. rake db:migrate ----- END ----- $ # Do the cut-n-paste $ rake migration:list (in /Volumes/usr1/temp/mig) 001_create_users.rb 002_create_people.rb 003_create_bars.rb 004_create_bazs.rb 005_create_foos.rb 006_create_phones.rb 007_create_instant_messengers.rb 008_create_phone_types.rb 009_create_instant_messenger_types.rb 010_create_emails.rb 011_create_jobs.rb 012_create_job_types.rb
Be sure to not just blindly copy and paste the commands. Look to make sure that the suggested commands make sense.
rake migration:close_gaps
------------------------------
This rake task will print out the commands needed to close up any migration numbering gaps.
Example:
$ rake migration:list (in /Volumes/usr1/temp/mig) 001_create_users.rb 002_create_people.rb 006_create_phones.rb 007_create_instant_messengers.rb 008_create_phone_types.rb 009_create_instant_messenger_types.rb 010_create_emails.rb 011_create_jobs.rb 012_create_job_types.rb 013_create_bars.rb 014_create_bazs.rb 015_create_foos.rb $ rake migration:close_gaps (in /Volumes/usr1/temp/mig) Cut and paste the following... ----- BEGIN ----- rake db:migrate VERSION=002 cd db/migrate mv 006_create_phones.rb 003_create_phones.rb mv 007_create_instant_messengers.rb 004_create_instant_messengers.rb mv 008_create_phone_types.rb 005_create_phone_types.rb mv 009_create_instant_messenger_types.rb 006_create_instant_messenger_types.rb mv 010_create_emails.rb 007_create_emails.rb mv 011_create_jobs.rb 008_create_jobs.rb mv 012_create_job_types.rb 009_create_job_types.rb mv 013_create_bars.rb 010_create_bars.rb mv 014_create_bazs.rb 011_create_bazs.rb mv 015_create_foos.rb 012_create_foos.rb cd ../.. rake db:migrate ----- END ----- $ # Do the cut-n-paste $ rake migration:list (in /Volumes/usr1/temp/mig) 001_create_users.rb 002_create_people.rb 003_create_phones.rb 004_create_instant_messengers.rb 005_create_phone_types.rb 006_create_instant_messenger_types.rb 007_create_emails.rb 008_create_jobs.rb 009_create_job_types.rb 010_create_bars.rb 011_create_bazs.rb 012_create_foos.rb
Again, be sure to not just blindly copy and paste the commands. Look to make sure that the suggested commands make sense.
Further Documentation
There is currently no advanced documentation for this plugin.
New documentationEdit plugin | Back in time (1 older version) | Last edited by: hardway, 9 months ago

