sql >> Database >  >> RDS >> Mysql

Mysql:ERROR 1005 (HY000):Kan tabel 'receitascakephp.recipes' niet maken (errno:150)

Beide tabellen moeten InnoDB zijn:

CREATE TABLE `users` (
`id` INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
`name` VARCHAR(255) NOT NULL,
    `username` VARCHAR(75) NOT NULL,
    `password` VARCHAR(75) NOT NULL,
    `image` VARCHAR(255)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE `recipes` (
    `id` INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
    `name` VARCHAR(255) NOT NULL,
    `method` TEXT NOT NULL,
    `image` VARCHAR(255),
    `user_id` INT NOT NULL,
    CONSTRAINT `fk_recipes_users` FOREIGN KEY(`user_id`) REFERENCES `users`(`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;



  1. Oracle ODP.Net en EF CodeFirst - SaveChanges-fout

  2. EF Core 2.0 Identity - Navigatie-eigenschappen toevoegen

  3. Sqlite3 - NULL-waarden importeren uit csv

  4. Verbinding maken met MySQL-databases