Migrating Varchar to Text in Mysql Migrating Varchar to Text in Mysql mysql mysql

Migrating Varchar to Text in Mysql


ALTER TABLE table_name MODIFY column_name TEXT NOT NULL;


There is no a big problem to change varchar to text because text supports more data length than varchar, but if the field has a index it must be drop and create new index with prefix col_name(length) (see CREATE INDEX syntax).

According to your data content maybe would be a good idea use fulltext indexes but that implies change your search expressions on that field.

If you are in production environment, the table will be locked meanwhile the migration is in progress to prevent data loss.