1package BookDB::Schema::Result::User; 2 3use strict; 4use warnings; 5 6use base 'DBIx::Class'; 7 8__PACKAGE__->load_components("InflateColumn::DateTime", "Core"); 9__PACKAGE__->table("user"); 10__PACKAGE__->add_columns( 11 "user_id", 12 { data_type => "INTEGER", is_nullable => 0, size => 8 }, 13 "user_name", 14 { data_type => "VARCHAR", is_nullable => 0, size => 32 }, 15 "fav_cat", 16 { data_type => "VARCHAR", is_nullable => 0, size => 32 }, 17 "fav_book", 18 { data_type => "VARCHAR", is_nullable => 0, size => 32 }, 19 "occupation", 20 { data_type => "VARCHAR", is_nullable => 0, size => 32 }, 21 "country_iso", 22 { data_type => "character", default_value => undef, is_nullable => 1, size => 2, }, 23 "birthdate", 24 { data_type => "DATETIME", is_nullable => 0 }, 25 "opt_in", 26 { data_type => "INTEGER", size => 1 }, 27 "license_id", 28 { data_type => "INTEGER", is_nullable => 0, size => 8 }, 29); 30__PACKAGE__->set_primary_key("user_id"); 31 32#__PACKAGE__->has_many( 33# "books", 34# "BookDB::Schema::Result::Book", 35# { "foreign.author_id" => "self.id" }, 36#); 37 38__PACKAGE__->has_many( 39 "user_employers", 40 "BookDB::Schema::Result::UserEmployer", 41 { 'foreign.user_id' => 'self.user_id' } 42); 43 44__PACKAGE__->many_to_many( 45 "employers" => "user_employers", 46 "employer", 47); 48 49 50__PACKAGE__->has_many( 51 "addresses", 52 "BookDB::Schema::Result::Address", 53 { 'foreign.user_id' => 'self.user_id' } 54); 55 56__PACKAGE__->belongs_to( 57 'country', 58 'BookDB::Schema::Result::Country', 59 { iso => 'country_iso' }, 60); 61__PACKAGE__->belongs_to('license' => 'BookDB::Schema::Result::License', 62 { 'foreign.license_id' => 'self.license_id' } ); 63__PACKAGE__->has_one('options' => 'BookDB::Schema::Result::Options', 64 { 'foreign.user_id' => 'self.user_id' } ); 65 661; 67