File: /var/www/api.ayokah.co.uk/database/migrations/2024_04_19_150008_create_coupons_table.php
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('coupons', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('code');
$table->dateTime('expiry_date')->nullable();
$table->enum('discount_type', ['fixed', 'percentage', 'free_shipping'])->default('fixed');
$table->decimal('value', 10, 2)->nullable();
$table->enum('status', ['active', 'inactive'])->default('active');
$table->decimal('min_purchase_amount', 10, 2)->nullable();
$table->string('product_uuid');
$table->foreignId('seller_id')->constrained('sellers')->onDelete('cascade');
$table->foreignId('user_id')->constrained('users')->onDelete('cascade');
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('coupons');
}
};