added TODO test: call accessors when create()ing a row
[dbsrgits/DBIx-Class-Historic.git] / t / lib / DBICTest / Schema / Track.pm
CommitLineData
c6d74d3e 1package # hide from PAUSE
2 DBICTest::Schema::Track;
a02675cd 3
660cf1be 4use base qw/DBICTest::BaseResult/;
1ceafb0c 5__PACKAGE__->load_components(qw/InflateColumn::DateTime Ordered/);
a02675cd 6
ff657a43 7__PACKAGE__->table('track');
8__PACKAGE__->add_columns(
0009fa49 9 'trackid' => {
10 data_type => 'integer',
11 is_auto_increment => 1,
12 },
13 'cd' => {
14 data_type => 'integer',
15 },
16 'position' => {
17 data_type => 'integer',
91b0fbd7 18 accessor => 'pos',
0009fa49 19 },
20 'title' => {
21 data_type => 'varchar',
cb561d1a 22 size => 100,
0009fa49 23 },
43556c5d 24 last_updated_on => {
25 data_type => 'datetime',
26 accessor => 'updated_date',
27 is_nullable => 1
28 },
abc914bd 29 last_updated_at => {
30 data_type => 'datetime',
31 is_nullable => 1
32 },
b7ad9162 33 small_dt => { # for mssql and sybase DT tests
34 data_type => 'smalldatetime',
35 is_nullable => 1
36 },
27d619d8 37 increment => {
38 data_type => 'integer',
39 is_nullable => 1,
40 accessor => '_increment',
41 }
0009fa49 42);
ff657a43 43__PACKAGE__->set_primary_key('trackid');
44
365d06b7 45__PACKAGE__->add_unique_constraint([ qw/cd position/ ]);
46__PACKAGE__->add_unique_constraint([ qw/cd title/ ]);
47
1ceafb0c 48__PACKAGE__->position_column ('position');
49__PACKAGE__->grouping_column ('cd');
50
51
ff657a43 52__PACKAGE__->belongs_to( cd => 'DBICTest::Schema::CD' );
53__PACKAGE__->belongs_to( disc => 'DBICTest::Schema::CD' => 'cd');
a02675cd 54
a1cb5921 55__PACKAGE__->might_have( cd_single => 'DBICTest::Schema::CD', 'single_track' );
4f6386b0 56__PACKAGE__->might_have( lyrics => 'DBICTest::Schema::Lyrics', 'track_id' );
a1cb5921 57
27d619d8 58sub increment {
59 my $self = shift;
60 if(@_) {
61 return $self->_increment($_[0] + 1);
62 }
63 return $self->_increment();
64}
65
66sub set_increment {
67 my $self = shift;
68 if(@_) {
69 return $self->_increment($_[0]);
70 }
71 return $self->_increment();
72}
73
a02675cd 741;