Skip to content

Commit

Permalink
internal(account): make migration to renew uniqueness
Browse files Browse the repository at this point in the history
  • Loading branch information
KennethTrecy committed Sep 22, 2023
1 parent d0232f1 commit 5f98c82
Showing 1 changed file with 22 additions and 0 deletions.
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");
}
}

0 comments on commit 5f98c82

Please sign in to comment.