I'm using MySQL: Server version: 8.0.36 Homebrew
I'm trying to remove the default value of a column (currently set to 0), and it's erroring:
ALTER TABLE comments ALTER COLUMN commentable_id integer DROP DEFAULT;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'integer DROP DEFAULT' at line 1
The above is the syntax i've seen everywhere according to a google search. I also tried this which i saw on the O'Reilly site: (note no 'COLUMN')
ALTER TABLE comments ALTER commentable_id integer DROP DEFAULT;
but that didn't work either.
If I set a default of null, then it worked:
ALTER TABLE comments MODIFY COLUMN commentable_id integer DEFAULT null;
and that is effectively the same, since my database's "default default" is null anyway. But, i'd still like to know why the first command didn't work. Is it a change in V8 perhaps?