Skip to content

Amelia booking plugin database: wp_amelia_appointments

Amelia stores bookings in wp_amelia_appointments and wp_amelia_customer_bookings. See what each key column means and query bookings and payments with SQL.

Amelia, an appointment-booking plugin for WordPress, stores its bookings in two database tables. wp_amelia_appointments records when each appointment is scheduled, in columns such as bookingStart, bookingEnd, providerId and serviceId. wp_amelia_customer_bookings records who is coming and what they paid, one row per customer per appointment. Most real questions need both tables joined, which is why reading one on its own is so often confusing. You need this whenever the admin screens run out: auditing a month of appointments, hunting for a booking that disappeared, checking a timezone that looks wrong, or matching payments against what people actually booked. The sections below explain what every important column holds and give you SQL ready to run for those common tasks.

What you’ll accomplish

  • Read Amelia’s real schema straight from your own database with DESCRIBE, instead of guessing at column names.
  • Know exactly which table holds bookingStart, which table holds a customer’s own booking status, and why those are two different things.
  • Run the SQL that audits upcoming bookings, finds orphaned customer_bookings rows, and reconciles a payment back to an appointment.
  • Diagnose a timezone discrepancy between what bookingStart stores and what the customer actually saw.
  • Know which operational tasks — calendar sync, notification delivery, backups before an upgrade — depend on this data model staying consistent.

Prerequisites

  • A WordPress site running Amelia (free or paid tier) with at least one service, employee and booking already created, so the tables below aren’t empty.
  • Shell access with WP-CLI, or phpMyAdmin/Adminer access to the database. Every command here is written for wp db query, a thin wrapper around the same SQL you’d type into phpMyAdmin.
  • A place to put a .sql dump for the backup step before an upgrade.
  • Table names below assume the default prefix wp_. Amelia builds every table as {prefix}amelia_{name}, so substitute your own prefix if it differs.
  • Nothing here needs the Elite tier or its REST API — every table in this guide exists on every plan.

How it works

Amelia builds each table as {prefix}amelia_{name} — with the default prefix that’s wp_amelia_services, wp_amelia_users, wp_amelia_appointments, and so on, more than 40 tables in total. None of them carry a wp_posts row, so nothing shows up in the normal WordPress admin list screens — usually why a search like this lands here: you’ve already given up on the UI and opened phpMyAdmin.

The table that matters most, wp_amelia_appointments, is the slot: one row per bookable time period, holding bookingStart and bookingEnd as plain DATETIME columns, the status enum above, and serviceId / providerId pointing at the service and the employee. What it does not hold is who is coming. That lives in wp_amelia_customer_bookings — one row per customer per appointment, with its own customerId, its own status (the same five values, plus a sixth, waiting, for a customer who’s overflowed a capacity-limited slot), its own price, and a token used in the link Amelia emails out. A single appointment row can have several customer_bookings rows attached — that’s what a capacity-limited class or group session looks like in the schema — which is why an appointment’s own status and one customer’s status inside it are separate columns that can legitimately disagree: the class stays approved while a single attendee cancels.

wp_amelia_users is shared by everyone Amelia knows about — customers, providers, managers, admins — distinguished by one type column, so a query for “customers” or “providers” needs a WHERE type = '...' clause; there is no separate customers table. Calendar tokens live in their own wp_amelia_providers_to_google_calendar and wp_amelia_providers_to_outlook_calendar tables, not as columns on the provider’s row, and a payment links to customerBookingId, not to the appointment directly — reconciling money to a time slot is a two-table join, not one.

The Amelia data model: wp_amelia_appointments holds bookingStart and bookingEnd for the whole slot, while wp_amelia_customer_bookings holds each customer's own status and price, with services, providers, customers and payments connecting around them

None of these relationships are enforced by a foreign key. Every *Id column is a plain INT with nothing behind it — MySQL won’t stop you deleting an appointment out from under a customer’s booking, and Amelia’s own application code is the only thing keeping the tables consistent. That single fact explains most “weird” data: an orphaned booking, a payment with no home, a status that doesn’t match. It’s also why direct writes here, outside a confirmed cleanup, are worth avoiding.

One more gap is worth knowing before you query: neither table has a completed value. A booking that happened and one that simply hasn’t been touched since it was approved look identical — status stays approved forever unless a human or an integration changes it. To know whether an appointment actually occurred, compare bookingEnd to the current time yourself; the schema doesn’t track it for you.

