让项目连接到 supabase
文件夹supabase-starter
文件夹public/
- …
- README.md
文件夹supabase add supabase folder to your project
- seed.sql empty file
文件夹migrations
- 20250419080529_init.sql empty file
- package.json
- tailwind.config.ts
添加 supabase 库
Section titled “添加 supabase 库”{ "name": "supabase-starter", "version": "0.1.0", "private": true, "scripts": {6 collapsed lines
"dev": "next dev --turbo", "build": "next build", "start": "next start", "lint": "next lint", "type-check": "tsc --noEmit", "check-all": "npm run lint && npm run type-check" }, "dependencies": {4 collapsed lines
"next": "14.2.23", "react": "^18", "react-dom": "^18", "resend": "^4.3.0" }, "devDependencies": { "@types/node": "^20", "@types/react": "^18", "@types/react-dom": "^18", "eslint": "^8", "eslint-config-next": "14.2.23", "postcss": "^8", "supabase": "^2.20.12", "tailwindcss": "^3.4.1", "typescript": "^5" }}
连接到 supabase
Section titled “连接到 supabase”-
登录到 supabase
在终端执行命令,按回车。这将打开一个浏览器窗口,并带你到 supabase 登录页面。复制生成的代码,粘贴到终端并按回车。
Terminal window npx supabase login -
初始化 supabase
Terminal window npx supabase init -
连接到 supabase
Terminal window npx supabase link --project-ref <project_id> --password <db_password> -
运行迁移
Terminal window npx supabase migration up --linked -
重置数据库
Terminal window npx supabase db reset --linked