| 1 | package Games::Framework::RCP::Database::Result::Currency; | ||
| 2 | |||
| 3 | 3 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 3 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | 3 | our $VERSION = '0.22'; | |
| 7 | |||
| 8 | 3 | ▶ | use base qw/DBIx::Class/; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | |||
| 10 | 3 | __PACKAGE__->load_components(qw/UTF8Columns Core/); | |
| 11 | 3 | __PACKAGE__->table('currency'); | |
| 12 | 3 | __PACKAGE__->add_columns( | |
| 13 | id_currency => { | ||
| 14 | data_type => 'integer', | ||
| 15 | is_nullable => 0, | ||
| 16 | is_auto_increment => 1, | ||
| 17 | comments => 'ID of the currency.', | ||
| 18 | extra => {unsigned => 1}, | ||
| 19 | }, | ||
| 20 | name => { | ||
| 21 | data_type => 'varchar', | ||
| 22 | size => 32, | ||
| 23 | is_nullable => 0, | ||
| 24 | comments => 'Name of the currency.', | ||
| 25 | }, | ||
| 26 | fkey_color => { | ||
| 27 | data_type => 'integer', | ||
| 28 | is_nullable => 1, | ||
| 29 | comments => 'ID of the color set.', | ||
| 30 | extra => {unsigned => 1}, | ||
| 31 | }, | ||
| 32 | description => { | ||
| 33 | data_type => 'varchar', | ||
| 34 | size => 256, | ||
| 35 | is_nullable => 1, | ||
| 36 | comments => 'Description of the currency.', | ||
| 37 | }, | ||
| 38 | ); | ||
| 39 | |||
| 40 | 3 | __PACKAGE__->utf8_columns(qw/name description/); | |
| 41 | 3 | __PACKAGE__->set_primary_key('id_currency'); | |
| 42 | 3 | __PACKAGE__->add_unique_constraint(['name']); | |
| 43 | |||
| 44 | 3 | __PACKAGE__->has_many(currency => 'Games::Framework::RCP::Database::Result::CharacterCurrency', 'fkey_currency'); | |
| 45 | 3 | __PACKAGE__->many_to_many(characters => 'currency', 'character'); | |
| 46 | |||
| 47 | 3 | __PACKAGE__->has_many(currency => 'Games::Framework::RCP::Database::Result::CombatantCurrency', 'fkey_currency'); | |
| 48 | 3 | __PACKAGE__->many_to_many(combatants => 'currency', 'combatant'); | |
| 49 | |||
| 50 | 3 | __PACKAGE__->belongs_to(color => 'Games::Framework::RCP::Database::Result::Color', 'fkey_color'); | |
| 51 | |||
| 52 | 2 | ▶ | sub sqlt_deploy_hook { |
|
Subroutine
sqlt_deploy_hook: called CC=1 SCAR=0.0
Pod
documented
| |||
| 53 | 2 | my ($self, $sqlt_table) = @_; | |
| 54 | |||
| 55 | 2 | $sqlt_table->options({ENGINE => 'InnoDB'}); | |
| 56 | 2 | $sqlt_table->options({CHARSET => 'UTF8'}); | |
| 57 | 2 | $sqlt_table->comments('The different currencies available.'); | |
| 58 | } | ||
| 59 | |||
| 60 | 3 | 1; | |
| 61 | |||
| 62 | __END__ | ||