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