generated from KennethTrecy/web_template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
internal(account): make migration to renew uniqueness
- Loading branch information
1 parent
d0232f1
commit 5f98c82
Showing
1 changed file
with
22 additions
and
0 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
app/Database/Migrations/2023-09-22-122212_RenewAccountUniqueness.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,22 @@ | ||
<?php | ||
|
||
namespace App\Database\Migrations; | ||
|
||
use CodeIgniter\Database\Migration; | ||
|
||
class RenewAccountUniqueness extends Migration | ||
{ | ||
public function up() | ||
{ | ||
$this->forge->dropKey("accounts", "accounts_name_key", false); | ||
$this->forge->addUniqueKey([ "currency_id", "name" ]); | ||
$this->forge->processIndexes("accounts"); | ||
} | ||
|
||
public function down() | ||
{ | ||
$this->forge->dropKey("accounts", "accounts_currency_id_name", false); | ||
$this->forge->addUniqueKey("name", "accounts_name_key"); | ||
$this->forge->processIndexes("accounts"); | ||
} | ||
} |