Skip to content

Database schema (version 1)

Prefix: {wpdb->prefix} + ad_form_. Example: wp_ad_form_forms.

Charset: site charset/collate via $wpdb->get_charset_collate() (utf8mb4).

Schema version is stored in option ad_form_db_version and table {prefix}ad_form_migrations.

Tables

{prefix}ad_form_forms

ColumnTypeNotes
idBIGINT UNSIGNED PK
uuidCHAR(36) UNIQUEStable public id
titleVARCHAR(255)
slugVARCHAR(191) UNIQUEShortcode / REST
statusVARCHAR(20)draft, published, disabled, archived
definitionLONGTEXTJSON schema of the form
versionINT UNSIGNEDOptimistic form version
parent_idBIGINT UNSIGNED NULLRevision parent
created_by / updated_byBIGINT UNSIGNEDWP user ids
created_at / updated_atDATETIMEUTC
published_at / starts_at / ends_atDATETIME NULLScheduling
submission_countBIGINT UNSIGNEDDenormalized counter

Indexes: status_updated, created_by, parent_id.

{prefix}ad_form_form_meta

EAV for rarely queried form options. Hot data stays on forms.

Indexes: (form_id, meta_key), meta_key.

{prefix}ad_form_submissions

ColumnTypeNotes
idBIGINT UNSIGNED PK
uuidCHAR(36) UNIQUE
form_idBIGINT UNSIGNEDIndexed with status + created_at
form_versionINT UNSIGNEDDefinition version at submit time
statusVARCHAR(20)unread, read, spam, trash
is_starredTINYINT(1)
user_idBIGINT UNSIGNED0 = guest
ip_hashCHAR(64) NULLHash/anonymized; raw IP is a settings choice
user_agentVARCHAR(255) NULLOff by default
sourceVARCHAR(50)shortcode, elementor, gutenberg, api
payment_statusVARCHAR(20) NULL
payloadLONGTEXTFull JSON snapshot
created_at / updated_atDATETIME
deleted_atDATETIME NULLSoft delete / trash

Indexes: form_status_created, form_created, user_id, ip_hash, status_created, is_starred.

{prefix}ad_form_submission_meta

Normalized, queryable field values. form_id is denormalized to avoid joins on large lists.

ColumnTypeNotes
value_textVARCHAR(191)Indexed equality / prefix search
value_numDECIMAL(20,6)Numeric filters and calculations
value_longLONGTEXTFull value when longer than 191 chars

Indexes: submission_id, (form_id, field_key, value_text), (form_id, field_key, value_num), (field_key, value_text).

{prefix}ad_form_logs

Action, mail, webhook, REST and payment logs. Debug rows are not written unless enabled.

Indexes include created_at for retention jobs.

{prefix}ad_form_payments

Amounts in the smallest currency unit (integer). Client-supplied totals are never trusted; Phase 16 recalculates server-side.

{prefix}ad_form_migrations

Applied schema versions. Unique on version.

Scale notes

  • List screens filter on (form_id, status, created_at) — covered by one composite index.
  • Search by email uses submission_meta.form_field_value, not LIKE on payload.
  • Pagination is mandatory; never load unbounded entry lists.
  • JSON definition / payload stay off hot WHERE clauses.

Foreign keys

None at the engine level. Repositories delete children when a parent is removed.

Digitale Lösungen. Persönlich. Zukunftssicher.