Files
Kent-logistics-Laravel/database/migrations/0001_01_01_000000_create_users_table.php

66 lines
2.0 KiB
PHP
Raw Normal View History

2025-11-04 10:19:07 +05:30
<?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
{
2025-11-07 12:08:34 +05:30
// USERS TABLE
2025-11-04 10:19:07 +05:30
Schema::create('users', function (Blueprint $table) {
2025-11-07 12:08:34 +05:30
$table->id(); // Auto-increment primary key
// Custom customer ID like CID-2025-000001
$table->string('customer_id')->unique();
// Customer details
$table->string('customer_name');
$table->string('company_name');
$table->string('designation')->nullable();
2025-11-04 10:19:07 +05:30
$table->string('email')->unique();
2025-11-07 12:08:34 +05:30
$table->string('mobile_no');
$table->string('address')->nullable();
$table->string('pincode')->nullable();
$table->date('date')->nullable();
// Authentication fields
2025-11-04 10:19:07 +05:30
$table->timestamp('email_verified_at')->nullable();
2025-11-07 12:08:34 +05:30
$table->string('password')->nullable();
2025-11-04 10:19:07 +05:30
$table->rememberToken();
$table->timestamps();
});
2025-11-07 12:08:34 +05:30
// PASSWORD RESETS TABLE
2025-11-04 10:19:07 +05:30
Schema::create('password_reset_tokens', function (Blueprint $table) {
$table->string('email')->primary();
$table->string('token');
$table->timestamp('created_at')->nullable();
});
2025-11-07 12:08:34 +05:30
// SESSIONS TABLE
2025-11-04 10:19:07 +05:30
Schema::create('sessions', function (Blueprint $table) {
$table->string('id')->primary();
$table->foreignId('user_id')->nullable()->index();
$table->string('ip_address', 45)->nullable();
$table->text('user_agent')->nullable();
$table->longText('payload');
$table->integer('last_activity')->index();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('sessions');
2025-11-07 12:08:34 +05:30
Schema::dropIfExists('password_reset_tokens');
Schema::dropIfExists('users');
2025-11-04 10:19:07 +05:30
}
};