-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #186 from laravel-enso/feature/usersPersonIdUnique
made the person_id unique for the users table
- Loading branch information
Showing
3 changed files
with
29 additions
and
2 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
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
namespace LaravelEnso\Core\Upgrades; | ||
|
||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
use LaravelEnso\Upgrade\Contracts\MigratesTable; | ||
use LaravelEnso\Upgrade\Helpers\Table; | ||
|
||
class UsersPersonIdUnique implements MigratesTable | ||
{ | ||
public function isMigrated(): bool | ||
{ | ||
return Table::hasIndex('users', 'users_person_id_unique'); | ||
} | ||
|
||
public function migrateTable(): void | ||
{ | ||
Schema::table('users', fn (Blueprint $table) => $table | ||
->unique(['person_id'])); | ||
} | ||
} |