GitHub Sale: sign up for any paid plan this week and pay nothing until January 1, 2009!  [ hide ]

public
Fork of halorgium/mephisto
Description: A mirror of the mephisto code-base
Homepage: http://mephistoblog.com/
Clone URL: git://github.com/zmack/mephisto.git
svenfuchs (author)
Wed Feb 20 11:11:20 -0800 2008
commit  1ad1b56b4a6c9284534b0afbb9d5d87715ae4312
tree    adc435b61f05728a991fd314188bc3e75cfb6038
parent  2772ec18227b04b3cb618748a2900a7b93b84d94
100644 45 lines (31 sloc) 1.578 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
Description:
  The plugin migration generator assists in working with schema additions
  required by plugins. Instead of running migrations from plugins directly,
  the generator creates a regular Rails migration which will be responsible
  for migrating the plugins from their current version to the latest version
  installed.
  
  This is important because the set of application migrations remains an
  accurate record of the state of the database, even as plugins are installed
  and removed during the development process.
 
Example:
  ./script/generate plugin_migration [<plugin_name> <another_plugin_name> ...]
 
  This will generate:
 
    RAILS_ROOT
      |- db
          |-migrate
              |- xxx_plugin_migrations.rb
 
  which contains the migrations for the given plugin(s).
  
  
Advanced Usage:
 
There may be situations where you need *complete* control over the migrations
of plugins in your application, migrating a certainly plugin down to X, and
another plugin up to Y, where neither X or Y are the latest migrations for those
plugins.
 
For those unfortunate few, I have two pieces of advice:
 
 1. Why? This is a code smell [http://c2.com/xp/CodeSmell.html].
 
 2. Well, OK. Don't panic. You can completely control plugin migrations by
    creating your own migrations. To manually migrate a plugin to a specific
    version, simply use
    
      Engines.plugins[:your_plugin_name].migrate(version)
      
    where version is the integer of the migration this plugin should end
    up at.
    
With great power comes great responsibility. Use this wisely.