Database Schema
The plugin creates 16 custom tables plus uses standard WP / WC tables. All prefixed by your $wpdb->prefix (typically wp_).
Schema version: 1.5.0
Table index
| Table | Columns | Indexes | Purpose |
|---|---|---|---|
wkafw_auctions | 22 | 5 | Core auction records |
wkafw_bids | 10 | 7 | Every bid placed |
wkafw_proxy_bids | 6 | 2 | Proxy / max-bid storage |
wkafw_watchlist | 4 | 2 | User → auction watch links |
wkafw_auction_logs | 8 | 5 | Lifecycle event log |
wkafw_disputes | 8 | 3 | Buyer-filed disputes |
wkafw_events | 11 | 4 | Event grouping |
wkafw_event_lots | 4 | 2 | Event ↔ auction many-to-many |
wkafw_event_registrations | 5 | 2 | Bidders registered for events |
wkafw_messages | 7 | 3 | Buyer ↔ seller messages |
wkafw_notifications | 8 | 2 | In-app notifications |
wkafw_bid_packs | 11 | 5 | Penny-auction bid tokens |
wkafw_auction_seats | 6 | 3 | Seated-auction paddle assignment |
wkafw_vendor_commissions | 13 | 7 | Multi-vendor revenue split |
wkafw_vendor_ratings | 7 | 4 | Buyer-rated seller scores |
wkwc_wallet_transactions | 10 | 4 | Wallet ledger (submodule) |
Key tables in detail
wkafw_auctions
The central table — one row per auction.
| Column | Type | Notes |
|---|---|---|
id | BIGINT(20) UNSIGNED | PK |
product_id | BIGINT(20) UNSIGNED | FK → wp_posts.ID |
auction_type | VARCHAR(20) | standard / reverse / sealed / proxy / silent / charity / penny / dutch / seated / unique-bid |
start_price | DECIMAL(19,4) | Opening bid |
reserve_price | DECIMAL(19,4) | Hidden minimum |
buy_now_price | DECIMAL(19,4) | BIN price (0 = disabled) |
bid_increment | DECIMAL(19,4) | Required step amount |
increment_type | VARCHAR(20) | fixed / variable / percentage |
variable_increments | LONGTEXT | JSON tier table |
start_date / end_date | DATETIME | Auction window |
original_end_date | DATETIME | Pre-anti-snipe end (for reporting) |
status | VARCHAR(20) | scheduled / active / paused / ended / paid / failed / cancelled |
anti_snipe_window / anti_snipe_extension | INT(11) | Soft-close config |
max_extension | INT(11) | Cumulative extension cap (0 = unlimited) |
total_extensions | INT(11) | Counter |
current_price | DECIMAL(19,4) | Live high bid |
bid_count | INT(11) | Counter |
item_condition | VARCHAR(20) | new / like_new / used / refurbished / for_parts |
created_at / updated_at | DATETIME | Standard timestamps |
Indexes: id (PK), product_id, status, start_date, end_date
wkafw_bids
Every bid placed.
| Column | Type | Notes |
|---|---|---|
id | BIGINT(20) UNSIGNED | PK |
auction_id | BIGINT(20) UNSIGNED | FK → wkafw_auctions.id |
user_id | BIGINT(20) UNSIGNED | FK → wp_users.ID |
bid_amount | DECIMAL(19,4) | The amount |
bid_type | VARCHAR(20) | manual / proxy / absentee / auto |
ip_address | VARCHAR(45) | IPv4 / IPv6 |
user_agent | VARCHAR(255) | Browser UA |
is_anonymous | TINYINT(1) | 0 / 1 |
status | VARCHAR(20) | active / retracted / fraudulent / outbid |
created_at | DATETIME | When placed (UTC) |
Indexes: id (PK), auction_id, user_id, bid_amount, created_at, status, auction_status_amount (composite)
wkafw_watchlist
| Column | Type |
|---|---|
id | BIGINT(20) UNSIGNED |
auction_id | BIGINT(20) UNSIGNED |
user_id | BIGINT(20) UNSIGNED |
created_at | DATETIME |
Unique index: (auction_id, user_id) — one watch per user per auction.
wkafw_proxy_bids
| Column | Type | Notes |
|---|---|---|
id | BIGINT(20) UNSIGNED | PK |
auction_id | BIGINT(20) UNSIGNED | FK |
user_id | BIGINT(20) UNSIGNED | FK |
max_amount | DECIMAL(19,4) | The user's secret max bid |
is_active | TINYINT(1) | 0 = absentee (pre-bid before auction starts) |
created_at | DATETIME |
wkafw_auction_logs
The general activity log (per-auction events).
| Column | Type |
|---|---|
id | BIGINT(20) |
auction_id | BIGINT(20) |
user_id | BIGINT(20) |
action | VARCHAR(50) — e.g. bid_placed, started, extended, won |
details | LONGTEXT — JSON payload |
ip_address | VARCHAR(45) |
user_agent | VARCHAR(512) |
created_at | DATETIME |
This is separate from the bid hash-chain (Wkafw_Bid_Audit_Chain) which uses an in-memory + file-backed structure.
wkwc_wallet_transactions
Wallet ledger (provided by submodule).
| Column | Type | Notes |
|---|---|---|
id | BIGINT(20) | PK |
order_id | VARCHAR(250) | Source order ID (top-up) or null |
reference | VARCHAR(100) | Unique transaction reference |
sender | INT(10) | For transfers — sender user_id |
customer | INT(10) | The wallet owner |
amount | VARCHAR(50) | (stored as string for currency precision) |
transaction_type | VARCHAR(10) | cr (credit) / dr (debit) |
transaction_date | DATETIME | |
transaction_status | VARCHAR(10) | completed / pending / failed |
transaction_note | VARCHAR(250) |
Balance is derived from this table — not stored. See Wallet System.
wkafw_vendor_commissions
Multi-vendor revenue split.
| Column | Type | Notes |
|---|---|---|
id | BIGINT(20) UNSIGNED | PK |
vendor_id | BIGINT(20) UNSIGNED | FK → user (the vendor) |
auction_id | BIGINT(20) UNSIGNED | FK |
order_id | BIGINT(20) UNSIGNED | FK → WC order |
total_amount | DECIMAL(19,4) | Winning bid amount |
commission_rate | DECIMAL(6,3) | Platform's % |
commission_amount | DECIMAL(19,4) | Platform's earnings |
vendor_earning | DECIMAL(19,4) | Vendor's net |
adapter_slug | VARCHAR(32) | wcfm / dokan / wc_vendors / yith / native |
native_row_id | BIGINT(20) | Cross-reference to multi-vendor plugin's own commission row |
status | VARCHAR(20) | pending / paid / cancelled |
created_at / updated_at | DATETIME |
Unique index: (auction_id, vendor_id) — one commission per vendor per auction.
Relationships
wp_users (WP)
↓ 1:N
wkafw_bids ───► wkafw_auctions ◄─── wkafw_proxy_bids
│
├─► wkafw_watchlist
├─► wkafw_auction_logs
├─► wkafw_disputes
├─► wkafw_event_lots ─► wkafw_events
├─► wkafw_messages
├─► wkafw_auction_seats (seated)
├─► wkafw_bid_packs (penny — by user)
└─► wkafw_vendor_commissions ─► wp_users (vendor)
└─► wp_wc_orders (HPOS) or wp_posts
wp_users
↓ 1:N
wkwc_wallet_transactions
Query patterns
Count active auctions
SELECT COUNT(*) FROM wp_wkafw_auctions WHERE status = 'active';
User's wallet balance
SELECT
SUM(CASE WHEN transaction_type='cr' THEN CAST(amount AS DECIMAL(19,4)) ELSE 0 END) -
SUM(CASE WHEN transaction_type='dr' THEN CAST(amount AS DECIMAL(19,4)) ELSE 0 END)
FROM wp_wkwc_wallet_transactions
WHERE customer = ? AND transaction_status = 'completed';
Top bidders (lifetime)
SELECT u.display_name, COUNT(*) AS bid_count
FROM wp_wkafw_bids b
JOIN wp_users u ON b.user_id = u.ID
WHERE b.status = 'active'
GROUP BY b.user_id
ORDER BY bid_count DESC
LIMIT 10;
Bid history for a specific auction
SELECT b.*, u.display_name
FROM wp_wkafw_bids b
JOIN wp_users u ON b.user_id = u.ID
WHERE b.auction_id = ? AND b.status = 'active'
ORDER BY b.created_at DESC;
Performance
Every plugin query uses indexed columns. Common access patterns are O(log N) on the relevant index.
For very large databases (1M+ bids):
- Add a composite index on
(auction_id, status, created_at)for bid history pagination - Partition
wkafw_auction_logsbycreated_at(monthly partitions) - Archive old auctions (status
paid/failedolder than 1 year) to a separate table
The plugin doesn't auto-partition or archive — operator's responsibility.
Migrations
Schema changes are versioned. On plugin upgrade, Wkafw_Installer::maybe_migrate_db() checks the stored version against the code version and runs incremental migrations.
| Stored option | Effect |
|---|---|
wkafw_db_version | Current schema version |
wkafw_db_migrations_failed | List of failed migrations (for retry) |
Manual migration: Tools → Database → Re-run migrations (Tools →).
HPOS
Order data is queried from:
| Setting | Tables used |
|---|---|
| HPOS active | wp_wc_orders, wp_wc_orders_meta |
| HPOS inactive (legacy) | wp_posts (post_type=shop_order) + wp_postmeta |
The plugin auto-detects via \Automattic\WooCommerce\Utilities\OrderUtil::custom_orders_table_usage_is_enabled().
Backup recommendations
- Daily: full DB dump including all
wkafw_*andwkwc_wallet_*tables - Hourly:
wkafw_bids+wkafw_auction_logs(for audit recovery) - Real-time: replicate to a read-only standby (for high-availability sites)
The plugin's data is not recoverable from WP exports — use mysqldump or your hosting provider's backup tool.
See also
- Hooks & Filters — actions / filters reference
- Options Reference — all 132 plugin options
- Tools → Database — admin migration / repair tools
