Welcome Guest, Not a member yet? Register   Sign In
Add custom name for ForeignKeys. GitHub issue #6366
#1

When create foreign keys there is set pattern in Forge class how the key name will be generated. This ends up making problem for tables and fields with long names, below
Code:
[mysqli_sql_exception]
is thrown.

Code:
Specified key was too long; max key length is 767 bytes
Solution would be to add an options array at end in which constraint name can be defined and in code the update can be done if constraint name is defined then skip auto generation part for key name. below is where this change is recommended
Add options array at end of this function which excepts constraint name
CodeIgniter4/system/Database/Forge.php
Line 404 in 9204889

Skip default key name and used the constraint name passed in options array to addForeignKey method
CodeIgniter4/system/Database/Forge.php
Line 1057 in 9204889
Best Regards,
ST
Reply




Theme © iAndrew 2016 - Forum software by © MyBB