Skip to content

Phase 02 — Database Schema

Create all database tables on plugin activation so every other module has a stable storage layer to build against.

  • src/Install/Installer.phprun() calls dbDelta() with 15 CREATE TABLE statements (15 because the spec’s 14 includes two subscription sub-tables plus the notes table). Stores wplm_db_version, hands off to Migrator on version bump.
  • src/Install/Migrator.php — Versioned migration stub; hosts per-version upgrade routines.
#TablePurpose
1wplm_licensesLicense key records (encrypted key, hash, signature, status, seats)
2wplm_machinesDevice activations bound to a license
3wplm_machine_componentsSub-fingerprints for hardware components
4wplm_activation_logImmutable audit log of every licensing event
5wplm_generatorsKey-format templates
6wplm_api_keysConsumer keys for REST API authentication
7wplm_releasesSoftware version records with changelog and artifact reference
8wplm_webhooksWebhook registrations (events + target URL + secret)
9wplm_webhook_logDelivery attempts and responses
10wplm_blacklistGlobal fingerprint / IP / email deny list
11wplm_license_metaArbitrary key-value meta per license
12wplm_subscriptionsNative subscription records
13wplm_subscription_itemsLine items per subscription
14wplm_subscription_renewalsRenewal / switch / resubscribe history
15wplm_subscription_notesSystem and admin audit notes per subscription
SHOW TABLES LIKE 'wp_wplm_%';
-- Expect 15 rows
DESCRIBE wp_wplm_licenses;
-- hash column must be CHAR(64) with a UNIQUE KEY

Activate, then deactivate and reactivate — dbDelta should not error on re-run (idempotent).

  • Activation clean — All 15 tables created with correct columns and indexes.