]> BookStack Code Mirror - bookstack/blob - database/migrations/2014_10_12_000000_create_users_table.php
Opensearch: Fixed XML declaration when php short tags enabled
[bookstack] / database / migrations / 2014_10_12_000000_create_users_table.php
1 <?php
2
3 use Carbon\Carbon;
4 use Illuminate\Database\Migrations\Migration;
5 use Illuminate\Database\Schema\Blueprint;
6 use Illuminate\Support\Facades\DB;
7 use Illuminate\Support\Facades\Schema;
8
9 return new class extends Migration
10 {
11     /**
12      * Run the migrations.
13      */
14     public function up(): void
15     {
16         Schema::create('users', function (Blueprint $table) {
17             $table->increments('id');
18             $table->string('name');
19             $table->string('email')->unique();
20             $table->string('password', 60);
21             $table->rememberToken();
22             $table->nullableTimestamps();
23         });
24
25         // Create the initial admin user
26         DB::table('users')->insert([
27             'name'       => 'Admin',
28             'email'      => '[email protected]',
29             'password'   => bcrypt('password'),
30             'created_at' => Carbon::now()->toDateTimeString(),
31             'updated_at' => Carbon::now()->toDateTimeString(),
32         ]);
33     }
34
35     /**
36      * Reverse the migrations.
37      */
38     public function down(): void
39     {
40         Schema::drop('users');
41     }
42 };