Alter Column Statements


DbWrench will try to script column changes using an ALTER TABLE... ALTER COLUMN... statement. However database servers have limitations on their support for this statement. If DbWrench can not use this statement to implement a column definition change it will generally resort to rebuilding the entire table.

MySQL Limitations

Generally MySQL has good support for ALTER(CHANGE) COLUMN statements, however errors may occur if the altered column is involved in a foreign key.

Consult MySQL documentation for more details.

PostgreSQL Limitations

PostgreSQL supports ALTER COLUMN only if the column's default value or the column's nullability has changed. All other changes will result in a rebuild of the table.

Consult PostgreSQL documentation for more details.

Microsoft SQL Server Limitations

SQL Server will support almost all column changes except changing the column's default value. However ALTER COLUMN will not work on columns used in primary keys, indexes, foreign keys and some othe restrictions. Also SQL Server versions before and including 6.5 may not support ALTER COLUMN at all.

Consult SQL Server documentation for more details.


See also:

Forward Engineering Trouble Shooting
DBMS Limitations
Reverse Engineering
Managing Connections