Skip to content

Conversation

@shoaib-31
Copy link

Closes #191

📝 Description

This PR fixes several issues in the local setup flow caused by schema and configuration problems.

Currently, applying the provided SQL schema leads to enum syntax errors, duplicate table/trigger definitions, foreign key constraint failures due to table order, and missing permissions. In addition, the local app fails to run because a required environment variable (SUPABASE_JWT_SECRET) is not present in .env.example.

These changes ensure that:

  • The database schema can be applied cleanly.
  • Migrations are deterministic and free of duplicate definitions.
  • Foreign keys reference tables that already exist.
  • Required roles have the correct permissions.
  • The example environment file contains all required variables for running the app locally.

🔧 Changes Made

  • Replaced USER-DEFINED enum placeholders with the correct PostgreSQL enum types:
    • application_status
    • invite_status
    • payment_status
    • deal_status
  • Fixed invalid enum default syntax by using proper enum casting, e.g.:
    • status application_status DEFAULT 'value'::application_status
  • Removed duplicate proposals table definition.
  • Removed duplicate update_proposals_updated_at function and trigger definitions.
  • Reordered table creation statements so that:
    • All referenced tables (e.g. public.profiles) are created before any foreign keys referencing them.
  • Added missing permissions to avoid permission denied for schema public errors:
    • GRANT USAGE ON SCHEMA public TO anon, authenticated, service_role;
    • GRANT ALL ON ALL TABLES IN SCHEMA public TO service_role;
  • Updated .env.example to include the required variable:
    • SUPABASE_JWT_SECRET=
  • Performed a fresh local setup to verify that:
    • The schema applies without errors.
    • The app can run locally with the updated .env.example.
    • No “permission denied” errors occur when creating profiles.

📷 Screenshots or Visual Changes (if applicable)

N/A – This PR only affects backend schema and configuration. No UI changes.

✅ Checklist

  • I have read the contributing guidelines.
  • I have added tests that prove my fix is effective or that my feature works (where applicable).
  • I have added necessary documentation (if applicable).
  • Any dependent changes have been merged and published in downstream modules.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 21, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

📝 Customizable high-level summaries are now available in beta!

You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.

  • Provide your own instructions using the high_level_summary_instructions setting.
  • Format the summary however you like (bullet lists, tables, multi-section layouts, contributor stats, etc.).
  • Use high_level_summary_in_walkthrough to move the summary from the description to the walkthrough section.

Example instruction:

"Divide the high-level summary into five sections:

  1. 📝 Description — Summarize the main change in 50–60 words, explaining what was done.
  2. 📓 References — List relevant issues, discussions, documentation, or related PRs.
  3. 📦 Dependencies & Requirements — Mention any new/updated dependencies, environment variable changes, or configuration updates.
  4. 📊 Contributor Summary — Include a Markdown table showing contributions:
    | Contributor | Lines Added | Lines Removed | Files Changed |
  5. ✔️ Additional Notes — Add any extra reviewer context.
    Keep each section concise (under 200 words) and use bullet or numbered lists for clarity."

Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant