Compare and contrast:
-- schema A
CREATE TABLE products (
id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
vendor_id INT UNSIGNED REFERENCES vendors (id),
name VARCHAR(255),
UNIQUE ( name ),
INDEX ( vendor_id )
) TYPE = InnoDB;
-- schema B
CREATE TABLE products (
id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
vendor_id INT UNSIGNED,
name VARCHAR(255),
UNIQUE ( name ),
INDEX ( vendor_id ),
FOREIGN KEY ( vendor_id ) REFERENCES vendors ( id )
) TYPE = InnoDB;
Schema B sets up the meta-data that Rose::DB::Object::Loader uses to figure out the relationships between tables automatically. Schema A does not.
Six.... fardling... hours.... wasted.
Many thanks to John Siracusa for pointing me to the solution.
You can almost see the bit of code that needs to be refactored.
FK Constraints (Score:2)
Yeah, I've already seen the annoying bit about inline FK references being parsed and discarded. Further, I was pretty sure it was silently discarded, so I ran your query:
Re: (Score:1)
I have seen enough just on these blogs that I would have to agree.
Re: (Score:1)
Re: (Score:2)
Our version of MySQL is old enough that strict mode is not available. I guess that makes my post a wee bit unfair :)
Re: (Score:1)
Quoth Aaron Crane on hates-software:
old MySQL? (Score:1)