Would it be possible to add an option to export table
structures as single alter table statements?
That's quite handy if you want to update a table
structure to the 'next version'.
No, I don't.
I'm not sure if alter table allows you to say alter column
if exists, add otherwise, but if it does, that'd be the
best way. Just generate one alter table statement per
column.
If it doesn't, you could simply first generate add column
and then alter column and ignore the failure of the add.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You can not say add if not exists. There is also no generic
way to ignore errors in SQL, so this won't work. I still
don't see other usable solution than diff.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
A diff requires both versions of the table structure to be
available and I don't think that's always the case.
A dump of alter statements is still handy if
you're 'manually' updating a table structure.
And I think the mysql 'console' client will simply give an
error but you can still paste all statements at once.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Logged In: YES
user_id=192186
You mean diff of two tables?
Logged In: YES
user_id=192186
See RFE#631976 for that. I don't see other way to find out
which fields to alter or add.
Logged In: YES
user_id=30264
No, I don't.
I'm not sure if alter table allows you to say alter column
if exists, add otherwise, but if it does, that'd be the
best way. Just generate one alter table statement per
column.
If it doesn't, you could simply first generate add column
and then alter column and ignore the failure of the add.
Logged In: YES
user_id=192186
You can not say add if not exists. There is also no generic
way to ignore errors in SQL, so this won't work. I still
don't see other usable solution than diff.
Logged In: YES
user_id=30264
A diff requires both versions of the table structure to be
available and I don't think that's always the case.
A dump of alter statements is still handy if
you're 'manually' updating a table structure.
And I think the mysql 'console' client will simply give an
error but you can still paste all statements at once.
Logged In: YES
user_id=192186
So you want ALTER TABLE blah CHANGE or ALTER TABLE blah ADD?
Logged In: YES
user_id=30264
Either give the choice between those to the user or simply
include both in the output (first add, then change).
I believe that this has been covered in the Tracking mechanism.