Improvement on adding new fields

Acs's profile image Acs posted 3 years ago in General Permalink

Hey,

When adding a new field in HeidiSQL table editor the new field takes the default value from the previous field. So if I add a field and the previous was datatype INT the new one will be INT and have the default '0'. The problem is that if I then change to datatype TEXT the default does not get altered and MySQL throws an error when I try to save:

image description

Would it be possible to either clear the default (in this case) or set a default that can be used in the new field (which in this example will just be the default as empty).

NOTE: One thing I did notice is that if I change from Text type to a Integer type I do get the default change to 0, so I guess the code is already setup for setting defaults but not for removing them I guess.

Thanks

Code modification/commit 3e7ed86 from Ansgar Becker <anse@heidisql.com>, 3 years ago, revision 11.0.0.6114
Remove default text from column when changing data type to one that does not support a default text. See https://www.heidisql.com/forum.php?t=37142
ansgar's profile image ansgar posted 3 years ago Permalink

Yes, I already have such a mechanism in the code, but it wanted to make it less destructive. I just modified it again so it removes a non-supported default type/text. Please update to the next build (available in some minutes) and retry.

Acs's profile image Acs posted 3 years ago Permalink

Nice! Just updated to the latest version and the new code seems to do exactly what I wanted! Thanks for moving so quickly with this.

Please login to leave a reply, or register at first.