Database Schema
BuddyLists creates three custom tables on activation, all prefixed with the site table prefix (wp_ by default). The current database version is 1.1, tracked in the buddylists_db_version option, and upgrades run on plugins_loaded when the stored version is older.
{prefix}bp_lists
Section titled “{prefix}bp_lists”Holds the lists themselves.
| Column | Type | Notes |
|---|---|---|
id |
BIGINT UNSIGNED | Primary key, auto increment. |
user_id |
BIGINT UNSIGNED | Owner user ID. Indexed. |
name |
VARCHAR(255) | List name. |
description |
TEXT | Optional. |
slug |
VARCHAR(12) | Unique, indexed. Used in the public URL. |
cover_image |
VARCHAR(255) | Optional cover image URL. |
visibility |
ENUM(‘private’,‘public’) | Defaults to public. Indexed. |
created_at |
DATETIME | Defaults to the current timestamp. |
{prefix}bp_list_members
Section titled “{prefix}bp_list_members”Maps members to lists.
| Column | Type | Notes |
|---|---|---|
id |
BIGINT UNSIGNED | Primary key. |
list_id |
BIGINT UNSIGNED | Foreign key to bp_lists.id, cascade on delete. |
member_id |
BIGINT UNSIGNED | Foreign key to the users table, cascade on delete. Indexed. |
added_at |
DATETIME | Defaults to the current timestamp. |
A unique key unique_membership (list_id, member_id) prevents duplicate memberships.
{prefix}bp_list_relation
Section titled “{prefix}bp_list_relation”Tracks list follows.
| Column | Type | Notes |
|---|---|---|
id |
BIGINT UNSIGNED | Primary key. |
list_id |
BIGINT UNSIGNED | Foreign key to bp_lists.id, cascade on delete. |
follower_id |
BIGINT UNSIGNED | Foreign key to the users table, cascade on delete. Indexed. |
followed_at |
DATETIME | Defaults to the current timestamp. |
A unique key unique_follow (list_id, follower_id) prevents duplicate follows.
Upgrades
Section titled “Upgrades”The upgrade routine adds the unique_membership and unique_follow unique keys to existing installations, removing any duplicate rows first, and normalises the slug column length. It runs only when the stored database version is behind the plugin’s database version.

