@@ -4,7 +4,7 class CreateJournals < ActiveRecord::Migration | |||
|
4 | 4 | class IssueHistory < ActiveRecord::Base; belongs_to :issue; end |
|
5 | 5 | # model removed |
|
6 | 6 | class Permission < ActiveRecord::Base; end |
|
7 | ||
|
7 | ||
|
8 | 8 | def self.up |
|
9 | 9 | create_table :journals, :force => true do |t| |
|
10 | 10 | t.column "journalized_id", :integer, :default => 0, :null => false |
@@ -20,19 +20,19 class CreateJournals < ActiveRecord::Migration | |||
|
20 | 20 | t.column "old_value", :string |
|
21 | 21 | t.column "value", :string |
|
22 | 22 | end |
|
23 | ||
|
23 | ||
|
24 | 24 | # indexes |
|
25 | 25 | add_index "journals", ["journalized_id", "journalized_type"], :name => "journals_journalized_id" |
|
26 | 26 | add_index "journal_details", ["journal_id"], :name => "journal_details_journal_id" |
|
27 | ||
|
27 | ||
|
28 | 28 | Permission.create :controller => "issues", :action => "history", :description => "label_history", :sort => 1006, :is_public => true, :mail_option => 0, :mail_enabled => 0 |
|
29 | 29 | |
|
30 | 30 | # data migration |
|
31 | 31 | IssueHistory.find(:all, :include => :issue).each {|h| |
|
32 | 32 | j = Journal.new(:journalized => h.issue, :user_id => h.author_id, :notes => h.notes, :created_on => h.created_on) |
|
33 | 33 | j.details << JournalDetail.new(:property => 'attr', :prop_key => 'status_id', :value => h.status_id) |
|
34 |
j.save |
|
|
35 |
} |
|
|
34 | j.save | |
|
35 | } | |
|
36 | 36 | |
|
37 | 37 | drop_table :issue_histories |
|
38 | 38 | end |
@@ -40,7 +40,7 class CreateJournals < ActiveRecord::Migration | |||
|
40 | 40 | def self.down |
|
41 | 41 | drop_table :journal_details |
|
42 | 42 | drop_table :journals |
|
43 | ||
|
43 | ||
|
44 | 44 | create_table "issue_histories", :force => true do |t| |
|
45 | 45 | t.column "issue_id", :integer, :default => 0, :null => false |
|
46 | 46 | t.column "status_id", :integer, :default => 0, :null => false |
@@ -48,7 +48,7 class CreateJournals < ActiveRecord::Migration | |||
|
48 | 48 | t.column "notes", :text, :default => "" |
|
49 | 49 | t.column "created_on", :timestamp |
|
50 | 50 | end |
|
51 | ||
|
51 | ||
|
52 | 52 | add_index "issue_histories", ["issue_id"], :name => "issue_histories_issue_id" |
|
53 | 53 | |
|
54 | 54 | Permission.find(:first, :conditions => ["controller=? and action=?", 'issues', 'history']).destroy |
General Comments 0
You need to be logged in to leave comments.
Login now