1
luciorota
FOREIGN KEY
  • 2018/12/3 15:54

  • luciorota

  • Module Developer

  • Posts: 216

  • Since: 2007/4/20


Hi everybody
How can I set FOREIGN KEY on module tables when I use Xoops modules installation procedure?
Thanks
Lucio

2
geekwright
Re: FOREIGN KEY

Since the SqlUtility class doesn't recognize the table name in the REFERENCES clause, you will have to add the constraint outside of the module's mysql.sql file.

I would suggest generating and running the SQL to perform an "ALTER TABLE ... ADD FOREIGN KEY ..." inside the onInstall file's xoops_module_install_dirname() function.

Longer term, this should become a non-issue as we progress toward schema definitions rather than SQL for table creation.

Login

Who's Online

208 user(s) are online (126 user(s) are browsing Support Forums)


Members: 0


Guests: 208


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Mar 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits