Quantcast
Channel: openSUSE Forums
Viewing all articles
Browse latest Browse all 40713

cannot ALTER TABLE (add forign key) #1005 - Can't create...#sql-12db_9f' (errno: 150)

$
0
0
I've 2 tables users (id is primary key) and user_content (id2 is primary) both of them smallint (6) and I wanna make foreign key so everything from user_content links to particular user (id i.e.) so I tried this

PHP Code:

ALTER TABLE `user_content`
ADD CONSTRAINT `FK_id`
FOREIGN KEY (`id2`) REFERENCES `users(id)`
ON UPDATE CASCADE
ON DELETE CASCADE 


but I ge this error

PHP Code:

 #1005 - Can't create table 'skusobna.#sql-12db_9f' (errno: 150) 

(both tables exists)

Viewing all articles
Browse latest Browse all 40713

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>