feat: convert deposit amounts from toman to rials in appointment handling
This commit is contained in:
@@ -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');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user