浏览代码

fix: drop unnecessary pricing columns from proposals tables migration

alvesantos 2 周之前
父节点
当前提交
31520e7ac7
共有 1 个文件被更改,包括 64 次插入0 次删除
  1. 64 0
      database/migrations/2026_08_28_155017_drop_pricing_columns_from_proposals_tables.php

+ 64 - 0
database/migrations/2026_08_28_155017_drop_pricing_columns_from_proposals_tables.php

@@ -0,0 +1,64 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     */
+    public function up(): void
+    {
+        $tables = [
+            'pavao_proposals',
+            'irrecusable_proposals',
+            'pavao_proposal_units',
+            'irrecusable_proposal_units',
+        ];
+
+        foreach ($tables as $table) {
+            Schema::table($table, function (Blueprint $table) {
+                $table->dropColumn([
+                    'registration_included_in_course',
+                    'registration_installments_allowed',
+                    'registration_max_installments',
+                    'classes_included_in_course',
+                    'classes_installments_allowed',
+                    'classes_max_installments',
+                    'materials_included_in_course',
+                    'materials_installments_allowed',
+                    'materials_max_installments',
+                ]);
+            });
+        }
+    }
+
+    /**
+     * Reverse the migrations.
+     */
+    public function down(): void
+    {
+        $tables = [
+            'pavao_proposals',
+            'irrecusable_proposals',
+            'pavao_proposal_units',
+            'irrecusable_proposal_units',
+        ];
+
+        foreach ($tables as $tableName) {
+            Schema::table($tableName, function (Blueprint $table) {
+                $table->boolean('registration_included_in_course')->default(false);
+                $table->boolean('registration_installments_allowed')->default(false);
+                $table->unsignedSmallInteger('registration_max_installments')->default(13);
+                $table->boolean('classes_included_in_course')->default(false);
+                $table->boolean('classes_installments_allowed')->default(false);
+                $table->unsignedSmallInteger('classes_max_installments')->default(13);
+                $table->boolean('materials_included_in_course')->default(false);
+                $table->boolean('materials_installments_allowed')->default(false);
+                $table->unsignedSmallInteger('materials_max_installments')->default(13);
+            });
+        }
+    }
+};