Backend Database module
Implements repositories, schema definitions and migration contracts; MariaDB owns originating customer record time.
Schema ownership and migration sequence
TableNames.php establishes HSLG-specific table naming. InitialSchema.php, RecordSchemaV2.php, AccountOrderSchemaV3.php and PaymentSchemaV4.php represent the foundation, append-only customer records, accounts/drafts and payment-related schema milestones. They belong to HSLG business data rather than WordPress editorial posts and should remain additive where migrations support it.
Why migrations need real tests
Column defaults, indices, uniqueness, timestamp precision and database time zones can behave differently under an actual MariaDB server than in a PHP test double. Validate upgrade from each supported existing schema on staging, not only installation into an empty database. Capture before/after schema evidence and rollback limits; a previous PHP plugin ZIP may not automatically undo new columns or tables.
Record rules
New customer fields receive fresh UUID record identifiers and an originating MariaDB written_at default. SQL latest selection orders by original timestamp and record UUID. This does not authorize last-write-wins for payments, credentials or session state. Later restaurant replication remains deferred and needs separate authentication and clock-skew review.
Source files in this module
- backend/database/TableNames.php
- backend/database/migrations/AccountOrderSchemaV3.php
- backend/database/migrations/InitialSchema.php
- backend/database/migrations/PaymentSchemaV4.php
- backend/database/migrations/RecordSchemaV2.php
Maintenance and evidence
Check all affected file references and the matching human-readable user/architecture page when source changes. Run the module’s contract or governance checks; staging, payment and native hardware tests remain independent of source inventory coverage.