Appearance
Migrations
Migrations are automatically generated based on the module schema.
php
<?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
{
Schema::create('plans', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->decimal('price');
$table->enum('interval', ['Monthly', 'Yearly'])->nullable();
$table->string('stripe_price_id');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('plans');
}
};
The mirations contain the fields defined on the module.
The timestamps and id
are automatically added to the table.
If there are any relevant validators defined or if the field is required, the constraints will be added to the migrations.