File: Foo.pm

package info (click to toggle)
libbio-chado-schema-perl 0.10010-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 1,800 kB
  • sloc: perl: 15,043; makefile: 7; sql: 3
file content (48 lines) | stat: -rw-r--r-- 1,032 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package Bio::Chado::Schema::Result::MyPlugin::Foo;
use strict;
use warnings;

use base 'DBIx::Class::Core';

__PACKAGE__->table("myapp_foo");

__PACKAGE__->add_columns(

  "myapp_foo_id",
  {
    data_type         => "integer",
    is_auto_increment => 1,
    is_nullable       => 0,
    sequence          => "myapp_foo_myapp_foo_id_seq",
  },

  "organism_id",
  { data_type => "integer", is_foreign_key => 1, is_nullable => 0 },

);
__PACKAGE__->set_primary_key( "myapp_foo_id" );

__PACKAGE__->belongs_to(
  "organism",
  "Bio::Chado::Schema::Result::Organism::Organism",
  { organism_id => "organism_id" },
  {
    cascade_copy   => 0,
    cascade_delete => 0,
    is_deferrable  => 1,
    on_delete      => "CASCADE",
    on_update      => "CASCADE",
  },
);

Bio::Chado::Schema->plugin_add_relationship(
    'Organism::Organism' => 'has_many',
    "myplugin_foos",
    "Bio::Chado::Schema::Result::MyPlugin::Foo",
    { "foreign.organism_id" => "self.organism_id" },
    { cascade_copy => 0, cascade_delete => 0 },
  );


1;