File: MyStarLinkMCPK.pm

package info (click to toggle)
libdbix-class-perl 0.082810-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 6,012 kB
  • ctags: 2,157
  • sloc: perl: 26,390; sql: 322; makefile: 10
file content (30 lines) | stat: -rw-r--r-- 587 bytes parent folder | download | duplicates (5)
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
package # hide from PAUSE
    MyStarLinkMCPK;

use warnings;
use strict;

use base 'MyBase';

use MyStar;
use MyFilm;

# This is a many-to-many mapping table that uses the two foreign keys
# as its own primary key - there's no extra 'auto-inc' column here

__PACKAGE__->set_table();
__PACKAGE__->columns(Primary => qw/film star/);
__PACKAGE__->columns(All     => qw/film star/);
__PACKAGE__->has_a(film => 'MyFilm');
__PACKAGE__->has_a(star => 'MyStar');

sub create_sql {
  return qq{
    film    INTEGER NOT NULL,
    star    INTEGER NOT NULL,
    PRIMARY KEY (film, star)
  };
}

1;