BUG: Fix SQL schema issues (USER-DEFINED, FK order, duplicate blocks, triggers) + missing SUPABASE_JWT_SECRET in .env.example
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 45/100
Hướng nghiên cứu
Bắt đầu bằng cách chạy schema SQL được cung cấp trong Supabase hoặc một phiên bản PostgreSQL cục bộ, rồi kiểm tra các định nghĩa schema, thứ tự bảng, các đề xuất trùng lặp và các khối trigger, các GRANT cũng như .env.example. Được xem là hoàn tất khi schema được áp dụng mà không có lỗi SQL hoặc lỗi quyền, các định nghĩa trùng lặp đã được xóa, các khóa ngoại được phân giải và SUPABASE_JWT_SECRET hiện diện.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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
- Ngôn ngữ chính
- TypeScript
- Star
- 102
- Fork
- 144
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Chúng tôi chưa kiểm tra các tệp thiết lập môi trường của dự án này. Hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của AOSSIE-Org/InPactAI
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
AOSSIE-Org/InPactAI#218 ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 68/100
AOSSIE-Org/InPactAI#201 ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 42/100
AOSSIE-Org/InPactAI#314 ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
AOSSIE-Org/InPactAI#312 ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 50/100
AOSSIE-Org/InPactAI#307 · 2 bình luận ·
Tất cả issue của AOSSIE-Org/InPactAI
Issue tương tự
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 88/100
supabase/agent-skills#611 ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 68/100
polka-codes/test#345 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 92/100
GoogleChromeLabs/project-sesame#217 ·
Maintainer thường phản hồi trong vòng 12 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
solana-foundation/solana-com#2202 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100