Two status columns compared: appointments.status and customer_bookings.status both run pending, approved, then canceled, rejected or no-show, customer_bookings adds a waiting state for capacity overflow, and neither table has a completed state — you compare bookingEnd to now yourself

Step-by-step

1. Confirm the tables exist and pull their real column list — don’t trust any article, including this one, over your own schema.

wp db query "SHOW TABLES LIKE '%amelia%'"

Expect a list of 40-plus tables, all prefixed wp_amelia_.

wp db query "DESCRIBE wp_amelia_appointments"

Expect id, status, bookingStart, bookingEnd, notifyParticipants, serviceId, packageId, providerId, locationId, plus integration columns (internalNotes, googleCalendarEventId, outlookCalendarEventId, zoomMeeting). Different Amelia versions add or drop a column here — this command tells you the truth for your install.

2. Audit the coming week’s bookings directly from the appointments table.

wp db query "SELECT id, status, bookingStart, bookingEnd, serviceId, providerId FROM wp_amelia_appointments WHERE bookingStart >= CURDATE() AND bookingStart < CURDATE() + INTERVAL 7 DAY ORDER BY bookingStart"

Expect one row per booked slot, ordered by start time, including anything still pending that staff haven’t approved.

3. Pull each booking’s customer, status and price by joining to customer_bookings.

wp db query "SELECT a.id AS appointment_id, a.bookingStart, cb.status AS customer_status, cb.price, u.firstName, u.lastName, u.email FROM wp_amelia_appointments a JOIN wp_amelia_customer_bookings cb ON cb.appointmentId = a.id JOIN wp_amelia_users u ON u.id = cb.customerId WHERE a.bookingStart >= CURDATE() ORDER BY a.bookingStart LIMIT 20"

Expect more than one row for the same appointment_id on a capacity-limited service booked by several customers — that’s not duplicated data, it’s a group booking.

4. Find orphaned customer_bookings rows — bookings pointing at an appointment that no longer exists. Because none of these tables carry a foreign-key constraint, a manual DELETE against wp_amelia_appointments — a bad cleanup script, a ticket handled by hand in phpMyAdmin — leaves the matching customer_bookings rows behind.

wp db query "SELECT cb.id, cb.appointmentId, cb.customerId, cb.status, cb.created FROM wp_amelia_customer_bookings cb LEFT JOIN wp_amelia_appointments a ON a.id = cb.appointmentId WHERE cb.appointmentId IS NOT NULL AND a.id IS NULL"

Expect an empty result set on a healthy install. Any row returned is an orphan — a customer with a price, a status and a confirmation token, but nothing telling them when it was for.

5. Reconcile a payment back to the appointment it belongs to. Payments key on customerBookingId, not on the appointment, so reconciliation is a two-hop join.

wp db query "SELECT a.id AS appointment_id, a.bookingStart, cb.price AS booking_price, p.amount, p.status, p.gateway FROM wp_amelia_payments p JOIN wp_amelia_customer_bookings cb ON cb.id = p.customerBookingId JOIN wp_amelia_appointments a ON a.id = cb.appointmentId WHERE p.status IN ('pending','refunded') AND p.created > DATE_SUB(NOW(), INTERVAL 30 DAY)"

Expect a short list of payments needing follow-up — pending or refunded in the last 30 days, matched to the exact booking.

6. Check whether Amelia actually attempted the confirmation notification for a booking. wp_amelia_notifications_log records every send attempt with a sent flag.

wp db query "SELECT id, notificationId, sentDateTime, sent FROM wp_amelia_notifications_log WHERE appointmentId = 1234 ORDER BY sentDateTime DESC"

Expect one row per attempt. sent = 1 means Amelia handed the message to wp_mail() — deliverability from there is a separate problem, covered in WordPress form emails not arriving. An empty result means Amelia never tried.

7. Check calendar sync state per employee. Google and Outlook tokens live in their own tables, not on the employee’s row in wp_amelia_users.

wp db query "SELECT userId, calendarId FROM wp_amelia_providers_to_google_calendar"
wp db query "SELECT userId, calendarId FROM wp_amelia_providers_to_outlook_calendar"

Expect one row per employee who’s actually connected a calendar. No row means authorization was never completed, whatever the admin screen showed.

8. Back up the Amelia tables before any plugin upgrade. Amelia runs its own ALTER TABLE migrations on activation; a failed migration against a large customer_bookings table is not something to discover without a restore point.

