Codeigniter 4 gives error "Cannot add foreign key constraint"
Started 2 years ago by M R Alam in Framework, CodeIgniter
I'm practicing Codeigniter 4 and I'm using migration to create table. For better understand below is my full error message
Body
Cannot add foreign key constraint
at SYSTEMPATH/Database/BaseConnection.php:646
Backtrace:
1 SYSTEMPATH/Database/Forge.php:546
CodeIgniter\Database\BaseConnection()->query('CREATE TABLE `divisions` (
`id` INT(7) UNSIGNED NOT NULL AUTO_INCREMENT,
`name` VARCHAR(128) NOT NULL,
`entity_id` INT NOT NULL,
CONSTRAINT `pk_divisions` PRIMARY KEY(`id`),
CONSTRAINT `divisions_entity_id_foreign` FOREIGN KEY (`entity_id`) REFERENCES `entities`(`id`)
) DEFAULT CHARACTER SET = utf8 COLLATE = utf8_general_ci')
-
No one is replied to this thread yet. Be first to reply!
Bottom ad position