mirror of
https://github.com/coollabsio/coolify.git
synced 2025-12-28 05:34:50 +00:00
fix: handle existing cloud_init_scripts table in migration
The migration file was renamed from 120000 to 120002 between v444 and v445, causing "duplicate table" errors for users upgrading from v444 who already have the cloud_init_scripts table created. This fix adds a table existence check before creation, making the migration idempotent and safe for both fresh installations and upgrades. Fixes the error: SQLSTATE[42P07]: Duplicate table: 7 ERROR: relation "cloud_init_scripts" already exists 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
9af4f734aa
commit
2335bfad8f
@ -11,6 +11,12 @@ return new class extends Migration
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
// Check if table already exists (handles upgrades from v444 where this migration
|
||||
// was named 2025_10_10_120000_create_cloud_init_scripts_table.php)
|
||||
if (Schema::hasTable('cloud_init_scripts')) {
|
||||
return;
|
||||
}
|
||||
|
||||
Schema::create('cloud_init_scripts', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('team_id')->constrained()->onDelete('cascade');
|
||||
|
||||
Loading…
Reference in New Issue
Block a user