fix: migrations and model so they fit the schema
This commit is contained in:
parent
b31fc46a1f
commit
4fe830228e
|
@ -17,9 +17,10 @@ class User extends Authenticatable
|
||||||
* @var array<int, string>
|
* @var array<int, string>
|
||||||
*/
|
*/
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
|
'last_name',
|
||||||
'name',
|
'name',
|
||||||
|
'middle_name',
|
||||||
'email',
|
'email',
|
||||||
'password',
|
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -12,17 +12,25 @@ return new class extends Migration
|
||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::create('users', function (Blueprint $table) {
|
Schema::create('users', function (Blueprint $table) {
|
||||||
$table->id();
|
$table->id()->type('uuid');
|
||||||
|
$table->string('last_name');
|
||||||
$table->string('name');
|
$table->string('name');
|
||||||
|
$table->string('middle_name');
|
||||||
$table->string('email')->unique();
|
$table->string('email')->unique();
|
||||||
$table->timestamp('email_verified_at')->nullable();
|
$table->timestamp('email_verified_at')->nullable();
|
||||||
$table->string('password');
|
|
||||||
$table->rememberToken();
|
$table->rememberToken();
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Schema::create('passwords', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->string('hash');
|
||||||
|
$table->foreignId('user_id')->index();
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
|
||||||
Schema::create('password_reset_tokens', function (Blueprint $table) {
|
Schema::create('password_reset_tokens', function (Blueprint $table) {
|
||||||
$table->string('email')->primary();
|
$table->foreignId('user_id')->primary();
|
||||||
$table->string('token');
|
$table->string('token');
|
||||||
$table->timestamp('created_at')->nullable();
|
$table->timestamp('created_at')->nullable();
|
||||||
});
|
});
|
||||||
|
@ -43,6 +51,7 @@ return new class extends Migration
|
||||||
public function down(): void
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::dropIfExists('users');
|
Schema::dropIfExists('users');
|
||||||
|
Schema::dropIfExists('passwords');
|
||||||
Schema::dropIfExists('password_reset_tokens');
|
Schema::dropIfExists('password_reset_tokens');
|
||||||
Schema::dropIfExists('sessions');
|
Schema::dropIfExists('sessions');
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue