Sha256: 7b8ed0295fc0bfa155f93f20efe643748b31776123630e24da349900b2abb7f3

Contents?: true

Size: 741 Bytes

Versions: 5

Compression:

Stored size: 741 Bytes

Contents

class DeathAndTaxesMigration < ActiveRecord::Migration
  def self.up
    create_table :taxations do |t|
      t.references :taxable, :polymorphic => true
      t.integer :amount
      t.float :percentage
      t.string :name
      t.string :account_number
      
      t.timestamps
    end
    
    create_table :taxes do |t|
      t.references :taxer, :polymorphic => true
      t.float :percentage
      t.string :name
      t.string :account_number
      t.integer :apply_on_tax
      
      t.timestamps
    end
    
    add_index :taxations, [:taxable_id, :taxable_type]
    add_index :taxes, [:taxer_id, :taxer_type]
    add_index :taxes, :apply_on_tax
  end
  
  def self.down
    drop_table :taxations
    drop_table :taxes
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
death_and_taxes-0.0.5 lib/generators/death_and_taxes/migration/templates/active_record/migration.rb
death_and_taxes-0.0.4 lib/generators/death_and_taxes/migration/templates/active_record/migration.rb
death_and_taxes-0.0.3 lib/generators/death_and_taxes/migration/templates/active_record/migration.rb
death_and_taxes-0.0.2 lib/generators/death_and_taxes/migration/templates/active_record/migration.rb
death_and_taxes-0.0.1 lib/generators/death_and_taxes/migration/templates/active_record/migration.rb