1.44.0 - Fully work around MySQL 5.7's lack of the DROP CONSTRAINT statement
What's Changed
Fully work around MySQL 5.7's lack of the DROP CONSTRAINT statement in #575
The work done in #522 added the ability to drop foreign keys when using a MySQL 5.7 database by enabling Fluent to generate the necessary
DROP FOREIGN KEY
syntax to make up for the old version's lack of the more standard and more flexibleDROP CONSTRAINT
statement.However, this still required users to specify the complete and current foreign key constraint definition at the time of deletion so Fluent could work out the correct "normalized" constraint identifier. These changes make it possible to also drop a foreign key constraint by name, requiring only the knowledge that it is, in fact, a foreign key.
Users wishing to drop foreign key constraints by name when using MySQL 5.7 must use the new API provided. Users of other versions of MySQL and other databases may also use the new API, or continue to use the old one.
New APIs added in this release:
FluentKit.DatabaseSchema.DeleteConstraint.namedForeignKey(_:)
: Specify a constraint deletion operation using a name and the explicit indication that the constraint to drop is a foreign key.FluentKit.SchemaBuilder.deleteForeignKey(name:)
: Add a constraint deletion for a foreign key with the given name to a schema builder invocation. Identical todeleteConstraint(name:)
except on MySQL 5.7.Fixes #491, vapor/fluent#722. Supersedes #492, #522.
This patch was released by @gwynne.
Full Changelog: 1.43.2...1.44.0