Skip Menu |

This queue is for tickets about the DBIx-Class-Journal CPAN distribution.

Report information
The Basics
Id: 56920
Status: resolved
Priority: 0/
Queue: DBIx-Class-Journal

People
Owner: Nobody in particular
Requestors: OLIVER [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.900001_03
Fixed in: (no value)



Subject: Minor fixes for _03 (on Pg 8.1)
Hi, I have been testing the _03 dev release on a database here runing in PostgreSQL 8.1 and needed to make some minor changes to your schema files and also to the code in one or two parts. You are advised to check this patch - I have changed a use of gmtime to localtime and you will know more about the side effects of this than me. I hope this patch helps, and thanks for a great module :-) regards, oliver.
Subject: 03_fixes_gorwits_01.diff
diff -urN DBIx-Class-Journal-0.900001_03.orig/lib/DBIx/Class/Journal.pm DBIx-Class-Journal-0.900001_03.new/lib/DBIx/Class/Journal.pm --- DBIx-Class-Journal-0.900001_03.orig/lib/DBIx/Class/Journal.pm 2010-02-18 16:34:02.000000000 +0000 +++ DBIx-Class-Journal-0.900001_03.new/lib/DBIx/Class/Journal.pm 2010-04-25 23:55:29.000000000 +0100 @@ -71,7 +71,7 @@ my $change = $j->journal_create_change; my $prev = $self->result_source->resultset->find( $self->ident_condition ); - $j->journal_record_in_history( $prev, audit_change_id => $change ); + $j->journal_record_in_history( $prev, audit_change_id => $change->id ); } } diff -urN DBIx-Class-Journal-0.900001_03.orig/lib/DBIx/Class/Schema/Journal/DB/ChangeLog.pm DBIx-Class-Journal-0.900001_03.new/lib/DBIx/Class/Schema/Journal/DB/ChangeLog.pm --- DBIx-Class-Journal-0.900001_03.orig/lib/DBIx/Class/Schema/Journal/DB/ChangeLog.pm 2010-01-27 09:00:08.000000000 +0000 +++ DBIx-Class-Journal-0.900001_03.new/lib/DBIx/Class/Schema/Journal/DB/ChangeLog.pm 2010-04-25 23:55:54.000000000 +0100 @@ -6,11 +6,12 @@ __PACKAGE__->table('changelog'); __PACKAGE__->add_columns( - ID => { + id => { data_type => 'integer', is_auto_increment => 1, is_primary_key => 1, is_nullable => 0, + sequence => "changelog_id_seq", }, changeset_id => { data_type => 'integer', @@ -24,7 +25,7 @@ ); -__PACKAGE__->set_primary_key('ID'); +__PACKAGE__->set_primary_key('id'); __PACKAGE__->add_unique_constraint('setorder', [ qw/changeset_id order_in/ ]); __PACKAGE__->belongs_to('changeset', 'DBIx::Class::Schema::Journal::DB::ChangeSet', 'changeset_id'); diff -urN DBIx-Class-Journal-0.900001_03.orig/lib/DBIx/Class/Schema/Journal/DB/ChangeSet.pm DBIx-Class-Journal-0.900001_03.new/lib/DBIx/Class/Schema/Journal/DB/ChangeSet.pm --- DBIx-Class-Journal-0.900001_03.orig/lib/DBIx/Class/Schema/Journal/DB/ChangeSet.pm 2010-01-27 09:00:08.000000000 +0000 +++ DBIx-Class-Journal-0.900001_03.new/lib/DBIx/Class/Schema/Journal/DB/ChangeSet.pm 2010-04-25 23:55:54.000000000 +0100 @@ -6,11 +6,12 @@ __PACKAGE__->table('changeset'); __PACKAGE__->add_columns( - ID => { + id => { data_type => 'integer', is_auto_increment => 1, is_primary_key => 1, is_nullable => 0, + sequence => "changeset_id_seq", }, user_id => { data_type => 'integer', @@ -36,10 +37,10 @@ # import?) to do it and retain backcompat I will. # # --fREW, 01-27-2010 - $self->set_date(gmtime); + $self->set_date(scalar localtime); return $self; } -__PACKAGE__->set_primary_key('ID'); +__PACKAGE__->set_primary_key('id'); 1; diff -urN DBIx-Class-Journal-0.900001_03.orig/lib/DBIx/Class/Schema/Journal/DB.pm DBIx-Class-Journal-0.900001_03.new/lib/DBIx/Class/Schema/Journal/DB.pm --- DBIx-Class-Journal-0.900001_03.orig/lib/DBIx/Class/Schema/Journal/DB.pm 2010-02-18 16:29:05.000000000 +0000 +++ DBIx-Class-Journal-0.900001_03.new/lib/DBIx/Class/Schema/Journal/DB.pm 2010-04-25 23:55:54.000000000 +0100 @@ -38,7 +38,7 @@ sub journal_create_changeset { my ( $self, @args ) = @_; - my %changesetdata = ( @args, ID => undef ); + my %changesetdata = ( @args ); delete $changesetdata{parent_id} unless $self->nested_changesets;
Just some more notes as I find things... The create_id column of *_audit_log should not have the 'not null' constraint - I believe either that or the delete_id are set, so one or the other will always be null? It seems when a row is deleted, an entry appears in *_audit_log with a delete_id but the row data is not stored into *_audit_history. Seeing as the *_audit_history table contains the previous state of rows before change, the version on deletion isn't in there and so is lost. It should probably be added with the change ID from delete_id. regards, oliver.
Ok, this is (mostly) fixed in the most recent commit. ID's are not renamed, please turn on quoting in Pg instead.