Skip to content

Fix .references field constraint

Pre-release
Pre-release

Choose a tag to compare

@tanner0101 tanner0101 released this 29 Jul 01:44
7901123
This patch was authored and released by @tanner0101.

Adds a fix for a MySQL syntax quirk that caused .references constraints to be ignored (#191, fixes #170).

MySQL does not allow the REFERENCES foreign_table (column_name) syntax like Fluent's other drivers do. When it sees this syntax, it simply ignores it with no warning. The only supported method for declaring for keys is to declare them as "table level" constraints. In other words, as a separate item in the create list.

This change causes MySQL's SQLSchemaConverter to automatically translate field-level foreign key constraints (.references) to their table-level counterparts.