http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=7065 Galen Charlton <gmcharlt@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |gmcharlt@gmail.com --- Comment #13 from Galen Charlton <gmcharlt@gmail.com> --- (In reply to comment #11)
Would this be safer as an updatedatabase approach:
alter table reserves add column reservenumber int(11) not null auto_increment primary key; set @ai=(select max(reservenumber) from reserves); alter table old_reserves add reservenumber int(11); insert into reserves select * from old_reserves; truncate old_reserves; insert into old_reserves select * from reserves where reservenumber > @ai; delete from reserves where reservenumber > @ai; alter table old_reserves add primary key reservenumber;
I suggest a variant of this approach so that old reserves have lower IDs than current ones. Note that this is *untested*: create table tmp_reserves as select * from reserves limit 0; alter table tmp_reserves add column reservenumber int(11) not null auto_increment primary key; insert into tmp_reserves select * from old_reserves order by reservedate; truncate old_reserves; alter table old_reserves add reservenumber int(11); insert into old_reserves select * from tmp_reserves); truncate tmp_reserves; insert into tmp_reserves select * from reserves order by reservedate; alter table reserves add reservenumber int(11) not null auto_increment primary_key; truncate reserves; insert into reserves select * from tmp_reserves); drop table tmp_reserves; -- You are receiving this mail because: You are the QA Contact for the bug. You are watching all bug changes.