|
@@ -0,0 +1,33 @@
|
|
|
|
|
+<?php
|
|
|
|
|
+
|
|
|
|
|
+use Illuminate\Database\Migrations\Migration;
|
|
|
|
|
+use Illuminate\Database\Schema\Blueprint;
|
|
|
|
|
+use Illuminate\Support\Facades\Schema;
|
|
|
|
|
+use Illuminate\Support\Facades\Artisan;
|
|
|
|
|
+use App\Models\Student;
|
|
|
|
|
+
|
|
|
|
|
+return new class extends Migration
|
|
|
|
|
+{
|
|
|
|
|
+ /**
|
|
|
|
|
+ * Run the migrations.
|
|
|
|
|
+ */
|
|
|
|
|
+ public function up(): void
|
|
|
|
|
+ {
|
|
|
|
|
+ Schema::table('students', function (Blueprint $table) {
|
|
|
|
|
+ $table->string('status')->default(Student::STATUS_LEAD)->change();
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ // Atualiza os registros existentes rodando o comando criado
|
|
|
|
|
+ Artisan::call('students:update-status');
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * Reverse the migrations.
|
|
|
|
|
+ */
|
|
|
|
|
+ public function down(): void
|
|
|
|
|
+ {
|
|
|
|
|
+ Schema::table('students', function (Blueprint $table) {
|
|
|
|
|
+ $table->string('status')->default('active')->change();
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+};
|