I never changed the order of columns in a table, but reading the manual, I see (hidden quite well in a huge amount of text):
You can also use FIRST and AFTER in CHANGE or MODIFY operations to reorder columns within a table.
So why don’t you try
ALTER TABLE tbl_name MODIFY [COLUMN] col_name column_definition [FIRST | AFTER col_name]
and see what happens.
Be aware that:
When you use CHANGE or MODIFY, column_definition must include the data type and all attributes that should apply to the new column, other than index attributes such as PRIMARY KEY or UNIQUE. Attributes present in the original definition but not specified for the new definition are not carried forward.
Be aware that:
When you use CHANGE or MODIFY, column_definition must include the data type and all attributes that should apply to the new column, other than index attributes such as PRIMARY KEY or UNIQUE. Attributes present in the original definition but not specified for the new definition are not carried forward.
What “Attributes” would those be? :-/
Here is my table layout…
id
email
activation_code
salt
hash
temp_password
temp_reset_on
first_name
I would like to move first_name BEFORE email
Can we make a practice example so I can get a better idea of what you mean?
I am bolding the parts where I am confused…
ALTER TABLE member MODIFY [COLUMN] first_name column_definition AFTER id