Skip to content
This repository was archived by the owner on Sep 18, 2026. It is now read-only.
This repository was archived by the owner on Sep 18, 2026. It is now read-only.

Schema: Change type column to NOT NULL with default '' #12

Closed as not planned

Description

@josephfusco

Our type column is nullable but core's is NOT NULL.

Current:

type varchar(20) DEFAULT NULL

Core (PR #11256):

type varchar(32) NOT NULL default ''

Why we made it nullable:
We tried to store awareness (type='awareness', one per room) and updates (type=NULL, many per room) in the same table using MySQL's UNIQUE constraint quirk (allows multiple NULL values).

Why core doesn't:
Core uses specific type values for all operations:

  • update - regular CRDT update
  • sync_step1 - sync initialization
  • sync_step2 - sync response
  • compaction - compacted state

No NULL types exist in core's design.

Fix:

type varchar(32) NOT NULL default ''

Migration consideration:
Our current NULL rows were a workaround for storing updates and awareness together. With Presence API handling awareness separately, all rows should have explicit types.

Reference: WordPress/wordpress-develop#11256

Activity

  1. josephfusco commented on Aug 17, 2026

    @josephfusco
    CollaboratorAuthor

    Core's type column distinguishes awareness (type='awareness') from CRDT updates (type='update'). We use type IS NULL because we ONLY store CRDT updates (awareness lives in wp_presence).

    The NULL design avoids string comparisons and reserves the column for future expansion if needed.

    Decision: Keep type varchar(20) DEFAULT NULL as-is. Core's NOT NULL default '' serves a different storage model.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions