資料同步 換表會錯的問題 20250612

This commit is contained in:
allen.yan 2025-06-12 15:37:14 +08:00
parent 751c65bccf
commit 6a93b717e7

View File

@ -79,9 +79,8 @@ class TransferSqliteTableJob implements ShouldQueue
DB::connection($mysqlConnection)->table("_{$table}")->insert($buffer); DB::connection($mysqlConnection)->table("_{$table}")->insert($buffer);
} }
DB::statement("RENAME TABLE {$table} TO {$table}_"); DB::statement("DROP TABLE IF EXISTS {$table};");
DB::statement("RENAME TABLE _{$table} TO {$table}"); DB::statement("RENAME TABLE _{$table} TO {$table};");
DB::statement("DROP TABLE IF EXISTS {$table}_");
logger()->info("✅ Imported: {$table} ({$count} records)"); logger()->info("✅ Imported: {$table} ({$count} records)");
} catch (\Exception $e) { } catch (\Exception $e) {