Revision history for Perl extension DBIx::DBSchema.
0.29 unreleased
+ - Column::sql_add_column fix when adding primary keys to Pg 7.2.x
- workaround for PAUSE parsing of DBIx::DBSchema::DBD::Pg version: move
DBD::Pg verison checking after $VERSION declaration, thanks Andreas!
#needs more work for old Pg
- my $nextval = "nextval('public.${table}_${column}_seq'::text)";
+ my $nextval;
+ if ( $dbh->{'pg_server_version'} > 70300 ) {
+ $nextval = "nextval('public.${table}_${column}_seq'::text)";
+ } else {
+ $nextval = "nextval('${table}_${column}_seq'::text)";
+ }
(
"ALTER TABLE $table ALTER COLUMN $column SET DEFAULT $nextval",
$real_null = $self->null;
$self->null('NULL');
- push @after_add, sub {
- my($table, $column) = @_;
- "ALTER TABLE $table ALTER $column SET NOT NULL";
- };
+ if ( $dbh->{'pg_server_version'} > 70300 ) {
+
+ push @after_add, sub {
+ my($table, $column) = @_;
+ "ALTER TABLE $table ALTER $column SET NOT NULL";
+ };
+
+ } else {
+
+ push @after_add, sub {
+ my($table, $column) = @_;
+ "UPDATE pg_attribute SET attnotnull = TRUE ".
+ " WHERE attname = '$column' ".
+ " AND attrelid = ( SELECT oid FROM pg_class WHERE relname = '$table' )";
+ };
+
+ }
}