| 1 | package AproJo::DB::Schema::Result::Group; | ||
| 2 | |||
| 3 | 2 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 2 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | 2 | ▶ | use base 'DBIx::Class::Core'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | |||
| 8 | 2 | __PACKAGE__->table('groups'); | |
| 9 | |||
| 10 | 2 | __PACKAGE__->add_columns( | |
| 11 | 'group_id', | ||
| 12 | {data_type => 'integer', is_auto_increment => 1, is_nullable => 0}, | ||
| 13 | 'name', | ||
| 14 | {data_type => 'varchar', is_nullable => 0, size => 160}, | ||
| 15 | 'trash', | ||
| 16 | {data_type => 'tinyint', default_value => 0, is_nullable => 0}, | ||
| 17 | ); | ||
| 18 | |||
| 19 | 2 | __PACKAGE__->set_primary_key('group_id'); | |
| 20 | |||
| 21 | 2 | __PACKAGE__->has_many( | |
| 22 | 'user_groups', | ||
| 23 | 'AproJo::DB::Schema::Result::UserGroup', | ||
| 24 | {'foreign.group_id' => 'self.group_id'}, | ||
| 25 | {cascade_copy => 0, cascade_delete => 0}, | ||
| 26 | ); | ||
| 27 | |||
| 28 | 2 | __PACKAGE__->many_to_many('user_ids', 'user_groups', 'user_id'); | |
| 29 | |||
| 30 | 2 | 1; | |