LaravelTest
49 строк · 1.4 Кб
1<?php
2
3use Illuminate\Database\Migrations\Migration;
4use Illuminate\Database\Schema\Blueprint;
5use Illuminate\Support\Facades\Schema;
6
7return new class extends Migration
8{
9/**
10* Run the migrations.
11*/
12public function up(): void
13{
14Schema::create('users', function (Blueprint $table) {
15$table->id();
16$table->string('name');
17$table->string('email')->unique();
18$table->timestamp('email_verified_at')->nullable();
19$table->string('password');
20$table->rememberToken();
21$table->timestamps();
22});
23
24Schema::create('password_reset_tokens', function (Blueprint $table) {
25$table->string('email')->primary();
26$table->string('token');
27$table->timestamp('created_at')->nullable();
28});
29
30Schema::create('sessions', function (Blueprint $table) {
31$table->string('id')->primary();
32$table->foreignId('user_id')->nullable()->index();
33$table->string('ip_address', 45)->nullable();
34$table->text('user_agent')->nullable();
35$table->longText('payload');
36$table->integer('last_activity')->index();
37});
38}
39
40/**
41* Reverse the migrations.
42*/
43public function down(): void
44{
45Schema::dropIfExists('users');
46Schema::dropIfExists('password_reset_tokens');
47Schema::dropIfExists('sessions');
48}
49};