Sha256: 1f2ed6bd6b5610217ce59c8aea83a26ff2509d790041929aa2ed3e8ff74bd036

Contents?: true

Size: 479 Bytes

Versions: 10

Compression:

Stored size: 479 Bytes

Contents

class CreatePreferences < ActiveRecord::Migration
  def self.up
    create_table :preferences do |t|
      t.integer :user_id, null: false
      t.string  :category, null: false
      t.string  :name, null: false
      t.integer :value, null: false
      t.timestamps
    end

    add_index :preferences, :user_id
    add_index :preferences, [:user_id, :category]
    add_index :preferences, [:category, :name, :value]
  end

  def self.down
    drop_table :preferences
  end
end

Version data entries

10 entries across 6 versions & 1 rubygems

Version Path
user_preferences-1.0.2 lib/generators/user_preferences/templates/migration.rb
user_preferences-1.0.1 lib/generators/user_preferences/templates/migration.rb
user_preferences-1.0.0 lib/generators/user_preferences/templates/migration.rb
user_preferences-1.0.0 spec/migrations/002_create_preferences.rb
user_preferences-0.0.3 spec/migrations/002_create_preferences.rb
user_preferences-0.0.3 lib/generators/user_preferences/templates/migration.rb
user_preferences-0.0.2 spec/migrations/002_create_preferences.rb
user_preferences-0.0.2 lib/generators/user_preferences/templates/migration.rb
user_preferences-0.0.1 lib/generators/user_preferences/templates/migration.rb
user_preferences-0.0.1 spec/migrations/002_create_preferences.rb