Fix whitespace in migrations

Signed-off-by: Alex Coles <alex@alexbcoles.com>
pull/1389/head
Alex Coles 11 years ago
parent 3dc65b9d2a
commit be6563f6ec
  1. 1
      db/migrate/000_aggregated_migrations.rb
  2. 10
      db/migrate/20120319095930_localize_email_header_and_footer.rb
  3. 8
      db/migrate/20120529090411_create_delayed_jobs.rb
  4. 20
      db/migrate/20131004141959_generalize_wiki_menu_items.rb
  5. 2
      db/migrate/20140127134733_fix_issue_in_notifications.rb
  6. 1
      db/migrate/migration_utils/migration_squasher.rb
  7. 1
      db/migrate/migration_utils/setting_renamer.rb

@ -893,4 +893,3 @@ class AggregatedMigrations < ActiveRecord::Migration
end
end

@ -32,10 +32,10 @@ class LocalizeEmailHeaderAndFooter < ActiveRecord::Migration
def self.up
emails_header = Setting.find_by_name 'emails_header'
emails_footer = Setting.find_by_name 'emails_footer'
default_language = Setting.default_language
default_language = 'en' if default_language.blank?
if emails_header
translation = { default_language => emails_header.read_attribute(:value) }
emails_header.write_attribute(:value, translation.to_yaml.to_s)
@ -52,10 +52,10 @@ class LocalizeEmailHeaderAndFooter < ActiveRecord::Migration
def self.down
emails_header = Setting.find_by_name 'emails_header'
emails_footer = Setting.find_by_name 'emails_footer'
default_language = Setting.default_language
default_language = 'en' if default_language.blank?
if emails_header
translations = YAML::load(emails_header.read_attribute(:value))
text = translations[default_language]
@ -73,5 +73,5 @@ class LocalizeEmailHeaderAndFooter < ActiveRecord::Migration
emails_footer.write_attribute(:value, text)
emails_footer.save!
end
end
end
end

@ -40,11 +40,11 @@ class CreateDelayedJobs < ActiveRecord::Migration
table.string :locked_by # Who is working on this object (if locked)
table.timestamps
end
add_index :delayed_jobs, [:priority, :run_at], :name => 'delayed_jobs_priority'
end
def self.down
drop_table :delayed_jobs
drop_table :delayed_jobs
end
end
end

@ -29,23 +29,23 @@
class GeneralizeWikiMenuItems < ActiveRecord::Migration
def up
rename_table :wiki_menu_items, :menu_items
add_column :menu_items, :type, :string
rename_column :menu_items, :wiki_id, :navigatable_id
rename_table :wiki_menu_items, :menu_items
add_column :menu_items, :type, :string
rename_column :menu_items, :wiki_id, :navigatable_id
rename_index :menu_items, 'index_wiki_menu_items_on_parent_id', 'index_menu_items_on_parent_id'
rename_index :menu_items, 'index_wiki_menu_items_on_wiki_id_and_title', 'index_menu_items_on_navigatable_id_and_title'
MenuItem.find_each do |menu_item|
menu_item.update_attribute :type, 'MenuItems::WikiMenuItem'
end
MenuItem.find_each do |menu_item|
menu_item.update_attribute :type, 'MenuItems::WikiMenuItem'
end
# TODO rename indexes
# TODO rename indexes
end
def down
rename_table :menu_items, :wiki_menu_items
remove_column :wiki_menu_items, :type
rename_column :wiki_menu_items, :navigatable_id, :wiki_id
rename_table :menu_items, :wiki_menu_items
remove_column :wiki_menu_items, :type
rename_column :wiki_menu_items, :navigatable_id, :wiki_id
rename_index :wiki_menu_items, 'index_menu_items_on_parent_id', 'index_wiki_menu_items_on_parent_id'
rename_index :wiki_menu_items, 'index_menu_items_on_navigatable_id_and_title', 'index_wiki_menu_items_on_wiki_id_and_title'
end

@ -41,7 +41,7 @@ class FixIssueInNotifications < ActiveRecord::Migration
def down
Setting['notified_events'] = replace(Setting['notified_events'], REPLACED.invert)
end
private
def replace(value,mapping)

@ -108,4 +108,3 @@ module Migration
end
end
end

@ -55,4 +55,3 @@ module Migration
end
end
end

Loading…
Cancel
Save