Module: Cms::Upgrades::V3_4_0

Defined in:
lib/cms/upgrades/v3_4_0.rb

Overview

Commands specifically for upgrading to version 3.4.0 of BrowserCMS

Defined Under Namespace

Modules: SchemaStatements

Instance Method Summary collapse

Instance Method Details

#generate_rails_3_4_0_migrationObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/cms/upgrades/v3_4_0.rb', line 7

def generate_rails_3_4_0_migration
  generate "migration", "update_version_id_columns"
  blocks = find_custom_blocks
  migration = migration_with_name("update_version_id_columns")
  text = <<TEXT
models = %w{#{blocks.join(' ')}}
models.each do |model_name|
  standardize_version_id_column(model_name)
end
TEXT
  insert_into_file migration, text, :after => "def up\n"
  insert_into_file migration, "require 'cms/upgrades/v3_4_0'\n", :before => "class"
  insert_into_file migration, "include Cms::Upgrades::V3_4_0::SchemaStatements\n", :after => "Migration\n"
end