Re: ERROR 1005 (HY000): Can't create table
When using Ndb it is always a good habit to also do "SHOW WARNINGS" when a sql statement fails.
mysql> CREATE TABLE policy_statements ( id VARCHAR(255) NOT NULL, `policyId` VARCHAR(255), `condition` TEXT, verb VARCHAR(10), `resourceType` VARCHAR(64), `compartmentId`
VARCHAR(255), `compartmentRefType` ENUM('ID','NAME'), `allowAnyGroup` BOOL DEFAULT '0', PRIMARY KEY (id), FOREIGN KEY(`policyId`) REFERENCES policies (id) ON DELETE CASCADE, FOREIGN KEY(`compartmentId`) REFERENCES compartments (id) ON DELETE SET NULL, CHECK (`allowAnyGroup` IN (0, 1)) ) engine=ndbcluster;
ERROR 1215 (HY000): Cannot add foreign key constraint
mysql> show warnings;
+---------+------+---------------------------------------------------------------------------------------------------------------------------------+
| Level | Code | Message |
+---------+------+---------------------------------------------------------------------------------------------------------------------------------+
| Warning | 1296 | Got error 21034 'Create foreign key failed - child table has Blob or Text column and on-delete-cascade is not allowed' from NDB |
| Error | 1215 | Cannot add foreign key constraint |
+---------+------+---------------------------------------------------------------------------------------------------------------------------------+
2 rows in set (0.00 sec)