Changeset View
Changeset View
Standalone View
Standalone View
src/database/migrations/2022_10_10_100000_signup_codes_user_id.php
- This file was added.
<?php | |||||
use Illuminate\Database\Migrations\Migration; | |||||
use Illuminate\Database\Schema\Blueprint; | |||||
use Illuminate\Support\Facades\DB; | |||||
use Illuminate\Support\Facades\Schema; | |||||
return new class extends Migration | |||||
{ | |||||
/** | |||||
* Run the migrations. | |||||
* | |||||
* @return void | |||||
*/ | |||||
public function up() | |||||
{ | |||||
Schema::table( | |||||
'signup_codes', | |||||
function (Blueprint $table) { | |||||
$table->string('verify_ip_address')->index()->nullable(); | |||||
$table->string('submit_ip_address')->index()->nullable(); | |||||
$table->bigInteger('user_id')->index()->nullable(); | |||||
$table->foreign('user_id')->references('id')->on('users') | |||||
->onUpdate('cascade')->onDelete('cascade'); | |||||
} | |||||
); | |||||
} | |||||
/** | |||||
* Reverse the migrations. | |||||
* | |||||
* @return void | |||||
*/ | |||||
public function down() | |||||
{ | |||||
Schema::table( | |||||
'signup_codes', | |||||
function (Blueprint $table) { | |||||
$table->dropColumn('user_id'); | |||||
$table->dropColumn('verify_ip_address'); | |||||
$table->dropColumn('submit_ip_address'); | |||||
} | |||||
); | |||||
} | |||||
}; |