RCP/Database/Result/Character.pm

filter: Statementstmt 100% 32 / 32 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod 100% 1 / 1 totaltotal 100% 37 / 37 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« RCP/Database/Result/CharCooldown.pm ↑ Summary RCP/Database/Result/CharacterCurrency.pm »
1 package Games::Framework::RCP::Database::Result::Character;
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('characters');
12 3 __PACKAGE__->add_columns(
13 id_character => {
14 data_type => 'integer',
15 is_nullable => 0,
16 is_auto_increment => 1,
17 comments => 'ID of the character.',
18 extra => {unsigned => 1},
19 },
20 name => {
21 data_type => 'varchar',
22 size => 64,
23 is_nullable => 0,
24 comments => 'Name of the character.',
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 is_male => {
33 data_type => 'boolean',
34 default_value => 'true',
35 is_nullable => 1,
36 comments => 'Gender of the character. NULL = unknown.',
37 },
38 is_good => {
39 data_type => 'boolean',
40 default_value => 'true',
41 is_nullable => 1,
42 comments => 'Is this character good or evil? NULL = neutral.',
43 },
44 is_lawful => {
45 data_type => 'boolean',
46 default_value => 'true',
47 is_nullable => 1,
48 comments => 'Is this character lawful or chaotic? NULL = neutral.',
49 }
50 );
51  
52 3 __PACKAGE__->utf8_columns(qw/name/);
53 3 __PACKAGE__->set_primary_key('id_character');
54 3 __PACKAGE__->add_unique_constraint(['name']);
55  
56 3 __PACKAGE__->has_one(callscript => 'Games::Framework::RCP::Database::Result::Callscript', 'fkey_character');
57  
58 3 __PACKAGE__->has_one(player_char => 'Games::Framework::RCP::Database::Result::PlayerChar', 'fkey_character');
59  
60 3 __PACKAGE__->has_one(combatant => 'Games::Framework::RCP::Database::Result::Combatant', 'fkey_character');
61  
62 3 __PACKAGE__->belongs_to(color => 'Games::Framework::RCP::Database::Result::Color', 'fkey_color');
63  
64 3 __PACKAGE__->has_many(character_moves => 'Games::Framework::RCP::Database::Result::CharacterMove', 'fkey_character');
65  
66 3 __PACKAGE__->has_many(char_cooldowns => 'Games::Framework::RCP::Database::Result::CharCooldown', 'fkey_character');
67 3 __PACKAGE__->many_to_many(moves => 'char_cooldowns', 'characters');
68  
69 3 __PACKAGE__->has_many(character_inventories => 'Games::Framework::RCP::Database::Result::CharacterInventory', 'fkey_character');
70 3 __PACKAGE__->many_to_many(items => 'character_inventories', 'characters');
71  
72 3 __PACKAGE__->has_many(characters => 'Games::Framework::RCP::Database::Result::CharacterCurrency', 'fkey_character');
73 3 __PACKAGE__->many_to_many(currency => 'characters', 'currency');
74  
75 2 ▶sub sqlt_deploy_hook {
Subroutine sqlt_deploy_hook: called CC=1 SCAR=0.0
Pod documented
76 2 my ($self, $sqlt_table) = @_;
77
78 2 $sqlt_table->options({ENGINE => 'InnoDB'});
79 2 $sqlt_table->options({CHARSET => 'UTF8'});
80 2 $sqlt_table->comments('Every single character involved in this game one way or another.');
81 }
82  
83 3 1;
84  
85 __END__
« RCP/Database/Result/CharCooldown.pm ↑ Summary RCP/Database/Result/CharacterCurrency.pm »