SchemaInstaller.php
Source file: wordpress/hslg-app-api/src/database/SchemaInstaller.php
Module: wordpress-hslg-app-api
Size: 100 lines
SHA-256: e9c6ba698af6462fdf1d8c9b48deba5ececc18d77db27165913ecbda5ed61410
Responsibility
Hosts independently deployable HSLG-owned API endpoints and schema operations on WordPress/MariaDB.
Declared entry points
SchemaInstaller— source line 14.__construct— source line 16.version— source line 17.install— source line 30.
Imports and dependencies
- Line 4:
use Hslg\Backend\Database\TableNames; - Line 5:
use Hslg\Backend\Database\Migrations\InitialSchema; - Line 6:
use Hslg\Backend\Database\Migrations\RecordSchemaV2; - Line 7:
use Hslg\Backend\Database\Migrations\AccountOrderSchemaV3; - Line 8:
use Hslg\Backend\Database\Migrations\PaymentSchemaV4; - Line 41:
require_once ABSPATH . 'wp-admin/includes/upgrade.php';
Behaviour and audit locations
- Line 45:
foreach (['app_meta','venues','customer_records','customer_accounts','customer_sessions','account_challenges','auth_rate_limits','order_drafts','menu_prices','order_payme - Line 60:
'order_drafts'=>['order_id','customer_id','venue_id','idempotency_key','request_hash','basket_json','state'], - Line 62:
'order_payments'=>['order_id','customer_id','venue_id','stripe_intent_id','payment_key','quoted_items_json','amount_minor','currency','state'], - Line 63:
'stripe_webhook_events'=>['stripe_event_id','order_id','venue_id','event_type','received_at','processed_at'],
Upgrade control
The schema installer coordinates HSLG table creation and additive migrations at the WordPress plugin boundary. It must use site-prefixed HSLG table names, preserve existing customer data and handle repeat activation safely. Migration source alone is not proof that indexes and MariaDB timestamp defaults match expectations; inspect the actual database after staging upgrade. If a plugin is downgraded, do not assume its ZIP can automatically roll back schema changes.
Relationship to the system
This page is the file-level source reference, not the architecture rationale. Read the module explanation, the corresponding architecture decision and user guide before changing behaviour. Names and line locations above are extracted from this exact source version; they are reference points, not proof that an external service or a phone feature works.
Change verification
Review the entry points and errors in this file, then run the module’s associated tests, source dependency gate, history gate and documentation coverage check. If the file changes an API response, user interaction, data model, deployment or third-party dependency, revise those human explanations and disaster recovery/licensing when relevant. Do not infer actual native or external API operation from source presence.