package Orchard::DB::Schema::RoyaltyAccounting::ExchangeRate;

use strict;
use warnings;

use lib '/var/app/orchard/collab/jgetter/perllib';
use base 'Orchard::DB::DBIxCore';

## table
__PACKAGE__->table('royalty_accounting.exchange_rate');

## columns
__PACKAGE__->add_columns(
    'exchange_rate_id' => {'is_auto_increment'=>1,'data_type'=>'mediumint','is_nullable'=>0},
    'statement_period_id' => {'data_type'=>'mediumint','is_nullable'=>0},
    'rate' => {'data_type'=>'decimal','is_nullable'=>0},
    'from_currency_code' => {'data_type'=>'char','is_nullable'=>0},
    'to_currency_code' => {'data_type'=>'char','is_nullable'=>0},
    'created_by' => {'data_type'=>'varchar','is_nullable'=>0},
    'created_at' => {'data_type'=>'datetime','is_nullable'=>0},
    'last_modified_by' => {'data_type'=>'varchar','is_nullable'=>0},
    'last_modified' => {'data_type'=>'datetime','is_nullable'=>0}
);

## primary key
__PACKAGE__->set_primary_key('exchange_rate_id');

## unique key (statement_period_id, from_currency_code, to_currency_code)
__PACKAGE__->add_unique_constraint('uidx_statement_period_currencies' => [qw/statement_period_id from_currency_code to_currency_code/]);

1;
