
Originally Posted by
Michael Morris
In my scheme parentid is always a foreign key to a row on the parent table of the current table. It's an abstraction for the PHP table creation system.
For example, a table called companies has a child table employees. The parent id of the employees table refers here to the row holding the specific company.
Now in a non-abstract system the field would be companyid most likely.
Tables can have multiple parents. The parent tables for addresses are companies and persons. Hence a "parent" column indicates which table holds the row in the unusual event that I need to join one (or both) of those tables back to the addresses table (because of the structure of the program it's almost always going to be the other way around).
Anyway, thanks for your help - I'll remove the indexing call on primary keys but I need my code to index the parent and parentid fields when they get created (When the user declares that the table has one or more parents)
This particular error was frustrating because I've done this a long while now, and yet this rather simple error caught me off guard and cost me a day of work.
Bookmarks