Sha256: af2021c55125cddd47bcb14fc1f43952dc426ffaeb50f055c75590102d998237

Contents?: true

Size: 730 Bytes

Versions: 11

Compression:

Stored size: 730 Bytes

Contents

Sequel.migration do

  up do
    rename_column(:settings, :key, :name, :unique => true)
    rename_column(:settings, :group_key, :group)

    drop_column(:settings, :language_key)
    drop_column(:settings, :language_group_key)

    # Update the settings
    Zen.database[:settings].all.each do |row|
      name  = row[:name].split('.').last
      group = row[:group].split('.').last

      Zen.database[:settings].filter(:id => row[:id]) \
        .update(:name => name, :group => group)
    end
  end
  
  down do
    rename_column(:settings, :name , :key)
    rename_column(:settings, :group, :group_key)

    add_column(:settings, :language_key      , String)
    add_column(:settings, :language_group_key, String)
  end

end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
zen-0.4.3 lib/zen/package/settings/migrations/1303196915_settings_plugin.rb
zen-0.4.2 lib/zen/package/settings/migrations/1303196915_settings_plugin.rb
zen-0.4.1 lib/zen/package/settings/migrations/1303196915_settings_plugin.rb
zen-0.4 lib/zen/package/settings/migrations/1303196915_settings_plugin.rb
zen-0.3 lib/zen/package/settings/migrations/1303196915_settings_plugin.rb
zen-0.3b1 lib/zen/package/settings/migrations/1303196915_settings_plugin.rb
zen-0.3b lib/zen/package/settings/migrations/1303196915_settings_plugin.rb
zen-0.2.8 lib/zen/package/settings/migrations/1303196915_settings_plugin.rb
zen-0.2.7 lib/zen/package/settings/migrations/1303196915_settings_plugin.rb
zen-0.2.6.1 lib/zen/package/settings/migrations/1303196915_settings_plugin.rb
zen-0.2.6 lib/zen/package/settings/migrations/1303196915_settings_plugin.rb