core icon indicating copy to clipboard operation
core copied to clipboard

rename attribute column without delete+new

Open zonky2 opened this issue 6 years ago • 1 comments

rename attribute column without delete old column (with all values!) and add a new column

with "delete+new" we lost different other things e.g. filter settings

zonky2 avatar Jan 24 '19 07:01 zonky2

We should keep an eye on this one if #1267 also fixes this.

discordier avatar Jan 28 '19 11:01 discordier

with new schema manager its the same

I change from Test to Test2

 * ALTER TABLE mm_test DROP Test
 * ALTER TABLE mm_test ADD Test2 VARCHAR(255) DEFAULT NULL

same at tables - this is how Doctrine works things out - but, you can copy the data between the two splats/tables between each query:

/usr/bin/php8.1 vendor/bin/contao-console doctrine:query:sql 'UPDATE mm_test SET col_neu=col_alt'

/usr/bin/php8.1 vendor/bin/contao-console doctrine:query:sql 'INSERT mm_test_neu SELECT * FROM mm_test_alt'

zonky2 avatar Jan 17 '23 19:01 zonky2