protagonist
Programmer
Now, in my database, I'm trying to include foreign keys. An example:
CREATE TABLE Person(PersonID INTEGER PRIMARY KEY AUTO_INCREMENT, FOREIGN KEY(Owner_OwnerID) REFERENCES Owner(OwnerID) ON DELETE CASCADE, Name VARCHAR(20), Job VARCHAR(20), DOB DATE, StartEmploymentDate DATE,EndEmploymentDate DATE, BiographicalInfo TEXT)
;
which works fine. Except that the foreign key column doesn't appear.
Now, according to the documentation it's because it needs to be an InnoDB, which can be done by putting ENGINE=InnoDB after the create table end bracket and before the semi-colon.
And now it refuses to work. I get
ERROR 1005: Can't create table './history_db/person.frm' (errno: 150)
eh?
CREATE TABLE Person(PersonID INTEGER PRIMARY KEY AUTO_INCREMENT, FOREIGN KEY(Owner_OwnerID) REFERENCES Owner(OwnerID) ON DELETE CASCADE, Name VARCHAR(20), Job VARCHAR(20), DOB DATE, StartEmploymentDate DATE,EndEmploymentDate DATE, BiographicalInfo TEXT)
;
which works fine. Except that the foreign key column doesn't appear.
Now, according to the documentation it's because it needs to be an InnoDB, which can be done by putting ENGINE=InnoDB after the create table end bracket and before the semi-colon.
And now it refuses to work. I get
ERROR 1005: Can't create table './history_db/person.frm' (errno: 150)
eh?