Sha256: 342332f3e53c1ba685219a7c764416a5a04491c2fc05f1025c075578cc5a3fa3

Contents?: true

Size: 416 Bytes

Versions: 2

Compression:

Stored size: 416 Bytes

Contents

class RailsSettingsMigration < ActiveRecord::Migration
  def self.up
    create_table :settings do |t|
      t.string     :var,    :null => false
      t.text       :value,  :null => false
      t.references :target, :null => false, :polymorphic => true
      t.timestamps
    end
    add_index :settings, [ :target_type, :target_id, :var ], :unique => true
  end

  def self.down
    drop_table :settings
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ledermann-rails-settings-2.0.1 lib/generators/rails_settings/migration/templates/migration.rb
ledermann-rails-settings-2.0.0 lib/generators/rails_settings/migration/templates/migration.rb