Fix silent failures on autoinc PK without an is_auto_increment attribute
[dbsrgits/DBIx-Class.git] / t / cdbi / testlib / ImplicitInflate.pm
CommitLineData
2040ad73 1package # Hide from PAUSE
2 ImplicitInflate;
3
4# Test class for the testing of Implicit inflation
5# in CDBI Classes using Compat layer
6# See t/cdbi/70-implicit_inflate.t
7
8use strict;
9use warnings;
10
11use base 'DBIC::Test::SQLite';
12
13__PACKAGE__->set_table('Date');
14
15__PACKAGE__->columns( Primary => 'id' );
16__PACKAGE__->columns( All => qw/ update_datetime text/);
17
18__PACKAGE__->has_a(
19 update_datetime => 'MyDateStamp',
20);
21
7305f6f9 22
23# Disables the implicit autoinc-on-non-supplied-pk behavior
24# (and the warning that goes with it)
25# This is the same behavior as it was pre 0.082900
26__PACKAGE__->column_info('id')->{is_auto_increment} = 0;
27
2040ad73 28sub create_sql {
29 # SQLite doesn't support Datetime datatypes.
30 return qq{
31 id INTEGER PRIMARY KEY,
32 update_datetime TEXT,
33 text VARCHAR(20)
34 }
35}
36
37{
38 package MyDateStamp;
39
40 use DateTime::Format::SQLite;
41
42 sub new {
43 my ($self, $value) = @_;
44 return DateTime::Format::SQLite->parse_datetime($value);
45 }
46}
47
481;