Horse
Horse

Reputation: 3063

Mysql foreign keys and allow null on existing field

So I am changing the scope on a database, and need to make a field which is a foreign key, allow null values.

I am doing this in phpmyadmin, but the query is below

ALTER TABLE `nuggets` CHANGE `n_st_id` `n_st_id` INT( 11 ) NULL DEFAULT NULL 

It tells me the query ran successfully, but its showing null as no, and default as 0. Its an innodb table, any ideas why its not letting me change it?

Upvotes: 2

Views: 1585

Answers (1)

Horse
Horse

Reputation: 3063

It was because it was indexed, I had to remove the indexes and then set it, then reset the indexes

Upvotes: 1

Related Questions