Skip to content

prefer-jsonb

JSON column type or table-DDL cast — use JSONB.

Why

JSONB supports indexing and containment operators and avoids reparsing the stored document on every read.

Fix

Declare JSONB columns and use jsonb casts for JSON document values.

Examples

Before — flagged Plain JSON column
supabase/migrations/001_documents.sql
CREATE TABLE document (metadata JSON NOT NULL);
After — preferred Indexable JSONB column
supabase/migrations/001_documents.sql
CREATE TABLE document (metadata JSONB NOT NULL DEFAULT '{}'::jsonb);