Skip to content

Commit 427942a

Browse files
Missing migration
1 parent 6a2c6d8 commit 427942a

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
use Laravel\Fortify\Fortify;
7+
8+
return new class extends Migration
9+
{
10+
/**
11+
* Run the migrations.
12+
*/
13+
public function up(): void
14+
{
15+
Schema::table('users', function (Blueprint $table) {
16+
$table->text('two_factor_secret')
17+
->after('password')
18+
->nullable();
19+
20+
$table->text('two_factor_recovery_codes')
21+
->after('two_factor_secret')
22+
->nullable();
23+
24+
if (Fortify::confirmsTwoFactorAuthentication()) {
25+
$table->timestamp('two_factor_confirmed_at')
26+
->after('two_factor_recovery_codes')
27+
->nullable();
28+
}
29+
});
30+
}
31+
32+
/**
33+
* Reverse the migrations.
34+
*/
35+
public function down(): void
36+
{
37+
Schema::table('users', function (Blueprint $table) {
38+
$table->dropColumn(array_merge([
39+
'two_factor_secret',
40+
'two_factor_recovery_codes',
41+
], Fortify::confirmsTwoFactorAuthentication() ? [
42+
'two_factor_confirmed_at',
43+
] : []));
44+
});
45+
}
46+
};

0 commit comments

Comments
 (0)