-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: adrolli <[email protected]>
- Loading branch information
Showing
18 changed files
with
446 additions
and
413 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
database/migrations/2024_03_04_235738_update_user_table.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
return new class extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
*/ | ||
public function up(): void | ||
{ | ||
Schema::table('users', function (Blueprint $table) { | ||
// name and email are part of Laravel's default | ||
if (! Schema::hasColumn('users', 'slug')) { | ||
$table->string('slug')->after('name'); | ||
} | ||
if (! Schema::hasColumn('users', 'gender')) { | ||
$table->enum('gender', ['male', 'female', 'other'])->after('slug'); | ||
} | ||
if (! Schema::hasColumn('users', 'title')) { | ||
$table->string('title')->nullable()->after('gender'); | ||
} | ||
if (! Schema::hasColumn('users', 'first_name')) { | ||
$table->string('first_name')->after('title'); | ||
} | ||
if (! Schema::hasColumn('users', 'last_name')) { | ||
$table->string('last_name')->after('first_name'); | ||
} | ||
if (! Schema::hasColumn('users', 'website')) { | ||
$table->string('website')->nullable()->after('email'); | ||
} | ||
if (! Schema::hasColumn('users', 'description')) { | ||
$table->text('description')->nullable()->after('website'); | ||
} | ||
// `email_verified_at`, `password`, and `remember_token` are part of Laravel's default | ||
if (! Schema::hasColumn('users', 'two_factor_secret')) { | ||
$table->text('two_factor_secret')->nullable()->after('remember_token'); | ||
} | ||
if (! Schema::hasColumn('users', 'two_factor_recovery_codes')) { | ||
$table->text('two_factor_recovery_codes')->nullable()->after('two_factor_secret'); | ||
} | ||
if (! Schema::hasColumn('users', 'two_factor_confirmed_at')) { | ||
$table->timestamp('two_factor_confirmed_at')->nullable()->after('two_factor_recovery_codes'); | ||
} | ||
// Skipping `current_team_id` as it's from Jetstream | ||
if (! Schema::hasColumn('users', 'avatar_url')) { | ||
$table->string('avatar_url', 2048)->nullable()->after('two_factor_confirmed_at'); | ||
} | ||
if (! Schema::hasColumn('users', 'profile_photo_path')) { | ||
$table->string('profile_photo_path')->nullable()->after('avatar_url'); | ||
} | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
*/ | ||
public function down(): void | ||
{ | ||
// Sorry, it's the user table | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,5 @@ | ||
<?php | ||
|
||
return [ | ||
'resources' => [ | ||
'user' => [ | ||
'enabled' => true, | ||
'label' => 'User', | ||
'plural_label' => 'Users', | ||
'navigation_group' => 'User Group', | ||
'navigation_icon' => 'heroicon-o-play', | ||
'navigation_sort' => 1, | ||
'navigation_count_badge' => true, | ||
'resource' => Moox\User\Resources\UserResource::class, | ||
], | ||
], | ||
'pruning' => [ | ||
'enabled' => true, | ||
'retention_days' => 7, | ||
], | ||
// not used | ||
]; |
32 changes: 0 additions & 32 deletions
32
packages/user/database/migrations/create_user_table.php.stub
This file was deleted.
Oops, something went wrong.
63 changes: 63 additions & 0 deletions
63
packages/user/database/migrations/update_user_table.php.stub
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
return new class extends Migration { | ||
/** | ||
* Run the migrations. | ||
*/ | ||
public function up(): void | ||
{ | ||
Schema::table('users', function (Blueprint $table) { | ||
// name and email are part of Laravel's default | ||
if (!Schema::hasColumn('users', 'slug')) { | ||
$table->string('slug')->after('name'); | ||
} | ||
if (!Schema::hasColumn('users', 'gender')) { | ||
$table->enum('gender', ['unknown', 'male', 'female', 'other'])->after('slug')->default('unknown'); | ||
} | ||
if (!Schema::hasColumn('users', 'title')) { | ||
$table->string('title')->nullable()->after('gender'); | ||
} | ||
if (!Schema::hasColumn('users', 'first_name')) { | ||
$table->string('first_name')->after('title'); | ||
} | ||
if (!Schema::hasColumn('users', 'last_name')) { | ||
$table->string('last_name')->after('first_name'); | ||
} | ||
if (!Schema::hasColumn('users', 'website')) { | ||
$table->string('website')->nullable()->after('email'); | ||
} | ||
if (!Schema::hasColumn('users', 'description')) { | ||
$table->text('description')->nullable()->after('website'); | ||
} | ||
// `email_verified_at`, `password`, and `remember_token` are part of Laravel's default | ||
if (!Schema::hasColumn('users', 'two_factor_secret')) { | ||
$table->text('two_factor_secret')->nullable()->after('remember_token'); | ||
} | ||
if (!Schema::hasColumn('users', 'two_factor_recovery_codes')) { | ||
$table->text('two_factor_recovery_codes')->nullable()->after('two_factor_secret'); | ||
} | ||
if (!Schema::hasColumn('users', 'two_factor_confirmed_at')) { | ||
$table->timestamp('two_factor_confirmed_at')->nullable()->after('two_factor_recovery_codes'); | ||
} | ||
// Skipping `current_team_id` as it's from Jetstream | ||
if (!Schema::hasColumn('users', 'avatar_url')) { | ||
$table->string('avatar_url', 2048)->nullable()->after('two_factor_confirmed_at'); | ||
} | ||
if (!Schema::hasColumn('users', 'profile_photo_path')) { | ||
$table->string('profile_photo_path')->nullable()->after('avatar_url'); | ||
} | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
*/ | ||
public function down(): void | ||
{ | ||
// Sorry, it's the user table | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.