全书目录

第四十八篇:Supabase 完全指南 —— 开源数据港口宇宙

第五章:Postgres —— 港口主航道,所有船都要围着它进出

1 分钟 345 字 第 892 / 962 个阅读单元

Supabase 的核心底盘就是 PostgreSQL。

这不是“顺便用了个数据库”,而是整个港口的主航道。

你在这里能自然使用很多传统数据库世界的能力:

  • schema
  • table
  • view
  • index
  • foreign key
  • function
  • trigger
  • extension
  • SQL migration

一个最小建表示例:

sql
create table public.projects (
  id uuid primary key default gen_random_uuid(),
  owner_id uuid not null references auth.users(id) on delete cascade,
  name text not null,
  status text not null default 'draft',
  created_at timestamptz not null default now()
);

这张表在 Supabase 的语境里,不是“孤立的数据结构”。

它会继续和这些东西联动:

  • auth.users
  • RLS policy
  • auto-generated API
  • Realtime change feed
  • Edge Functions
  • Dashboard / Studio

所以这座港口的第一条学习路线不是 SDK,而是:

你能不能把数据航道设计清楚。