| 1 | package Games::Framework::RCP::Database::Result::ItemWithStat; | ||
| 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('items_with_stats'); | |
| 13 | 3 | __PACKAGE__->add_columns( | |
| 14 | id_item_with_stat => { | ||
| 15 | data_type => 'integer', | ||
| 16 | is_nullable => 0, | ||
| 17 | is_auto_increment => 1, | ||
| 18 | comments => 'ID of the item/stat combination.', | ||
| 19 | extra => {unsigned => 1}, | ||
| 20 | }, | ||
| 21 | fkey_item => { | ||
| 22 | data_type => 'integer', | ||
| 23 | is_nullable => 0, | ||
| 24 | comments => 'ID of the item.', | ||
| 25 | extra => {unsigned => 1}, | ||
| 26 | }, | ||
| 27 | fkey_item_stat => { | ||
| 28 | data_type => 'integer', | ||
| 29 | is_nullable => 0, | ||
| 30 | comments => 'ID of the stat being modified.', | ||
| 31 | extra => {unsigned => 1}, | ||
| 32 | }, | ||
| 33 | value => { | ||
| 34 | data_type => 'varchar', | ||
| 35 | size => 16, | ||
| 36 | is_nullable => 0, | ||
| 37 | comments => 'The value of the stat for modification.', | ||
| 38 | }, | ||
| 39 | operator => { | ||
| 40 | data_type => 'varchar', | ||
| 41 | size => 4, | ||
| 42 | is_nullable => 0, | ||
| 43 | default_value => '+', | ||
| 44 | comments => 'The operator to use on the value.', | ||
| 45 | }, | ||
| 46 | ); | ||
| 47 | |||
| 48 | 3 | __PACKAGE__->utf8_columns(qw/value operator/); | |
| 49 | 3 | __PACKAGE__->set_primary_key('id_item_with_stat'); | |
| 50 | 3 | __PACKAGE__->add_unique_constraint(['fkey_item', 'fkey_item_stat']); | |
| 51 | 3 | __PACKAGE__->belongs_to(items => 'Games::Framework::RCP::Database::Result::Item', 'fkey_item'); | |
| 52 | 3 | __PACKAGE__->belongs_to(item_stats => 'Games::Framework::RCP::Database::Result::ItemStat', 'fkey_item_stat'); | |
| 53 | |||
| 54 | 2 | ▶ | sub sqlt_deploy_hook { |
|
Subroutine
sqlt_deploy_hook: called CC=1 SCAR=0.0
Pod
documented
| |||
| 55 | 2 | my ($self, $sqlt_table) = @_; | |
| 56 | |||
| 57 | 2 | $sqlt_table->options({ENGINE => 'InnoDB'}); | |
| 58 | 2 | $sqlt_table->options({CHARSET => 'UTF8'}); | |
| 59 | 2 | $sqlt_table->comments('Every item that gives a stat change upon using.'); | |
| 60 | } | ||
| 61 | |||
| 62 | 3 | 1; | |
| 63 | |||
| 64 | __END__ | ||