3 package Koha
::Schema
::Loader
::mysql
;
5 # Copyright 2020 PTFS Europe
7 # This file is part of Koha.
9 # Koha is free software; you can redistribute it and/or modify it
10 # under the terms of the GNU General Public License as published by
11 # the Free Software Foundation; either version 3 of the License, or
12 # (at your option) any later version.
14 # Koha is distributed in the hope that it will be useful, but
15 # WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with Koha; if not, see <http://www.gnu.org/licenses>.
24 use base
'DBIx::Class::Schema::Loader::DBI::mysql';
27 use Scalar
::Util
'blessed';
29 # This is being upstreamed, but for now lets make sure whatever version of DBIx::Class::Schema::Loader you are using,
30 # we will catch MariaDB current_timestamp() and convert it to \"current_timestamp" correctly.
31 sub _extra_column_info
{
32 no warnings
'uninitialized';
33 my ( $self, $table, $col, $info, $dbi_info ) = @_;
36 if ( $dbi_info->{mysql_is_auto_increment
} ) {
37 $extra_info{is_auto_increment
} = 1;
39 if ( $dbi_info->{mysql_type_name
} =~ /\bunsigned\b/i ) {
40 $extra_info{extra
}{unsigned
} = 1;
42 if ( $dbi_info->{mysql_values
} ) {
43 $extra_info{extra
}{list
} = $dbi_info->{mysql_values
};
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'
52 my $current_timestamp = 'current_timestamp';
53 $extra_info{default_value
} = \
$current_timestamp;