超備忘録です。
DDLの発行なんて久しぶりすぎて忘れ杉&ドキドキ。
カラム名(とデータ型)を変更したい場合
ALTER TABLE テーブル名 CHANGE 古いカラム 新しいカラム 新しいデータ型;
- 例:
- alter table accounts change password crypted_password varchar(255);
カラムのデータ型を変更したい場合
ALTER TABLE テーブル名 MODIFY カラム名 新しいデータ型;
- 例:
- alter table accounts modify crypted_password varchar(255) not null;