[Bast-commits] r4682 - in trunk/DBIx-Class-Journal/lib/DBIx/Class:
. Schema/Journal/DB
nothingmuch at dev.catalyst.perl.org
nothingmuch at dev.catalyst.perl.org
Wed Jul 30 07:09:03 BST 2008
Author: nothingmuch
Date: 2008-07-30 07:09:01 +0100 (Wed, 30 Jul 2008)
New Revision: 4682
Modified:
trunk/DBIx-Class-Journal/lib/DBIx/Class/Journal.pm
trunk/DBIx-Class-Journal/lib/DBIx/Class/Schema/Journal/DB/AuditHistory.pm
trunk/DBIx-Class-Journal/lib/DBIx/Class/Schema/Journal/DB/AuditLog.pm
Log:
more cleanup
Modified: trunk/DBIx-Class-Journal/lib/DBIx/Class/Journal.pm
===================================================================
--- trunk/DBIx-Class-Journal/lib/DBIx/Class/Journal.pm 2008-07-30 05:04:21 UTC (rev 4681)
+++ trunk/DBIx-Class-Journal/lib/DBIx/Class/Journal.pm 2008-07-30 06:09:01 UTC (rev 4682)
@@ -72,8 +72,9 @@
my $obj = $self->result_source->resultset->find( $self->ident_condition );
$ah->create({
- $obj->get_columns
- });
+ $obj->get_columns,
+ change => { changeset_id => $ah->result_source->schema->current_changeset },
+ });
}
$self->next::method($upd, @rest);
@@ -135,10 +136,10 @@
A ChangeSet has_many Changes.
-=item Change
+=item ChangeLog
Each change/operation done in the transaction is recorded as a row in
-the Change table. It contains an auto-incrementing ID, the
+the ChangeLog table. It contains an auto-incrementing ID, the
changeset_id and an order column for the ordering of each change in
the changeset.
@@ -155,7 +156,7 @@
For every table in the original database to be audited, an
AuditHistory table is created. Each row has a change_id field
-containing the ID of the Change row. The other fields correspond to
+containing the ID of the ChangeLog row. The other fields correspond to
all the fields from the original table. Each time a column value in
the original table is changed, the entire row contents before the
change are added as a new row in this table.
Modified: trunk/DBIx-Class-Journal/lib/DBIx/Class/Schema/Journal/DB/AuditHistory.pm
===================================================================
--- trunk/DBIx-Class-Journal/lib/DBIx/Class/Schema/Journal/DB/AuditHistory.pm 2008-07-30 05:04:21 UTC (rev 4681)
+++ trunk/DBIx-Class-Journal/lib/DBIx/Class/Schema/Journal/DB/AuditHistory.pm 2008-07-30 06:09:01 UTC (rev 4682)
@@ -7,15 +7,23 @@
$class->load_components(qw(Core));
- $class->table($source->name . "_audit_log");
+ $class->table($source->name . "_audit_history");
- $class->add_column( audit_change_id => {
- data_type => 'integer',
- is_nullable => 0,
- is_primary_key => 1,
- });
+ $class->add_columns(
+ audit_history_id => {
+ data_type => 'integer',
+ is_nullable => 0,
+ is_primary_key => 1,
+ is_auto_increment => 1,
+ },
+ audit_change_id => {
+ data_type => 'integer',
+ is_nullable => 0,
+ is_foreign_key => 1,
+ },
+ );
- $class->set_primary_key("audit_change_id");
+ $class->set_primary_key("audit_history_id");
foreach my $column ( $source->columns ) {
my $info = $source->column_info($column);
@@ -37,18 +45,4 @@
$class->belongs_to('change', 'DBIx::Class::Schema::Journal::DB::ChangeLog', 'audit_change_id');
}
-sub new
-{
- my ($self, $data, @rest) = @_;
- my $source = $data->{-result_source};
-
- $data->{change} = {
-# ID => \'DEFAULT',
- changeset_id => $source->schema->current_changeset,
- %{$data->{change}||{}},
- };
-
- $self->next::method($data, @rest);
-}
-
1;
Modified: trunk/DBIx-Class-Journal/lib/DBIx/Class/Schema/Journal/DB/AuditLog.pm
===================================================================
--- trunk/DBIx-Class-Journal/lib/DBIx/Class/Schema/Journal/DB/AuditLog.pm 2008-07-30 05:04:21 UTC (rev 4681)
+++ trunk/DBIx-Class-Journal/lib/DBIx/Class/Schema/Journal/DB/AuditLog.pm 2008-07-30 06:09:01 UTC (rev 4682)
@@ -7,7 +7,7 @@
$class->load_components(qw(Core));
- $class->table($source->name . "_audit_history");
+ $class->table($source->name . "_audit_log");
$class->add_columns(
create_id => {
More information about the Bast-commits
mailing list