File: /home/xedaptot/be.naniguide.com/database/migrations/2026_04_24_120000_drop_legacy_plan_columns.php
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
/**
* Phase 4.4 — drop legacy plan columns after 4-concept migration.
*
* plans.options → replaced by plan_credits/plan_quotas/
* plan_entitlements/plan_rate_limits
* plans.type → polymorphism removed (flat Plan)
* plans.email_verification_credits → plan_credits with credit_key='verify_contact'
*
* See docs/payment-order-plan-subscription-saas/SUBSCRIPTION-COMPREHENSIVE-DESIGN.md §11.3.
*/
return new class extends Migration
{
public function up(): void
{
Schema::table('plans', function (Blueprint $table) {
if (Schema::hasColumn('plans', 'options')) {
$table->dropColumn('options');
}
if (Schema::hasColumn('plans', 'type')) {
$table->dropColumn('type');
}
if (Schema::hasColumn('plans', 'email_verification_credits')) {
$table->dropColumn('email_verification_credits');
}
});
}
public function down(): void
{
Schema::table('plans', function (Blueprint $table) {
$table->json('options')->nullable();
$table->string('type')->nullable();
$table->integer('email_verification_credits')->default(0);
});
}
};