@@ -, +, @@ --- Koha/Schema/Result/Accountline.pm | 3 +++ installer/dbic_controller.pl | 1 - misc/devel/update_dbix_class_files.pl | 28 +++++++++++++++++++++++++--- 3 files changed, 28 insertions(+), 4 deletions(-) mode change 100644 => 100755 Koha/Schema/Result/Accountline.pm --- a/Koha/Schema/Result/Accountline.pm +++ a/Koha/Schema/Result/Accountline.pm @@ -153,6 +153,9 @@ __PACKAGE__->add_columns( datetime_undef_if_invalid => 1, default_value => \"current_timestamp", is_nullable => 0, + extra => { + "on update" => \"current_timestamp", + }, }, "notify_id", { data_type => "integer", default_value => 0, is_nullable => 0 }, --- a/installer/dbic_controller.pl +++ a/installer/dbic_controller.pl @@ -5,7 +5,6 @@ use Data::Dumper; my $schema = Koha::Database->new()->schema(); - $schema->deploy({quote_identifiers => 1, producer_args => {mysql_version => '5.5.33'}, }); #my $statements = $schema->deployment_statements(undef,'2.0',undef,{quote_identifiers => 1, producer_args => {mysql_version => '5.5.33'},}); #print Dumper($statements); --- a/misc/devel/update_dbix_class_files.pl +++ a/misc/devel/update_dbix_class_files.pl @@ -24,6 +24,7 @@ use DBIx::Class::Schema::Loader qw/ make_schema_at /; use Getopt::Long; use Pod::Usage; +use Data::Dumper; my $path = "./"; my $db_driver = 'mysql'; @@ -53,11 +54,32 @@ if (! defined $db_name ) { pod2usage(1); } else { - make_schema_at( +my $test = make_schema_at( "Koha::Schema", - { debug => 1, dump_directory => $path, preserve_case => 1 }, + { debug => 1, dump_directory => $path, preserve_case => 1, + skip_load_external => 1, + custom_column_info => sub { + my ($table, $column_name, $column_info) = @_; + + if ($table eq 'accountlines' && $column_name eq 'timestamp'){ + return { extra => { "on update" => \"CURRENT_TIMESTAMP" } }; + } + }, + + + filter_generated_code => sub { + my ($type, $class, $text) = @_; + $text =~ s/(\\"current_timestamp"|\scurrent_timestamp\s)/\U$1\E/g; + $text =~ s/"double precision"/"double"/g; + return $text; + } + + + }, ["DBI:$db_driver:dbname=$db_name;host=$db_host;port=$db_port",$db_user, $db_passwd ] ); + + } 1; @@ -111,4 +133,4 @@ path into which create the schema files. (defaults to './') prints this help text -=back +=back --