Skip to main content

Version Docs Updated

Purpose

This page explains MHM Rentiva's hybrid database architecture (WP Core + Native Custom Tables), table schemas, and data integrity standards.

πŸ—„οΈ Database Architecture

MHM Rentiva uses a hybrid architecture that combines the WordPress Post/User Meta system with High-Performance Custom Tables to meet its requirements for performance and data integrity.

πŸ“Š Custom Tables​

For financial records and SaaS operations, the plugin bypasses WordPress's standard tables and uses the following SQL-optimized tables directly:

Table NamePurposeCritical Columns
wp_mhm_rentiva_ledgerImmutable financial ledger.transaction_uuid, amount, tenant_id
wp_mhm_rentiva_commission_policyVersioned records of commission policies.version_hash, global_rate, effective_from
wp_mhm_rentiva_tenantsMulti-tenant records and quotas.tenant_id, status, subscription_plan
wp_mhm_rentiva_usage_metricsSaaS usage limits and metric tracking.metric_type, metric_value, cycle_start

πŸ—οΈ Data Integrity Principles​

  • Immutability: Records in the ledger table are never updated or deleted. Corrections are made by creating a new offsetting entry.
  • Tenant Isolation: The tenant_id column is present in all custom tables. Data is logically isolated at the database level.
  • Audit Trail: Commission policies are signed with a version_hash (SHA-256) to create a financial audit trail.

πŸ”‘ Meta Key Standards​

Operational data (vehicle attributes, customer preferences, etc.) is stored in WordPress meta tables using the following prefix convention: _mhm_rentiva_[category]_[field_name]

CategoryExample Key
Vehicle_mhm_rentiva_vehicle_license_plate
Booking_mhm_rentiva_booking_payout_status
Customer_mhm_rentiva_customer_banned

🧬 Table Relationships (ER)​


Transfer Tables​

Two custom tables are used by the Transfer module:

Table NamePurposeCritical Columns
wp_rentiva_transfer_locationsTransfer points (airport, hotel, port, etc.)name, type, city, lat, lng
wp_rentiva_transfer_routesRoute definitions between two locationsorigin_id, destination_id, base_price, min_price, max_price, distance_km

DatabaseMigrator v3.4.0 Changes​

  • city VARCHAR(100) column added to rentiva_transfer_locations table (for vendor marketplace city-based filtering).
  • max_price DECIMAL(10,2) column added to rentiva_transfer_routes table (upper bound for vendor price range).

Maintenance and Development​

  • Migrations: The database schema is defined under src/Core/Database/Migrations/. The MultiTenantMigration and LedgerMigration classes perform safe updates using dbDelta.
  • Audit Tool: Database consistency can be verified with the wp mhm-rentiva audit CLI commands.

Uninstaller Table List​

The following tables are removed when the plugin is uninstalled:

TableCategory
wp_mhm_rentiva_ledgerFinancial
wp_mhm_rentiva_commission_policyFinancial
wp_mhm_rentiva_tenantsSaaS
wp_mhm_rentiva_usage_metricsSaaS
wp_mhm_notification_queueSystem
wp_mhm_payment_logSystem
wp_mhm_sessionsSystem
wp_rentiva_transfer_locationsTransfer
wp_rentiva_transfer_routesTransfer

Legacy mhm_rentiva_transfer_* tables are also removed if present.

Section Summary​

  • Critical financial data is managed via SQL on Custom Tables.
  • Transfer tables support the vendor marketplace with city and max_price columns.
  • Flexible data is stored in the WP Meta system.
  • The multi-tenancy structure propagates the tenant_id parameter across all layers.
  • The Uninstaller removes 9 custom tables plus any legacy tables.

Changelog​

DateVersionNote
23.04.20264.27.2English translation added.
27.03.20264.23.0Transfer tables (locations + routes), DatabaseMigrator v3.4.0 changes (city, max_price), and Uninstaller table list (9 tables + legacy) added.
19.03.20264.23.0Database documentation rewritten for SaaS and Financial architecture.