# TYPE is a synonym, but ENGINE is the preferred option name.
#
- # We have to use the hash directly here since otherwise there is no way
- # to remove options.
- my $options = ( $table->{options} ||= []);
+ my $options = $table->options;
# If multiple option names, normalize to the first one
if (ref $opt_name) {
}
# Null?
- $field_def .= ' NOT NULL' unless $field->is_nullable;
+ if ( $field->is_nullable ) {
+ $field_def .= ' NULL';
+ }
+ else {
+ $field_def .= ' NOT NULL';
+ }
# Default?
SQL::Translator::Producer->_apply_default_value(
my $qc = $options->{quote_field_names} || '';
my $table_name = quote_table_name($c->table->name, $qt);
- my $out = sprintf('ALTER TABLE %s DROP %s %s',
- $table_name,
- $c->type eq FOREIGN_KEY ? $c->type : "INDEX",
- $qc . $c->name . $qc );
-
- return $out;
+ my @out = ('ALTER','TABLE',$table_name,'DROP');
+ if($c->type eq PRIMARY_KEY) {
+ push @out, $c->type;
+ }
+ else {
+ push @out, ($c->type eq FOREIGN_KEY ? $c->type : "INDEX"),
+ $qc . $c->name . $qc;
+ }
+ return join(' ',@out);
}
sub alter_create_constraint