Sha256: 8e30ace56997d55ebdcb011077244a1d558e4a5aa3ddbffcfdfa0858cd8075d2

Contents?: true

Size: 679 Bytes

Versions: 7

Compression:

Stored size: 679 Bytes

Contents

class TunableMigration < ActiveRecord::Migration
  def self.up
    create_table :settings do |t|
      t.column :context, :string
      t.column :key, :string
      t.column :value, :string

      t.column :settable_id, :integer
      t.column :settable_type, :string
      t.column :created_at, :datetime
    end

    add_index :settings, [:settable_id, :settable_type]
    add_index :settings, [:settable_id, :context, :key], :unique => true
  end

  def self.down
    remove_index :settings, :name => "index_settings_on_settable_id_and_settable_type"
    remove_index :settings, :name => "index_settings_on_settable_id_and_context_and_key"

    drop_table :settings
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
tunable-0.0.7 generators/tunable_migration/templates/migration.rb
tunable-0.0.6 generators/tunable_migration/templates/migration.rb
tunable-0.0.5 generators/tunable_migration/templates/migration.rb
tunable-0.0.4 generators/tunable_migration/templates/migration.rb
tunable-0.0.3 generators/tunable_migration/templates/migration.rb
tunable-0.0.2 generators/tunable_migration/templates/migration.rb
tunable-0.0.1 generators/tunable_migration/templates/migration.rb