Fix silent failures on autoinc PK without an is_auto_increment attribute
[dbsrgits/DBIx-Class.git] / t / cdbi / testlib / Film.pm
1 package # hide from PAUSE
2     Film;
3
4 use warnings;
5 use strict;
6
7 use base 'DBIC::Test::SQLite';
8
9 __PACKAGE__->set_table('Movies');
10 __PACKAGE__->columns('Primary',   'Title');
11 __PACKAGE__->columns('Essential', qw( Title ));
12 __PACKAGE__->columns('Directors', qw( Director CoDirector ));
13 __PACKAGE__->columns('Other',     qw( Rating NumExplodingSheep HasVomit ));
14
15 # Disables the implicit autoinc-on-non-supplied-pk behavior
16 # (and the warning that goes with it)
17 # This is the same behavior as it was pre 0.082900
18 __PACKAGE__->column_info('title')->{is_auto_increment} = 0;
19
20 sub create_sql {
21   return qq{
22     title                   VARCHAR(255),
23     director                VARCHAR(80),
24     codirector              VARCHAR(80),
25     rating                  CHAR(5),
26     numexplodingsheep       INTEGER,
27     hasvomit                CHAR(1)
28   }
29 }
30
31 sub create_test_film {
32   return shift->create({
33     Title             => 'Bad Taste',
34     Director          => 'Peter Jackson',
35     Rating            => 'R',
36     NumExplodingSheep => 1,
37   });
38 }
39
40 package DeletingFilm;
41
42 use base 'Film';
43 sub DESTROY { shift->delete }
44
45 1;
46