File: /var/www/api.ayokah.co.uk/database/migrations/2024_02_21_012122_create_sellers_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('sellers', function (Blueprint $table) {
$table->bigIncrements('id');
$table->foreignId('user_id')->constrained('users')->onDelete('cascade');
$table->foreignId('plan_id')->constrained('seller_plans')->onDelete('cascade')->nullable();
$table->foreignId('category_id')->constrained('categories')->onDelete('cascade');
$table->string('address', 255)->nullable();
$table->string('postcode')->nullable();
$table->string('city')->nullable();
$table->string('state')->nullable();
$table->string('country')->nullable();
$table->string('longitude')->nullable();
$table->string('latitude')->nullable();
$table->string('business_name', 255)->unique();
$table->string('slug', 255)->unique();
$table->text('description', 1000)->nullable(); // Text type, no need to specify length
$table->string('reg_no')->unique()->nullable();
$table->string('type');
$table->string('logo');
$table->string('logo_public_id');
$table->string('cover_image');
$table->string('cover_image_public_id');
$table->string('facebook', 255)->unique()->nullable(); // Nullable as in validation
$table->string('instagram', 255)->unique()->nullable(); // Nullable as in validation
$table->string('sort_code', 20)->nullable();
$table->string('account_no', 50)->unique()->nullable();
$table->string('account_name', 150)->nullable();
$table->string('bank_name')->nullable();
$table->enum('status', ['active', 'inactive'])->default('inactive');
$table->unsignedInteger('views')->default(0);
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('sellers');
}
};