API error on schema reference field creation


#1
CDbCommand failed to execute the SQL statement: SQLSTATE[HY000]: General error: 1005 Can't create table 'heroku_19f65022db4964d.#sql-20ff_61cea9d' (errno: 150)

On a table, I’m trying to create a column which is a reference to another table. So I choose Type: reference, then choose the reference from the Reference Field and Reference Table. I get the above error when I then click update.

If I then try to click update again, I get the error:

CDbCommand failed to execute the SQL statement: SQLSTATE[42S21]: Column already exists: 1060 Duplicate column name 'department'.

And I find that it has created an integer field (no reference). What’s going on here?