annotate .svn/pristine/e8/e867d702d670ca00a87cd683a9e4a85aba9b478b.svn-base @ 1519:afce8026aaeb redmine-2.4-integration

Merge from branch "live"
author Chris Cannam
date Tue, 09 Sep 2014 09:34:53 +0100
parents cbb26bc654de
children
rev   line source
Chris@909 1 Description:
Chris@909 2 The plugin migration generator assists in working with schema additions
Chris@909 3 required by plugins. Instead of running migrations from plugins directly,
Chris@909 4 the generator creates a regular Rails migration which will be responsible
Chris@909 5 for migrating the plugins from their current version to the latest version
Chris@909 6 installed.
Chris@909 7
Chris@909 8 This is important because the set of application migrations remains an
Chris@909 9 accurate record of the state of the database, even as plugins are installed
Chris@909 10 and removed during the development process.
Chris@909 11
Chris@909 12 Example:
Chris@909 13 ./script/generate plugin_migration [<plugin_name> <another_plugin_name> ...]
Chris@909 14
Chris@909 15 This will generate:
Chris@909 16
Chris@909 17 RAILS_ROOT
Chris@909 18 |- db
Chris@909 19 |-migrate
Chris@909 20 |- xxx_plugin_migrations.rb
Chris@909 21
Chris@909 22 which contains the migrations for the given plugin(s).
Chris@909 23
Chris@909 24
Chris@909 25 Advanced Usage:
Chris@909 26
Chris@909 27 There may be situations where you need *complete* control over the migrations
Chris@909 28 of plugins in your application, migrating a certainly plugin down to X, and
Chris@909 29 another plugin up to Y, where neither X or Y are the latest migrations for those
Chris@909 30 plugins.
Chris@909 31
Chris@909 32 For those unfortunate few, I have two pieces of advice:
Chris@909 33
Chris@909 34 1. Why? This is a code smell [http://c2.com/xp/CodeSmell.html].
Chris@909 35
Chris@909 36 2. Well, OK. Don't panic. You can completely control plugin migrations by
Chris@909 37 creating your own migrations. To manually migrate a plugin to a specific
Chris@909 38 version, simply use
Chris@909 39
Chris@909 40 Engines.plugins[:your_plugin_name].migrate(version)
Chris@909 41
Chris@909 42 where version is the integer of the migration this plugin should end
Chris@909 43 up at.
Chris@909 44
Chris@909 45 With great power comes great responsibility. Use this wisely.