Sunday, April 25, 2010

MySQL - alter column

I needed to convert a column from varchar(25) to varchar(64). Found this somewhere on the page: MySQL 5.1 Docs

ALTER table table_name MODIFY somecolumn varchar(64) NOT NULL

The NOT NULL part needs to match what the column definition is today or else it will default back to NULL.