supabase

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Supabase Skill

Supabase 操作指南

Use the
supabase
CLI to manage Supabase projects and local development.
使用
supabase
CLI管理Supabase项目与本地开发。

Projects

项目管理

List all projects:
bash
supabase projects list
Link to a remote project:
bash
supabase link --project-ref <project-id>
列出所有项目:
bash
supabase projects list
关联远程项目:
bash
supabase link --project-ref <project-id>

Local Development

本地开发

Start local Supabase stack (Postgres, Auth, Storage, etc.):
bash
supabase start
Stop local stack:
bash
supabase stop
Check status of local services:
bash
supabase status
启动本地Supabase栈(Postgres、Auth、Storage等):
bash
supabase start
停止本地栈:
bash
supabase stop
检查本地服务状态:
bash
supabase status

Database

数据库

Run SQL query:
bash
supabase db execute --sql "SELECT * FROM users LIMIT 10"
Pull remote schema to local:
bash
supabase db pull
Push local migrations to remote:
bash
supabase db push
Reset local database:
bash
supabase db reset
Diff local vs remote schema:
bash
supabase db diff
运行SQL查询:
bash
supabase db execute --sql "SELECT * FROM users LIMIT 10"
拉取远程架构到本地:
bash
supabase db pull
推送本地迁移到远程:
bash
supabase db push
重置本地数据库:
bash
supabase db reset
对比本地与远程架构差异:
bash
supabase db diff

Migrations

迁移管理

Create a new migration:
bash
supabase migration new <migration-name>
List migrations:
bash
supabase migration list
Apply migrations locally:
bash
supabase migration up
Squash migrations:
bash
supabase migration squash
创建新的迁移:
bash
supabase migration new <migration-name>
列出迁移:
bash
supabase migration list
在本地应用迁移:
bash
supabase migration up
合并迁移:
bash
supabase migration squash

Edge Functions

Edge Functions

List functions:
bash
supabase functions list
Create a new function:
bash
supabase functions new <function-name>
Deploy a function:
bash
supabase functions deploy <function-name>
Deploy all functions:
bash
supabase functions deploy
Serve functions locally:
bash
supabase functions serve
View function logs:
bash
supabase functions logs <function-name>
列出函数:
bash
supabase functions list
创建新函数:
bash
supabase functions new <function-name>
部署函数:
bash
supabase functions deploy <function-name>
部署所有函数:
bash
supabase functions deploy
在本地运行函数:
bash
supabase functions serve
查看函数日志:
bash
supabase functions logs <function-name>

Storage

存储管理

List buckets:
bash
supabase storage ls
List objects in a bucket:
bash
supabase storage ls <bucket-name>
Copy file to storage:
bash
supabase storage cp <local-path> ss:///<bucket>/<path>
Download from storage:
bash
supabase storage cp ss:///<bucket>/<path> <local-path>
列出存储桶:
bash
supabase storage ls
列出存储桶中的对象:
bash
supabase storage ls <bucket-name>
复制文件到存储:
bash
supabase storage cp <local-path> ss:///<bucket>/<path>
从存储下载文件:
bash
supabase storage cp ss:///<bucket>/<path> <local-path>

Secrets

密钥管理

Set a secret for Edge Functions:
bash
supabase secrets set <NAME>=<value>
List secrets:
bash
supabase secrets list
Unset a secret:
bash
supabase secrets unset <NAME>
为Edge Functions设置密钥:
bash
supabase secrets set <NAME>=<value>
列出密钥:
bash
supabase secrets list
删除密钥:
bash
supabase secrets unset <NAME>

Type Generation

类型生成

Generate TypeScript types from database schema:
bash
supabase gen types typescript --local > types/supabase.ts
Generate types from remote:
bash
supabase gen types typescript --project-id <project-id> > types/supabase.ts
从数据库架构生成TypeScript类型:
bash
supabase gen types typescript --local > types/supabase.ts
从远程生成类型:
bash
supabase gen types typescript --project-id <project-id> > types/supabase.ts

Authentication

身份验证

Login to Supabase:
bash
supabase login
Check current status:
bash
supabase projects list
登录到Supabase:
bash
supabase login
检查当前状态:
bash
supabase projects list