In MySQL, if the sql_require_primary_key is turned on, no table can
exist without a primary key. Since the migration 0005 drops the primary
key field before model deletion, the table misses the primary key, hence
the migration will fail.
To prevent migration failure, we swap the primary key before dropping
the revisionpluginrevision_ptr field which is the actual primary key.
In case the migration need to be reverted, the opposite will happen and
we set the revisionpluginrevision_ptr as the primary key.
When selecting the new primary key, it doesn't really matter what we
set, since at the end of the migration we drop the whole table.
In MySQL, if the
sql_require_primary_key
is turned on, no table can exist without a primary key. Since the migration 0005 drops the primary key field before model deletion, the table misses the primary key, hence the migration will fail.To prevent migration failure, we swap the primary key before dropping the
revisionpluginrevision_ptr
field which is the actual primary key. In case the migration need to be reverted, the opposite will happen and we set therevisionpluginrevision_ptr
as the primary key.When selecting the new primary key, it doesn't really matter what we set, since at the end of the migration we drop the whole table.
Signed-off-by: Gabor Boros gabor.brs@gmail.com