To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.
root / db / migrate / 068_create_enabled_modules.rb @ 912:5e80956cc792
History | View | Annotate | Download (531 Bytes)
| 1 | 0:513646585e45 | Chris | class CreateEnabledModules < ActiveRecord::Migration |
|---|---|---|---|
| 2 | def self.up |
||
| 3 | create_table :enabled_modules do |t| |
||
| 4 | t.column :project_id, :integer |
||
| 5 | t.column :name, :string, :null => false |
||
| 6 | end
|
||
| 7 | add_index :enabled_modules, [:project_id], :name => :enabled_modules_project_id |
||
| 8 | 909:cbb26bc654de | Chris | |
| 9 | 0:513646585e45 | Chris | # Enable all modules for existing projects
|
| 10 | Project.find(:all).each do |project| |
||
| 11 | project.enabled_module_names = Redmine::AccessControl.available_project_modules |
||
| 12 | end
|
||
| 13 | end
|
||
| 14 | |||
| 15 | def self.down |
||
| 16 | drop_table :enabled_modules
|
||
| 17 | end
|
||
| 18 | end |