select @id :=max(id)+1 from plugins;
update plugins set id = @id where id = 0;
select @id :=max(id)+1 from upgrades;
update upgrades set id = @id where id = 0;
alter table active_sessions change `id` `id` int (11)  NOT NULL AUTO_INCREMENT;
alter table archive_restoration_request change `id` `id` int (11)  NOT NULL AUTO_INCREMENT;
alter table archiving_settings change `id` `id` int (11)  NOT NULL AUTO_INCREMENT;
alter table archiving_type_lookup change `id` `id` int (11)  NOT NULL AUTO_INCREMENT;
alter table authentication_sources change `id` `id` int (11)  NOT NULL AUTO_INCREMENT;
alter table column_entries change `id` `id` int (11)  NOT NULL AUTO_INCREMENT;
alter table dashlet_disables change `id` `id` int (11)  NOT NULL AUTO_INCREMENT;
alter table data_types change `id` `id` int (11)  NOT NULL AUTO_INCREMENT;
alter table discussion_comments change `id` `id` int (11)  NOT NULL AUTO_INCREMENT;
alter table discussion_threads change `id` `id` int (11)  NOT NULL AUTO_INCREMENT;
alter table document_archiving_link change `id` `id` int (11)  NOT NULL AUTO_INCREMENT;
alter table document_content_version change `id` `id` int (11)  NOT NULL AUTO_INCREMENT;
alter table document_fields change `id` `id` int (11)  NOT NULL AUTO_INCREMENT;
alter table document_fields_link change `id` `id` int (11)  NOT NULL AUTO_INCREMENT;
alter table document_incomplete change `id` `id` int (11)  NOT NULL AUTO_INCREMENT;
alter table document_link change `id` `id` int (11)  NOT NULL AUTO_INCREMENT;
alter table document_link_types change `id` `id` int (11)  NOT NULL AUTO_INCREMENT;
alter table document_metadata_version change `id` `id` int (11)  NOT NULL AUTO_INCREMENT;
alter table document_role_allocations change `id` `id` int (11)  NOT NULL AUTO_INCREMENT;
alter table document_subscriptions change `id` `id` int (11)  NOT NULL AUTO_INCREMENT;
alter table document_transaction_types_lookup change `id` `id` int (11)  NOT NULL AUTO_INCREMENT;
alter table document_transactions change `id` `id` int (11)  NOT NULL AUTO_INCREMENT;
alter table document_type_fields_link change `id` `id` int (11)  NOT NULL AUTO_INCREMENT;
alter table document_type_fieldsets_link change `id` `id` int (11)  NOT NULL AUTO_INCREMENT;
alter table document_types_lookup change `id` `id` int (11)  NOT NULL AUTO_INCREMENT;
alter table documents change `id` `id` int (11)  NOT NULL AUTO_INCREMENT;
alter table field_behaviours change `id` `id` int (11)  NOT NULL AUTO_INCREMENT;
alter table field_value_instances change `id` `id` int (11)  NOT NULL AUTO_INCREMENT;
alter table fieldsets change `id` `id` int (11)  NOT NULL AUTO_INCREMENT;
alter table folder_doctypes_link change `id` `id` int (11)  NOT NULL AUTO_INCREMENT;
alter table folder_subscriptions change `id` `id` int (11)  NOT NULL AUTO_INCREMENT;
alter table folder_transactions change `id` `id` int (11)  NOT NULL AUTO_INCREMENT;
alter table folders change `id` `id` int (11)  NOT NULL AUTO_INCREMENT;
alter table folders_users_roles_link change `id` `id` int (11)  NOT NULL AUTO_INCREMENT;
alter table groups_groups_link change `id` `id` int (11)  NOT NULL AUTO_INCREMENT;
alter table groups_lookup change `id` `id` int (11)  NOT NULL AUTO_INCREMENT;
alter table help change `id` `id` int (11)  NOT NULL AUTO_INCREMENT;
alter table help_replacement change `id` `id` int (11)  NOT NULL AUTO_INCREMENT;
alter table interceptor_instances change `id` `id` int (11)  NOT NULL AUTO_INCREMENT;
alter table links change `id` `id` int (11)  NOT NULL AUTO_INCREMENT;
alter table metadata_lookup change `id` `id` int (11)  NOT NULL AUTO_INCREMENT;
alter table metadata_lookup_tree change `id` `id` int (11)  NOT NULL AUTO_INCREMENT;
alter table mime_extractors change `id` `id` mediumint(9)  NOT NULL AUTO_INCREMENT;
alter table mime_documents change `id` `id` int (11)  NOT NULL AUTO_INCREMENT;
alter table mime_types change `id` `id` int (11)  NOT NULL AUTO_INCREMENT;
alter table news change `id` `id` int (11)  NOT NULL AUTO_INCREMENT;
alter table notifications change `id` `id` int (11)  NOT NULL AUTO_INCREMENT;
alter table organisations_lookup change `id` `id` int (11)  NOT NULL AUTO_INCREMENT;
alter table permission_assignments change `id` `id` int (11)  NOT NULL AUTO_INCREMENT;
alter table permission_descriptors change `id` `id` int (11)  NOT NULL AUTO_INCREMENT;
alter table permission_dynamic_conditions change `id` `id` int (11)  NOT NULL AUTO_INCREMENT;
alter table permission_lookup_assignments change `id` `id` int (11)  NOT NULL AUTO_INCREMENT;
alter table permission_lookups change `id` `id` int (11)  NOT NULL AUTO_INCREMENT;
alter table permission_objects change `id` `id` int (11)  NOT NULL AUTO_INCREMENT;
alter table permissions change `id` `id` int (11)  NOT NULL AUTO_INCREMENT;
alter table plugin_helper change `id` `id` int (11)  NOT NULL AUTO_INCREMENT;
alter table plugin_rss change `id` `id` int (11)  NOT NULL AUTO_INCREMENT;
alter table plugins change `id` `id` int (11)  NOT NULL AUTO_INCREMENT;
alter table role_allocations change `id` `id` int (11)  NOT NULL AUTO_INCREMENT;
alter table roles change `id` `id` int (11)  NOT NULL AUTO_INCREMENT;
alter table saved_searches change `id` `id` int (11)  NOT NULL AUTO_INCREMENT;
alter table scheduler_tasks change `id` `id` int (11)  NOT NULL AUTO_INCREMENT;
alter table search_saved change `id` `id` int (11)  NOT NULL AUTO_INCREMENT;
alter table status_lookup change `id` `id` int (11)  NOT NULL AUTO_INCREMENT;
alter table system_settings change `id` `id` int (11)  NOT NULL AUTO_INCREMENT;
alter table tag_words change `id` `id` int (11)  NOT NULL AUTO_INCREMENT;
alter table time_period change `id` `id` int (11)  NOT NULL AUTO_INCREMENT;
alter table time_unit_lookup change `id` `id` int (11)  NOT NULL AUTO_INCREMENT;
alter table units_lookup change `id` `id` int (11)  NOT NULL AUTO_INCREMENT;
alter table units_organisations_link change `id` `id` int (11)  NOT NULL AUTO_INCREMENT;
alter table upgrades change `id` `id` int (11)  NOT NULL AUTO_INCREMENT;
alter table user_history change `id` `id` int (11)  NOT NULL AUTO_INCREMENT;
alter table users change `id` `id` int (11)  NOT NULL AUTO_INCREMENT;
alter table users_groups_link change `id` `id` int (11)  NOT NULL AUTO_INCREMENT;
alter table workflow_state_permission_assignments change `id` `id` int (11)  NOT NULL AUTO_INCREMENT;
alter table workflow_states change `id` `id` int (11)  NOT NULL AUTO_INCREMENT;
alter table workflow_transitions change `id` `id` int (11)  NOT NULL AUTO_INCREMENT;
alter table workflow_trigger_instances change `id` `id` int (11)  NOT NULL AUTO_INCREMENT;
alter table workflows change `id` `id` int (11)  NOT NULL AUTO_INCREMENT;
