Fix for schema upgrade issue when primary keys change; fixes upgrade direct from 0.8.x
Previously we were failing to update the primary key during ensureTable(), which could lead to failures when updating some tables (eg queue_item where we changed keys, and the addition of an autoincrement column failed because it conflicted with the old key). Now if the key is different, we remove the old key at the start and add the new key at the end of the ALTER TABLE. Not tested on PostgreSQL -- someone please check whether the alter table 'DROP CONSTRAINT PRIMARY KEY' bit works or if it needs to pull a special name for the key. On MySQL, dropping uses alter table's 'DROP PRIMARY KEY' special case.
Showing with 31 additions and 0 deletions