remove trailing white-spaces from db/migrate/007_create_journals.rb (#9510)
Contributed by Igor Zubkov. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7759 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
47bcd7f3c3
commit
02378acc80
|
@ -4,7 +4,7 @@ class CreateJournals < ActiveRecord::Migration
|
||||||
class IssueHistory < ActiveRecord::Base; belongs_to :issue; end
|
class IssueHistory < ActiveRecord::Base; belongs_to :issue; end
|
||||||
# model removed
|
# model removed
|
||||||
class Permission < ActiveRecord::Base; end
|
class Permission < ActiveRecord::Base; end
|
||||||
|
|
||||||
def self.up
|
def self.up
|
||||||
create_table :journals, :force => true do |t|
|
create_table :journals, :force => true do |t|
|
||||||
t.column "journalized_id", :integer, :default => 0, :null => false
|
t.column "journalized_id", :integer, :default => 0, :null => false
|
||||||
|
@ -20,19 +20,19 @@ class CreateJournals < ActiveRecord::Migration
|
||||||
t.column "old_value", :string
|
t.column "old_value", :string
|
||||||
t.column "value", :string
|
t.column "value", :string
|
||||||
end
|
end
|
||||||
|
|
||||||
# indexes
|
# indexes
|
||||||
add_index "journals", ["journalized_id", "journalized_type"], :name => "journals_journalized_id"
|
add_index "journals", ["journalized_id", "journalized_type"], :name => "journals_journalized_id"
|
||||||
add_index "journal_details", ["journal_id"], :name => "journal_details_journal_id"
|
add_index "journal_details", ["journal_id"], :name => "journal_details_journal_id"
|
||||||
|
|
||||||
Permission.create :controller => "issues", :action => "history", :description => "label_history", :sort => 1006, :is_public => true, :mail_option => 0, :mail_enabled => 0
|
Permission.create :controller => "issues", :action => "history", :description => "label_history", :sort => 1006, :is_public => true, :mail_option => 0, :mail_enabled => 0
|
||||||
|
|
||||||
# data migration
|
# data migration
|
||||||
IssueHistory.find(:all, :include => :issue).each {|h|
|
IssueHistory.find(:all, :include => :issue).each {|h|
|
||||||
j = Journal.new(:journalized => h.issue, :user_id => h.author_id, :notes => h.notes, :created_on => h.created_on)
|
j = Journal.new(:journalized => h.issue, :user_id => h.author_id, :notes => h.notes, :created_on => h.created_on)
|
||||||
j.details << JournalDetail.new(:property => 'attr', :prop_key => 'status_id', :value => h.status_id)
|
j.details << JournalDetail.new(:property => 'attr', :prop_key => 'status_id', :value => h.status_id)
|
||||||
j.save
|
j.save
|
||||||
}
|
}
|
||||||
|
|
||||||
drop_table :issue_histories
|
drop_table :issue_histories
|
||||||
end
|
end
|
||||||
|
@ -40,7 +40,7 @@ class CreateJournals < ActiveRecord::Migration
|
||||||
def self.down
|
def self.down
|
||||||
drop_table :journal_details
|
drop_table :journal_details
|
||||||
drop_table :journals
|
drop_table :journals
|
||||||
|
|
||||||
create_table "issue_histories", :force => true do |t|
|
create_table "issue_histories", :force => true do |t|
|
||||||
t.column "issue_id", :integer, :default => 0, :null => false
|
t.column "issue_id", :integer, :default => 0, :null => false
|
||||||
t.column "status_id", :integer, :default => 0, :null => false
|
t.column "status_id", :integer, :default => 0, :null => false
|
||||||
|
@ -48,7 +48,7 @@ class CreateJournals < ActiveRecord::Migration
|
||||||
t.column "notes", :text, :default => ""
|
t.column "notes", :text, :default => ""
|
||||||
t.column "created_on", :timestamp
|
t.column "created_on", :timestamp
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "issue_histories", ["issue_id"], :name => "issue_histories_issue_id"
|
add_index "issue_histories", ["issue_id"], :name => "issue_histories_issue_id"
|
||||||
|
|
||||||
Permission.find(:first, :conditions => ["controller=? and action=?", 'issues', 'history']).destroy
|
Permission.find(:first, :conditions => ["controller=? and action=?", 'issues', 'history']).destroy
|
||||||
|
|
Loading…
Reference in New Issue