« PopulateMore/Test/Schema/Result/FriendList.pm
↑ Summary
PopulateMore/Test/Schema/Result/Person.pm »
| 1 | package #hide from pause | ||
| 2 | DBIx::Class::Schema::PopulateMore::Test::Schema::Result::Gender; | ||
| 3 | |||
| 4 | 3 | ▶ | use parent 'DBIx::Class::Schema::PopulateMore::Test::Schema::Result'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | =head1 NAME | ||
| 7 | |||
| 8 | DBIx::Class::Schema::PopulateMore::Test::Schema::Result::Gender - A Gender Class | ||
| 9 | |||
| 10 | =head1 DESCRIPTION | ||
| 11 | |||
| 12 | Tests for this type of FK relationship | ||
| 13 | |||
| 14 | =head1 PACKAGE METHODS | ||
| 15 | |||
| 16 | This module defines the following package methods | ||
| 17 | |||
| 18 | =head2 table | ||
| 19 | |||
| 20 | Name of the Physical table in the database | ||
| 21 | |||
| 22 | =cut | ||
| 23 | |||
| 24 | 3 | __PACKAGE__ | |
| 25 | ->table('gender'); | ||
| 26 | |||
| 27 | |||
| 28 | =head2 add_columns | ||
| 29 | |||
| 30 | Add columns and meta information | ||
| 31 | |||
| 32 | =head3 gender_id | ||
| 33 | |||
| 34 | Primary Key which is an auto generated UUID | ||
| 35 | |||
| 36 | =head3 label | ||
| 37 | |||
| 38 | Text label of the gender (ie, 'male', 'female', 'transgender', etc.). | ||
| 39 | |||
| 40 | =cut | ||
| 41 | |||
| 42 | 3 | __PACKAGE__ | |
| 43 | ->add_columns( | ||
| 44 | gender_id => { | ||
| 45 | data_type=>'integer', | ||
| 46 | }, | ||
| 47 | label => { | ||
| 48 | data_type=>'varchar', | ||
| 49 | size=>12, | ||
| 50 | }, | ||
| 51 | ); | ||
| 52 | |||
| 53 | |||
| 54 | =head2 primary_key | ||
| 55 | |||
| 56 | Sets the Primary keys for this table | ||
| 57 | |||
| 58 | =cut | ||
| 59 | |||
| 60 | 3 | __PACKAGE__ | |
| 61 | ->set_primary_key(qw/gender_id/); | ||
| 62 | |||
| 63 | |||
| 64 | =head2 | ||
| 65 | |||
| 66 | Marks the unique columns | ||
| 67 | |||
| 68 | =cut | ||
| 69 | |||
| 70 | 3 | __PACKAGE__ | |
| 71 | ->add_unique_constraint('gender_label_unique' => [ qw/label/ ]); | ||
| 72 | |||
| 73 | |||
| 74 | =head2 people | ||
| 75 | |||
| 76 | A resultset of people with this gender | ||
| 77 | |||
| 78 | =cut | ||
| 79 | |||
| 80 | 3 | __PACKAGE__ | |
| 81 | ->has_many( | ||
| 82 | people => 'DBIx::Class::Schema::PopulateMore::Test::Schema::Result::Person', | ||
| 83 | {'foreign.fk_gender_id' => 'self.gender_id'} | ||
| 84 | ); | ||
| 85 | |||
| 86 | |||
| 87 | =head1 METHODS | ||
| 88 | |||
| 89 | This module defines the following methods. | ||
| 90 | |||
| 91 | =head1 AUTHOR | ||
| 92 | |||
| 93 | Please see L<DBIx::Class::Schema::PopulateMore> For authorship information | ||
| 94 | |||
| 95 | =head1 LICENSE | ||
| 96 | |||
| 97 | Please see L<DBIx::Class::Schema::PopulateMore> For licensing terms. | ||
| 98 | |||
| 99 | =cut | ||
| 100 | |||
| 101 | |||
| 102 | 3 | 1; | |