Sha256: 1c90fea0e206fba5d3d106cf847a5446a9d3104be501fedb38679900f97c894f

Contents?: true

Size: 1010 Bytes

Versions: 4

Compression:

Stored size: 1010 Bytes

Contents

class CreatePlutusTables < ActiveRecord::Migration
  def self.up
    create_table :plutus_accounts do |t|
      t.string :name
      t.string :type
      t.boolean :contra

      t.timestamps
    end
    add_index :plutus_accounts, [:name, :type]

    create_table :plutus_entries do |t|
      t.string :description
      t.integer :commercial_document_id
      t.string :commercial_document_type

      t.timestamps
    end
    add_index :plutus_entries, [:commercial_document_id, :commercial_document_type], :name => "index_entries_on_commercial_doc"

    create_table :plutus_amounts do |t|
      t.string :type
      t.references :account
      t.references :entry
      t.decimal :amount, :precision => 20, :scale => 10
    end 
    add_index :plutus_amounts, :type
    add_index :plutus_amounts, [:account_id, :entry_id]
    add_index :plutus_amounts, [:entry_id, :account_id]
  end

  def self.down
    drop_table :plutus_accounts
    drop_table :plutus_entries
    drop_table :plutus_amounts
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
plutus-0.11.0 lib/generators/plutus/templates/migration.rb
plutus-0.10.1 lib/generators/plutus/templates/migration.rb
plutus-0.10.0 lib/generators/plutus/templates/migration.rb
plutus-0.9.0 lib/generators/plutus/templates/migration.rb