comparison .svn/pristine/e8/e867d702d670ca00a87cd683a9e4a85aba9b478b.svn-base @ 909:cbb26bc654de redmine-1.3

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