feat: convert deposit amounts from toman to rials in appointment handling

This commit is contained in:
hamed
2026-07-17 10:21:52 +03:30
parent a0ddb4c0d1
commit fcd7a0596d
9 changed files with 468 additions and 17 deletions
+31
View File
@@ -0,0 +1,31 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* The admin UI has always labeled the deposit field "toman" but stored the raw
* entered number in deposit_amount_rials. The UI now converts toman → rial on
* save; this backfills existing rows so stored values become true rials.
*/
final class Version20260717093000 extends AbstractMigration
{
public function getDescription(): string
{
return 'Convert existing appointment deposit amounts from toman to rials';
}
public function up(Schema $schema): void
{
$this->addSql('UPDATE appointments SET deposit_amount_rials = deposit_amount_rials * 10 WHERE deposit_amount_rials IS NOT NULL AND deposit_amount_rials > 0');
}
public function down(Schema $schema): void
{
$this->addSql('UPDATE appointments SET deposit_amount_rials = deposit_amount_rials / 10 WHERE deposit_amount_rials IS NOT NULL AND deposit_amount_rials > 0');
}
}