If you are using L<DBIx::Class::Schema/deploy> methods either directly
or via L<DBIx::Class::DeploymentHandler> or L<DBIx::Migration>, you
-will need the following L<SQL::Translator> hook to remove the index
-from C<parent_column>.
+will need the following L<SQL::Translator> hook to remove the constraint
+from C<parent_column>, otherwise you will not be able to user 0 (zero) as
+a value.
sub sqlt_deploy_hook {
my ($self, $sqlt_table) = @_;
- foreach my $index ($sqlt_table->get_indices) {
- if ($index->fields->[0] eq $self->parent_column) {
- $sqlt_table->drop_index($index->name);
+ foreach my $constraint ($sqlt_table->get_constraints) {
+ if ($constraint->field_names->[0] eq $self->parent_column) {
+ $sqlt_table->drop_constraint($constraint->name);
last;
}
}