Skip to content

Commit

Permalink
Fix migrations for SQLite
Browse files Browse the repository at this point in the history
"SQLite doesn't support multiple calls to dropColumn / renameColumn in a single modification."
  • Loading branch information
adevade committed Nov 25, 2024
1 parent 1883f84 commit 7899839
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,13 @@ public function up(): void
{
Schema::table($this->prefix.'staff', function (Blueprint $table) {
$table->renameColumn('firstname', 'first_name');
$table->renameColumn('lastname', 'last_name');
});
}

public function down(): void
{
Schema::table($this->prefix.'staff', function (Blueprint $table) {
$table->renameColumn('first_name', 'firstname');
$table->renameColumn('last_name', 'lastname');
});
}
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Lunar\Base\Migration;

return new class extends Migration
{
public function up(): void
{
Schema::table($this->prefix.'staff', function (Blueprint $table) {
$table->renameColumn('lastname', 'last_name');
});
}

public function down(): void
{
Schema::table($this->prefix.'staff', function (Blueprint $table) {
$table->renameColumn('last_name', 'lastname');
});
}
};

0 comments on commit 7899839

Please sign in to comment.