* Fix odd invocation of Test::More::pass() in t/36-filters.t (RT#64728)
* Quote everything in SQL Server
* Turn off constraints before dropping tables in SQL Server
+* Make true unique constraints if needed in SQL Server
# ----------------------------------------------------------
# 0.11007 2010-11-30
}
elsif ( $type eq UNIQUE ) {
$name = $name_ur || mk_name( $table_name . '_uc' );
- $c_def =
- "CONSTRAINT $name UNIQUE " .
- '(' . join( ', ', @fields ) . ')';
+ my @nullable = grep { $_->is_nullable } $constraint->fields;
+ if (!@nullable) {
+ $c_def =
+ "CONSTRAINT $name UNIQUE " .
+ '(' . join( ', ', @fields ) . ')';
+ } else {
+ push @index_defs,
+ "CREATE UNIQUE NONCLUSTERED INDEX $name_ur ON $table_name_ur (" .
+ join( ', ', @fields ) . ')' .
+ ' WHERE ' . join( ' AND ', map unreserve($_->name) . ' IS NOT NULL', @nullable ) . ';';
+ next;
+ }
}
push @constraint_defs, $c_def;
}