Drop unique constraint on 'cif' in debitures table

Remove the unique constraint on the 'cif' field in the debitures table and refactor the `UniqueCifExceptZero` validation rule to handle the uniqueness check more robustly. Also, add an unused import statement for `UniqueExcept` in `DebitureRequest`.
This commit is contained in:
Daeng Deni Mardaeni
2024-11-01 09:39:41 +07:00
parent 26009d796b
commit 5201cdb0e3
3 changed files with 53 additions and 17 deletions

View File

@@ -0,0 +1,28 @@
<?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('debitures', function (Blueprint $table) {
$table->dropUnique(['cif']);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('debitures', function (Blueprint $table) {
$table->string('cif')->unique()->change();
});
}
};