Sha256: d57c4047c12dbd41a6b50952a12e683bac078853ee30b00a3f8edb8a7c73c0bd

Contents?: true

Size: 537 Bytes

Versions: 3

Compression:

Stored size: 537 Bytes

Contents

MIGRATION_BASE_CLASS = if ActiveRecord::VERSION::MAJOR >= 5
  ActiveRecord::Migration[5.0]
else
  ActiveRecord::Migration
end

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

  def self.down
    drop_table :settings
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ledermann-rails-settings-2.5.0 lib/generators/rails_settings/migration/templates/migration.rb
ledermann-rails-settings-2.4.3 lib/generators/rails_settings/migration/templates/migration.rb
ledermann-rails-settings-2.4.2 lib/generators/rails_settings/migration/templates/migration.rb