Sha256: 14653b59ef1ebf4bbf49f7ae07d3c7c6b612864bcc310d18b80481e9b7aeeead

Contents?: true

Size: 369 Bytes

Versions: 2

Compression:

Stored size: 369 Bytes

Contents

class CreateTokens < ActiveRecord::Migration
  def self.up
    create_table :tokens do |t|
      t.belongs_to :parent, :polymorphic => true
      t.string :value
    end
    
    change_table :tokens do |t|
      t.index [:parent_id, :parent_type], :unique => true
      t.index :value, :unique => true
    end
  end
  
  def self.down
    drop_table :tokens
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
laserlemon-has_token-0.3.0 generators/has_token_migration/templates/migration.rb
laserlemon-has_token-0.3.1 generators/has_token_migration/templates/migration.rb