siakad-itm/database/migrations/0001_01_01_000000_create_users_table.php
Yoga Pangestu 5cc8ba26b2
Some checks failed
tests / ci (pull_request) Has been cancelled
feat: update user registration to use username instead of name, add user profile model and migration, and implement gender enum
- Changed user creation to use 'username' instead of 'name'.
- Added UserProfile model with relationships to User and gender enum.
- Updated validation rules for username and email.
- Modified migrations to create user_profiles table and adjust users table.
- Updated seeder to create users with profiles.
- Translated various UI texts to Indonesian and improved layout components.
2026-08-03 13:43:30 +07:00

45 lines
1.4 KiB
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('users', function (Blueprint $table) {
$table->id();
$table->string('username', 20)->unique();
$table->string('email')->unique();
$table->string('password');
$table->boolean('is_active')->default(true);
$table->timestamp('last_login_at')->nullable();
$table->timestamps();
$table->softDeletes();
});
Schema::create('password_reset_tokens', function (Blueprint $table) {
$table->string('email')->primary();
$table->string('token');
$table->timestamp('created_at')->nullable();
});
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();
});
}
public function down(): void
{
Schema::dropIfExists('users');
Schema::dropIfExists('password_reset_tokens');
Schema::dropIfExists('sessions');
}
};