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

(-)a/misc/devel/update_dbix_class_files.pl (-1 / +34 lines)
Lines 20-25 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 /;
24
25
25
use Getopt::Long;
26
use Getopt::Long;
Lines 91-96 $db_name //= $db_defaults{name}; Link Here
91
$db_user //= $db_defaults{user};
92
$db_user //= $db_defaults{user};
92
$db_passwd //= $db_defaults{passwd};
93
$db_passwd //= $db_defaults{passwd};
93
94
95
# This is being upstreamed, but for now lets make sure whatever version of DBIx::Class::Schema::Loader you are using, 
96
# we will catch MariaDB current_timestamp() and convert it to \"current_timestamp" correctly.
97
my $override = Sub::Override->new(
98
    'DBIx::Class::Schema::Loader::DBI::mysql::_extra_column_info',
99
    sub {
100
        no warnings 'uninitialized';
101
        my ( $self, $table, $col, $info, $dbi_info ) = @_;
102
        my %extra_info;
103
104
        if ( $dbi_info->{mysql_is_auto_increment} ) {
105
            $extra_info{is_auto_increment} = 1;
106
        }
107
        if ( $dbi_info->{mysql_type_name} =~ /\bunsigned\b/i ) {
108
            $extra_info{extra}{unsigned} = 1;
109
        }
110
        if ( $dbi_info->{mysql_values} ) {
111
            $extra_info{extra}{list} = $dbi_info->{mysql_values};
112
        }
113
        if (
114
            ( not blessed $dbi_info)    # isa $sth
115
            && lc( $dbi_info->{COLUMN_DEF} ) =~ m/^current_timestamp/
116
            && lc( $dbi_info->{mysql_type_name} ) eq 'timestamp'
117
          )
118
        {
119
120
            my $current_timestamp = 'current_timestamp';
121
            $extra_info{default_value} = \$current_timestamp;
122
        }
123
124
        return \%extra_info;
125
    }
126
);
127
94
if (! defined $db_name ) {
128
if (! defined $db_name ) {
95
    print "Error: \'db_name\' parameter is mandatory.\n";
129
    print "Error: \'db_name\' parameter is mandatory.\n";
96
    pod2usage(1);
130
    pod2usage(1);
97
- 

Return to bug 25040