Apologies for the simple question but SQL isn't really my forte, and I want to be sure I don't shoot myself in the foot.
A MySQL database I volunteered to help maintain has a table that looks like this:
CREATE TABLE person_per (
[...]
per_EnteredBy smallint(5) unsigned NOT NULL default '0',
per_EditedBy smallint(5) unsigned default '0',
[...]
) TYPE=MyISAM;
This works fine, except that recently our user IDs started to be larger than 65535, which caused the values stored into the above fields to be incorrect (i.e. large values get capped at 65535 rather than the expected value).
What I'd like to do is 'widen' those two columns of the table so that user IDs greater than 65535 can be correctly stored in them. I think the commands to do it are:
ALTER TABLE person_per MODIFY per_EnteredBy MEDIUMINT unsigned NOT NULL default '0';
ALTER TABLE person_per MODIFY per_EditedBy MEDIUMINT unsigned default '0';
My questions are:
Are the ALTER TABLE commands above correct? (In particular I'm not sure if I should append a number-in-parenthesis to MEDIUMINT, and if so, what number it should be)
Will this alteration correctly preserve the data that is already stored in those two columns? I don't want to lose it.
Are there any obvious 'gotchas' that I might run into if I widen these columns? AFAICT SQL queries don't depend too much on integer columns being a particular width, but perhaps there is some non-obvious dependency that I should be aware of?