View | Details | Raw Unified | Return to bug 25040
Collapse All | Expand All

(-)a/misc/devel/update_dbix_class_files.pl (-1 / +35 lines)
Lines 20-26 Link Here
20
20
21
use Modern::Perl;
21
use Modern::Perl;
22
22
23
use Sub::Override;
23
use DBIx::Class::Schema::Loader qw/ make_schema_at /;
24
use DBIx::Class::Schema::Loader qw/ make_schema_at /;
25
require DBIx::Class::Schema::Loader::DBI::mysql;
26
27
# This is being upstreamed, but for now lets make sure whatever version of DBIx::Class::Schema::Loader you are using, 
28
# we will catch MariaDB current_timestamp() and convert it to \"current_timestamp" correctly.
29
Sub::Override->new(
30
    'DBIx::Class::Schema::Loader::DBI::mysql::_extra_column_info',
31
    sub {
32
        no warnings 'uninitialized';
33
        my ( $self, $table, $col, $info, $dbi_info ) = @_;
34
        my %extra_info;
35
36
        if ( $dbi_info->{mysql_is_auto_increment} ) {
37
            $extra_info{is_auto_increment} = 1;
38
        }
39
        if ( $dbi_info->{mysql_type_name} =~ /\bunsigned\b/i ) {
40
            $extra_info{extra}{unsigned} = 1;
41
        }
42
        if ( $dbi_info->{mysql_values} ) {
43
            $extra_info{extra}{list} = $dbi_info->{mysql_values};
44
        }
45
        if (
46
            ( not blessed $dbi_info)    # isa $sth
47
            && lc( $dbi_info->{COLUMN_DEF} ) =~ m/^current_timestamp/
48
            && lc( $dbi_info->{mysql_type_name} ) eq 'timestamp'
49
          )
50
        {
51
52
            my $current_timestamp = 'current_timestamp';
53
            $extra_info{default_value} = \$current_timestamp;
54
        }
55
56
        return \%extra_info;
57
    }
58
);
24
59
25
use Getopt::Long;
60
use Getopt::Long;
26
use Pod::Usage;
61
use Pod::Usage;
27
- 

Return to bug 25040