Phase 02 — Database Schema
Create all database tables on plugin activation so every other module has a stable storage layer to build against.
What was built
Section titled “What was built”src/Install/Installer.php—run()callsdbDelta()with 15CREATE TABLEstatements (15 because the spec’s 14 includes two subscription sub-tables plus the notes table). Storeswplm_db_version, hands off toMigratoron version bump.src/Install/Migrator.php— Versioned migration stub; hosts per-version upgrade routines.
Tables created
Section titled “Tables created”| # | Table | Purpose |
|---|---|---|
| 1 | wplm_licenses | License key records (encrypted key, hash, signature, status, seats) |
| 2 | wplm_machines | Device activations bound to a license |
| 3 | wplm_machine_components | Sub-fingerprints for hardware components |
| 4 | wplm_activation_log | Immutable audit log of every licensing event |
| 5 | wplm_generators | Key-format templates |
| 6 | wplm_api_keys | Consumer keys for REST API authentication |
| 7 | wplm_releases | Software version records with changelog and artifact reference |
| 8 | wplm_webhooks | Webhook registrations (events + target URL + secret) |
| 9 | wplm_webhook_log | Delivery attempts and responses |
| 10 | wplm_blacklist | Global fingerprint / IP / email deny list |
| 11 | wplm_license_meta | Arbitrary key-value meta per license |
| 12 | wplm_subscriptions | Native subscription records |
| 13 | wplm_subscription_items | Line items per subscription |
| 14 | wplm_subscription_renewals | Renewal / switch / resubscribe history |
| 15 | wplm_subscription_notes | System and admin audit notes per subscription |
How to test
Section titled “How to test”SHOW TABLES LIKE 'wp_wplm_%';-- Expect 15 rows
DESCRIBE wp_wplm_licenses;-- hash column must be CHAR(64) with a UNIQUE KEYActivate, then deactivate and reactivate — dbDelta should not error on re-run (idempotent).
Acceptance criteria covered
Section titled “Acceptance criteria covered”- Activation clean — All 15 tables created with correct columns and indexes.