contao / contao-manager

Contao Manager
GNU Lesser General Public License v3.0
83 stars 33 forks source link

Schema Updates - renaming strategy columns #777

Closed olifrieda closed 11 months ago

olifrieda commented 11 months ago

Sometimes the column names changes. One of the main changes is camel case to snake case. The algorithm generates this:

ALTER TABLE tl_cron_job ADD lastRun DATETIME NOT NULL, DROP last_run

But in this case it didn't work for me and you may loose some data. It would be better to do it like this:

ALTER TABLE `tl_cron_job` CHANGE `last_run` `lastRun` DATETIME NOT NULL;
aschempp commented 11 months ago

a developer must write a migration (see https://docs.contao.org/dev/framework/migrations/) to work around this problem. We initially tried to implement an automatic renaming, but there is no possible way to auto-detect an actual rename.