ruby - MYSQL setting Foreign Key ERROR 1452 (23000) -
ruby - MYSQL setting Foreign Key ERROR 1452 (23000) -
i have users , rota table in mysql database , trying add together set foreign key called user_id in rota table. error after executing line of code in terminal:
alter table rota add together foreign key (user_id) references users(id);
and error is:
error 1452 (23000): cannot add together or update kid row: foreign key constraint fails (sharp2_development
.#sql-b19_ada
, constraint #sql-b19_ada_ibfk_1
foreign key (user_id
) references users
(id
))
i have user_id column in rota type int, no null, default no , no user table's id same apart beingness primary key , auto_increment.
mysql ruby database foreign-keys primary-key
Comments
Post a Comment