-- 备份数据
CREATE TABLE dz_book_codebatch_backup LIKE dz_book_codebatch;
INSERT INTO dz_book_codebatch_backup SELECT * FROM dz_book_codebatch;
-- 创建新表
CREATE TABLE dz_book_codebatch_new LIKE dz_book_codebatch;
-- 设置自增初始值
ALTER TABLE dz_book_codebatch_new AUTO_INCREMENT = 1;
-- 插入数据并重新分配ID
INSERT INTO dz_book_codebatch_new (name, remark, count, book_ids, status, created_by, updated_by, created_at, updated_at, deleted_at, shop_id)
SELECT name, remark, count, book_ids, status, created_by, updated_by, created_at, updated_at, deleted_at, shop_id
FROM dz_book_codebatch;
-- 删除原表
DROP TABLE dz_book_codebatch;
-- 重命名新表
ALTER TABLE dz_book_codebatch_new RENAME TO dz_book_codebatch;