Revision history for DBIx-Class-Fixtures
1.001016
-- Support more Pg types for datetime_relative (added TIME, DATE, INTERVAL,
- TIMESTAMP)
-- experimental support for PG SERIAL columns and sequences.
+- Support more Postgresql types for datetime_relative (added TIME, DATE,
+ INTERVAL, TIMESTAMP)
+- If $result_source->column_info defines a sequence, make sure we properly
+ set that sequence to whatever the max value currently is.
1.001015
- ::External::File makes the path if its missing
}
}
$rs->populate(\@rows) if scalar(@rows);
+
+ ## Now we need to do some db specific cleanup
+ ## this probably belongs in a more isolated space. Right now this is
+ ## to just handle postgresql SERIAL types that use Sequences
+
+ my $table = $rs->result_source->name;
+ for my $column(my @columns = $rs->result_source->columns) {
+ my $info = $rs->result_source->column_info($column);
+ if(my $sequence = $info->{sequence}) {
+ $self->msg("- updating sequence $sequence");
+ $rs->result_source->storage->dbh_do(sub {
+ my ($storage, $dbh, @cols) = @_;
+ $self->msg(my $sql = "SELECT setval('${sequence}', (SELECT max($column) FROM ${table}));");
+ my $sth = $dbh->prepare($sql);
+ my $rv = $sth->execute or die $sth->errstr;
+ $self->msg("- $sql");
+ });
+ }
+ }
+
}
});
});
$self->do_post_ddl( {
- schema=>$schema,
+ schema=>$schema,
post_ddl=>$params->{post_ddl}
} ) if $params->{post_ddl};