wp db export amelia-backup-$(date +%F).sql --tables=$(wp db query "SHOW TABLES LIKE '%amelia%'" --skip-column-names | tr '\n' ',' | sed 's/,$//')

Expect a .sql file scoped to only the Amelia tables — small enough to keep several generations of.

Validate it works

Cross-check the row counts you’d expect between the two core tables — every appointment should have at least one customer attached to it:

wp db query "SELECT (SELECT COUNT(*) FROM wp_amelia_appointments) AS appointments, (SELECT COUNT(*) FROM wp_amelia_customer_bookings) AS customer_bookings, (SELECT COUNT(*) FROM wp_amelia_appointments a LEFT JOIN wp_amelia_customer_bookings cb ON cb.appointmentId = a.id WHERE cb.id IS NULL) AS appointments_with_no_customer"

appointments_with_no_customer should be 0. A nonzero, unexplained count means appointment rows exist that nobody is booked into — an admin-created placeholder, or a cleanup script that deleted the wrong side of the relationship.

Then confirm calendar sync coverage matches your active provider roster:

wp db query "SELECT u.id, u.firstName, u.lastName, g.calendarId AS google, o.calendarId AS outlook FROM wp_amelia_users u LEFT JOIN wp_amelia_providers_to_google_calendar g ON g.userId = u.id LEFT JOIN wp_amelia_providers_to_outlook_calendar o ON o.userId = u.id WHERE u.type = 'provider' AND u.status = 'visible'"

Every active provider who is supposed to sync should show a value in google or outlook. A NULL on someone who insists they connected means the authorization needs redoing, not just checking.

Troubleshooting

bookingStart looks wrong compared to what the customer says they booked. bookingStart is stored in whatever timezone WordPress is configured to use, not the server’s timezone and not the customer’s. A script comparing directly against bookingStart in UTC without accounting for the site’s offset computes a delta that’s wrong by exactly that offset. Check wp option get timezone_string before trusting a raw comparison — the customer sees a value Amelia already converted for display; the stored column itself never moves.

A customer_bookings row has no matching appointments row. Covered in step 4 — a deletion outside Amelia’s own code breaks the relationship silently, since there’s no foreign key to stop it. The booking record still exists, with a price and a status, but nothing says when it was for.

A payment shows pending, or is missing entirely, for a booking that shows approved. wp_amelia_payments.customerBookingId is set by the gateway’s callback. If the webhook never fires — a retried Stripe event that gave up, a PayPal IPN blocked by a firewall rule, a cache serving a stale page to the gateway’s POST — the appointment and the booking both look confirmed while no payment row exists. Run the join from step 5 on a schedule, not only after a complaint.

wp_amelia_notifications_log shows sent = 1 but the customer got nothing. That flag means Amelia handed the message to wp_mail() — it doesn’t mean an inbox received it. From there the problem is deliverability: SPF/DKIM alignment, sending-IP reputation, a filter on the receiving end. WordPress form emails not arriving is the triage path once the send is confirmed.

An employee’s calendar shows old bookings after their working hours change. Working hours, days off and special days are separate concepts in Amelia’s schedule tables, and none retroactively touch a booking that already exists — bookingStart/bookingEnd on an existing row don’t move when a schedule changes afterward. A provider who looks double-booked outside new hours was booked before the schedule changed; it isn’t a sync bug.

When this is the wrong approach

If you just need to see or manage bookings day to day, Amelia’s own admin calendar is the right tool — direct SQL is for auditing, migration and incident response, not routine operation. Editing these tables by hand with UPDATE risks leaving the two status columns inconsistent, exactly the mismatch the second diagram describes; treat direct SQL as read-only unless you’re removing a confirmed orphan found in step 4.

If you’re integrating another system with Amelia’s bookings programmatically — a CRM, a custom dashboard, a mobile app — the REST API, available on the Elite license, is the supported interface. It validates writes and fires the same notification and calendar-sync logic the admin UI does, where a raw INSERT will not.

If bookings aren’t happening at all — the [ameliabooking] shortcode isn’t rendering, or a JavaScript error blocks the calendar widget — the schema has nothing to tell you. Confirm the shortcode or Elementor widget sits on an uncached page before going near the database; see The Events Calendar on WordPress — operational picks if it’s a caching conflict shared with other calendar plugins.

Running WordPress that earns real money deserves an operator — Stack Harbor runs that stack under Enterprise WordPress; book an infrastructure consult.