]> git.mxchange.org Git - quix0rs-gnu-social.git/commit - lib/schema.php
Fix for schema upgrade issue when primary keys change; fixes upgrade direct from...
authorBrion Vibber <brion@pobox.com>
Thu, 8 Sep 2011 20:03:22 +0000 (13:03 -0700)
committerBrion Vibber <brion@pobox.com>
Thu, 8 Sep 2011 20:03:22 +0000 (13:03 -0700)
commit8454b1fbadc00fcf8c87d19bd7615a5be00fde09
treeeb46ed30e5d3aea3d67a1d0017ccc98c206d8cdd
parentf63b53c4952b5e4d6698ffdbb45f1f64c8174bf2
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.
lib/mysqlschema.php
lib/schema.php