- #this should be a callback into the driver
- if ( $driver eq 'mysql' ) { #yucky mysql hack
- $null ||= "NOT NULL";
- $self->local('AUTO_INCREMENT') if uc($self->type) eq 'SERIAL';
- } elsif ( $driver =~ /^(?:Pg|SQLite)$/ ) { #yucky Pg/SQLite hack
- $null ||= "NOT NULL";
- $null =~ s/^NULL$//;
- }
+ ##
+ # callback into the database-specific driver
+ ##
+
+ my $dbd = "DBIx::DBSchema::DBD::$driver";
+ my $hashref = $dbd->column_callback( $dbh, $self->table_name, $self );
+
+ $self->default($orig_default);
+
+ $type = $hashref->{'effective_type'}
+ if $hashref->{'effective_type'};
+
+ my $null = $self->null;
+
+ #we seem to do this for mysql/Pg/SQLite, i think this should be the default
+ #add something to $hashref if drivers need to overrdide?
+ $null ||= "NOT NULL";
+
+ $null =~ s/^NULL$// unless $hashref->{'explicit_null'};
+
+ $default = $hashref->{'effective_default'}
+ if $hashref->{'effective_default'};
+
+ my $local = $self->local;
+ $local = $hashref->{'effective_local'}
+ if $hashref->{'effective_local'};