| 1 | package Games::Framework::RCP::Database::Result::CombatantInventory; | ||
| 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 | 3 | ▶ | use utf8; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | |||
| 7 | 3 | our $VERSION = '0.22'; | |
| 8 | |||
| 9 | 3 | ▶ | use base qw/DBIx::Class/; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 10 | |||
| 11 | 3 | __PACKAGE__->load_components(qw/UTF8Columns Core/); | |
| 12 | 3 | __PACKAGE__->table('combatant_inventory'); | |
| 13 | 3 | __PACKAGE__->add_columns( | |
| 14 | id_combatant_inventory => { | ||
| 15 | data_type => 'integer', | ||
| 16 | is_nullable => 0, | ||
| 17 | is_auto_increment => 1, | ||
| 18 | comments => 'ID of the combatant / item combination.', | ||
| 19 | extra => {unsigned => 1}, | ||
| 20 | }, | ||
| 21 | fkey_combatant => { | ||
| 22 | data_type => 'integer', | ||
| 23 | is_nullable => 0, | ||
| 24 | comments => 'ID of the combatant.', | ||
| 25 | extra => {unsigned => 1}, | ||
| 26 | }, | ||
| 27 | fkey_item => { | ||
| 28 | data_type => 'integer', | ||
| 29 | is_nullable => 0, | ||
| 30 | comments => 'ID of the item.', | ||
| 31 | extra => {unsigned => 1}, | ||
| 32 | }, | ||
| 33 | display_name => { | ||
| 34 | data_type => 'varchar', | ||
| 35 | size => 64, | ||
| 36 | is_nullable => 1, | ||
| 37 | default_value => undef, | ||
| 38 | comments => 'Publically displayed name of the item.', | ||
| 39 | }, | ||
| 40 | ammo => { | ||
| 41 | data_type => 'integer', | ||
| 42 | is_nullable => 1, | ||
| 43 | default_value => 1, | ||
| 44 | comments => 'How much of this item does the combatant have in storage?', | ||
| 45 | }, | ||
| 46 | ); | ||
| 47 | |||
| 48 | 3 | __PACKAGE__->utf8_columns(qw/display_name/); | |
| 49 | |||
| 50 | 3 | __PACKAGE__->set_primary_key('id_combatant_inventory'); | |
| 51 | |||
| 52 | 3 | __PACKAGE__->belongs_to(items => 'Games::Framework::RCP::Database::Result::Item', 'fkey_item'); | |
| 53 | |||
| 54 | 3 | __PACKAGE__->belongs_to(combatants => 'Games::Framework::RCP::Database::Result::Combatant', 'fkey_combatant'); | |
| 55 | |||
| 56 | 2 | ▶ | sub sqlt_deploy_hook { |
|
Subroutine
sqlt_deploy_hook: called CC=1 SCAR=0.0
Pod
documented
| |||
| 57 | 2 | my ($self, $sqlt_table) = @_; | |
| 58 | |||
| 59 | 2 | $sqlt_table->options({ENGINE => 'InnoDB'}); | |
| 60 | 2 | $sqlt_table->options({CHARSET => 'UTF8'}); | |
| 61 | 2 | $sqlt_table->comments('Every item a combatant has in battle.'); | |
| 62 | } | ||
| 63 | |||
| 64 | 3 | 1; | |
| 65 | |||
| 66 | __END__ | ||