From 7a5d7698c07dd2f69d42b60e9cd7c87ab8afa4b9 Mon Sep 17 00:00:00 2001 From: hamed <15238-genius.ha@users.noreply.drupalcode.org> Date: Tue, 28 Jul 2026 12:57:22 +0330 Subject: [PATCH] fix(schema): declare the column defaults the database already has doctrine:schema:update kept proposing the same two ALTERs on every run, because three columns carry a default in MariaDB that the mapping never declared. The drift was noise, but it hid real diffs: both tenant migrations in this series picked these ALTERs up as unrelated changes that had to be stripped by hand. All three fields already default in PHP (0, 0, and STATUS_CONFIRMED), and the database columns already match, so the fix is to state the default in the mapping rather than alter live tables. schema:update now reports the schema in sync and migrations:diff finds nothing. Tests: 856 passing. Co-Authored-By: Claude Opus 5 (1M context) --- src/Patient/Entity/PatientSession.php | 4 ++-- src/Settlement/Entity/WalletTransaction.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Patient/Entity/PatientSession.php b/src/Patient/Entity/PatientSession.php index e3851669..9299bd28 100644 --- a/src/Patient/Entity/PatientSession.php +++ b/src/Patient/Entity/PatientSession.php @@ -95,11 +95,11 @@ class PatientSession private ?string $discountType = null; /** مقدار خام تخفیف (درصد یا ریال، بسته به نوع) */ - #[ORM\Column(name: 'discount_value', type: 'integer')] + #[ORM\Column(name: 'discount_value', type: 'integer', options: ['default' => 0])] private int $discountValue = 0; /** مبلغ محاسبه‌شده‌ی تخفیف به ریال (سقف: مبلغ نهایی) */ - #[ORM\Column(name: 'discount_rials', type: 'integer')] + #[ORM\Column(name: 'discount_rials', type: 'integer', options: ['default' => 0])] private int $discountRials = 0; /** منبع تخفیف: id قانون تخفیف اعمال‌شده (audit)؛ null اگر دستی یا بدون تخفیف */ diff --git a/src/Settlement/Entity/WalletTransaction.php b/src/Settlement/Entity/WalletTransaction.php index 9681364b..086be721 100644 --- a/src/Settlement/Entity/WalletTransaction.php +++ b/src/Settlement/Entity/WalletTransaction.php @@ -64,7 +64,7 @@ class WalletTransaction #[ORM\Column(type: 'string', length: 120, nullable: true)] private ?string $reference = null; - #[ORM\Column(type: 'string', length: 15)] + #[ORM\Column(type: 'string', length: 15, options: ['default' => self::STATUS_CONFIRMED])] private string $status = self::STATUS_CONFIRMED; #[ORM\Column(name: 'created_at', type: 'integer')]