BUG: Fix SQL schema issues (USER-DEFINED, FK order, duplicate blocks, triggers) + missing SUPABASE_JWT_SECRET in .env.example
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 45/100
调研方向
首先在 Supabase 或本地 PostgreSQL 实例中运行提供的 SQL schema,并检查 schema 定义、表顺序、重复的提案和触发器块、GRANT 以及 .env.example。完成标准是:schema 应用时没有 SQL 或权限错误,重复定义已移除,外键能够解析,并且存在 SUPABASE_JWT_SECRET。
由索引模型根据 Issue 内容生成。
描述
Is there an existing issue for this?
- I have searched the existing issues
What happened?
📌 Issue Overview
While setting up the project locally, several schema-related issues cause SQL migrations to fail and the local environment to become unusable without manual fixes. In addition, one required environment variable (SUPABASE_JWT_SECRET) is missing from .env.example.
This makes the project difficult to set up for contributors.
🔍 Steps to Reproduce
- Clone the repository
- Run the provided SQL schema in Supabase or a local PostgreSQL instance
- Attempt to run the app using .env.example
- Observe multiple SQL errors and a runtime permission error
🎯 Expected Behavior
- Schema should apply cleanly without manual corrections
- No duplicate table or trigger definitions
- Foreign key references should resolve in proper order
- Enum types should be valid PostgreSQL types
.env.exampleshould include all required variables- Local environment should work without “permission denied” errors
🚨 Actual Behavior
- Invalid Enum Type Usage**
Several tables use this invalid syntax:
status USER-DEFINED DEFAULT 'value'::some_enum
This causes:
ERROR: syntax error at or near "USER"
2. Duplicate Table / Trigger Definitions
-
proposalstable is defined twice -
update_proposals_updated_atfunction + trigger are defined twice
Causes:
ERROR: trigger "update_proposals_updated_at" already exists
3. Incorrect Table Creation Order
Some tables reference others before they exist. Example:
FOREIGN KEY (user_id) REFERENCES public.profiles(id)
but public.profiles is created later.
Causes:
ERROR: relation "public.profiles" does not exist
4. Permission Errors After Schema Load
After migrations succeed, creating a profile fails with:
permission denied for schema public
GRANT statements appear to be missing for anon, authenticated, and service_role.
5. Missing Required Env Variable
.env.example is missing:
SUPABASE_JWT_SECRET=
This prevents the local app from running correctly.
📷 Screenshot
(Not included here, but can be added if maintainers want visual logs.)
💡 Suggested Improvements
-
Replace all
USER-DEFINEDplaceholders with the actual enum types (application_status,invite_status,payment_status,deal_status). -
Remove duplicate
proposalstable + duplicate trigger/function definitions. -
Reorder tables so referenced tables exist before foreign keys are applied.
-
Add missing permissions back to the schema setup:
GRANT USAGE ON SCHEMA public TO anon, authenticated, service_role; GRANT ALL ON ALL TABLES IN SCHEMA public TO service_role; -
Add missing variable to
.env.example:SUPABASE_JWT_SECRET=
I’m willing to submit a PR addressing these issues.
Record
- I agree to follow this project's Code of Conduct
- I want to work on this issue
- 主要语言
- TypeScript
- 星标
- 102
- 派生
- 144
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
我们还没有检查这个项目的环境配置文件。先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
AOSSIE-Org/InPactAI 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 68/100
AOSSIE-Org/InPactAI#218 ·
-
难度 1/5 1 小时以内 新手友好度 68/100
AOSSIE-Org/InPactAI#201 ·
-
难度 5/5 一周以上 新手友好度 42/100
AOSSIE-Org/InPactAI#314 ·
-
难度 5/5 一周以上 新手友好度 35/100
AOSSIE-Org/InPactAI#312 ·
-
难度 4/5 3-5 天 新手友好度 50/100
AOSSIE-Org/InPactAI#307 · 2 条评论 ·
查看 AOSSIE-Org/InPactAI 的全部 Issue
相似的 Issue
-
priority: P2
难度 2/5 1-3 小时 新手友好度 78/100
-
难度 2/5 1-3 小时 新手友好度 65/100
prime-radiant-inc/evener#3291 ·
维护者通常 1 天内回复
-
accessibility bug revealjs
难度 2/5 1-3 小时 新手友好度 84/100
quarto-dev/quarto-cli#14961 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 90/100
supabase/agent-skills#614 ·
-
Content
难度 2/5 1-3 小时 新手友好度 68/100
RunestoneInteractive/rs#1559 · 1 条评论 ·
维护者通常 2 天内回复