Skip to content

Commit 0cd0112

Browse files
feat UnlockedLabs#233: Create new migrations to utilize EnrollmentState enum in db
1 parent 7a9352e commit 0cd0112

2 files changed

+58
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
3+
use App\Enums\EnrollmentState;
4+
use Illuminate\Database\Migrations\Migration;
5+
use Illuminate\Database\Schema\Blueprint;
6+
use Illuminate\Support\Facades\Schema;
7+
8+
return new class extends Migration
9+
{
10+
/**
11+
* Run the migrations.
12+
*/
13+
public function up(): void
14+
{
15+
Schema::table('enrollments', function (Blueprint $table) {
16+
$table->dropColumn('enrollment_state');
17+
});
18+
}
19+
20+
/**
21+
* Reverse the migrations.
22+
*/
23+
public function down(): void
24+
{
25+
Schema::table('enrollments', function (Blueprint $table) {
26+
$table->enum('enrollment_state', EnrollmentState::toArray());
27+
});
28+
}
29+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
3+
use App\Enums\EnrollmentState;
4+
use Illuminate\Database\Migrations\Migration;
5+
use Illuminate\Database\Schema\Blueprint;
6+
use Illuminate\Support\Facades\Schema;
7+
8+
return new class extends Migration
9+
{
10+
/**
11+
* Run the migrations.
12+
*/
13+
public function up(): void
14+
{
15+
Schema::table('enrollments', function (Blueprint $table) {
16+
$table->enum('enrollment_state', EnrollmentState::toArray());
17+
});
18+
}
19+
20+
/**
21+
* Reverse the migrations.
22+
*/
23+
public function down(): void
24+
{
25+
Schema::table('enrollments', function (Blueprint $table) {
26+
$table->dropColumn('enrollment_state');
27+
});
28+
}
29+
};

0 commit comments

Comments
 (0)