[DBIx-Class-Devel] [sql-translator] Don't create a superfluous index for FK that is PK (#56)
Marc Mims
notifications at github.com
Thu Jul 2 20:31:05 GMT 2015
> @@ -457,11 +457,17 @@ sub create_table
> #
> my @constraint_defs;
> my @constraints = $table->get_constraints;
> +
> + # Get the primary key, if there is one. No need to create an index for an
> + # FK that is also the PK. It may be a multi-field key, so generate a
> + # suitable string for comparison.
> + my $pk = join "\0", map $_->fields, grep $_->type eq PRIMARY_KEY, @constraints;
Indeed. Looks like the code in master doesn't handle multi-column foreign keys, either. I'll update the PR incorporating your suggestion and fix that.
---
Reply to this email directly or view it on GitHub:
https://github.com/dbsrgits/sql-translator/pull/56/files#r33819591
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.scsys.co.uk/pipermail/dbix-class-devel/attachments/20150702/e277baeb/attachment.htm>
More information about the DBIx-Class-Devel
mailing list