Nate Nate - 2 months ago 20
MySQL Question

How do I alter table VARCHAR mysql Ruby on Rails?

I used the code below to change VARCHAR from (20) to (40) but no change happened in my table:

mysql> ALTER TABLE create_user modify email VARCHAR(40);

Query OK, 0 rows affected (0.02 sec)

Records: 0 Duplicates: 0 Warnings: 0

Answer Source

But i use your code can accomplish.

mysql> desc create_user;

+-------+-------------+------+-----+---------+-------+

| Field | Type | Null | Key | Default | Extra |

+-------+-------------+------+-----+---------+-------+

| email | varchar(40) | YES | | NULL | |

+-------+-------------+------+-----+---------+-------+

1 row in set (0.00 sec)

mysql> Alter table create_user modify email varchar(20);

Query OK, 0 rows affected (0.04 sec)

Records: 0 Duplicates: 0 Warnings: 0

mysql> desc create_user;

+-------+-------------+------+-----+---------+-------+

| Field | Type | Null | Key | Default | Extra |

+-------+-------------+------+-----+---------+-------+

| email | varchar(20) | YES | | NULL | |

+-------+-------------+------+-----+---------+-------+

1 row in set (0.00 sec)