package Germinate::Schema; use strict; use base qw/DBIx::Class::Schema/; #__PACKAGE__->load_classes(qw/ Phenotypes Phenotype_data /); __PACKAGE__->load_classes(qw/ Phenotypes /); 1; package Germinate::Schema::Phenotypes; use strict; use base qw/DBIx::Class/; __PACKAGE__->load_components(qw/ PK::Auto Core /); __PACKAGE__->table('phenotypes'); __PACKAGE__->add_columns( qw/ phenotype_uid unit_id phenotype_name phenotype_short_name description datatype created_on updated_on / ); __PACKAGE__->set_primary_key('phenotype_uid'); # here needs work! #__PACKAGE__->has_many('phenotype_datas' => 'Germinate::Schema::Phenotype_data'); __PACKAGE__->add_unique_constraint(my_key => [ qw/ phenotype_short_name / ]); 1; package Library::Schema; use strict; use base qw/DBIx::Class::Schema/; __PACKAGE__->load_classes(qw/Artist Cd Track/); 1; package Library::Schema::Artist; use strict; use base qw/DBIx::Class/; __PACKAGE__->load_components(qw/PK::Auto Core/); __PACKAGE__->table('artist'); __PACKAGE__->add_columns(qw/ artistid name /); __PACKAGE__->set_primary_key('artistid'); __PACKAGE__->has_many('cds' => 'Library::Schema::Cd'); __PACKAGE__->add_unique_constraint( artist_name => [ qw/ name / ], ); 1; package Library::Schema::Cd; use strict; use base qw/DBIx::Class/; __PACKAGE__->load_components(qw/PK::Auto Core/); __PACKAGE__->table('cd'); __PACKAGE__->add_columns(qw/ cdid artist title/); __PACKAGE__->set_primary_key('cdid'); __PACKAGE__->belongs_to('artist' => 'Library::Schema::Artist'); __PACKAGE__->has_many('tracks' => 'Library::Schema::Track'); __PACKAGE__->add_unique_constraint( cd_title => [ qw/ title / ], ); 1; package Library::Schema::Track; use strict; use base qw/DBIx::Class/; __PACKAGE__->load_components(qw/PK::Auto Core/); __PACKAGE__->table('track'); __PACKAGE__->add_columns(qw/ trackid cd title/); __PACKAGE__->set_primary_key('trackid'); __PACKAGE__->belongs_to('cd' => 'Library::Schema::Cd'); __PACKAGE__->add_unique_constraint( track_title => [ qw/ title / ], ); 1;