Differential D3361 Diff 9652 src/database/migrations/2022_02_04_100000_create_user_passwords_table.php
Changeset View
Changeset View
Standalone View
Standalone View
src/database/migrations/2022_02_04_100000_create_user_passwords_table.php
- This file was added.
<?php | |||||
use Illuminate\Support\Facades\Schema; | |||||
use Illuminate\Database\Schema\Blueprint; | |||||
use Illuminate\Database\Migrations\Migration; | |||||
// phpcs:ignore | |||||
class CreateUserPasswordsTable extends Migration | |||||
{ | |||||
/** | |||||
* Run the migrations. | |||||
* | |||||
* @return void | |||||
*/ | |||||
public function up() | |||||
{ | |||||
Schema::create( | |||||
'user_passwords', | |||||
function (Blueprint $table) { | |||||
$table->bigIncrements('id'); | |||||
$table->bigInteger('user_id'); | |||||
$table->string('password'); | |||||
$table->timestamp('created_at')->useCurrent(); | |||||
$table->index(['user_id', 'created_at']); | |||||
$table->foreign('user_id')->references('id')->on('users') | |||||
->onDelete('cascade')->onUpdate('cascade'); | |||||
} | |||||
); | |||||
} | |||||
/** | |||||
* Reverse the migrations. | |||||
* | |||||
* @return void | |||||
*/ | |||||
public function down() | |||||
{ | |||||
Schema::dropIfExists('user_passwords'); | |||||
} | |||||
} |