Skip to content
This repository was archived by the owner on Dec 14, 2025. It is now read-only.

refactor: migrate to a new template-based database generation system - #12

Open
teetangh wants to merge 2 commits into
devfrom
fix/rls-policies-1
Open

refactor: migrate to a new template-based database generation system#12
teetangh wants to merge 2 commits into
devfrom
fix/rls-policies-1

Conversation

@teetangh

Copy link
Copy Markdown
Contributor
  • Removed legacy database generation scripts and replaced them with a new template-based approach for generating RLS policies and database triggers.
  • Introduced separate generators for policies and triggers, enhancing maintainability and organization.
  • Updated README and documentation to reflect the new structure and usage instructions.
  • Ensured all SQL content is now organized in reusable templates for better clarity and collaboration.

- Removed legacy database generation scripts and replaced them with a new template-based approach for generating RLS policies and database triggers.
- Introduced separate generators for policies and triggers, enhancing maintainability and organization.
- Updated README and documentation to reflect the new structure and usage instructions.
- Ensured all SQL content is now organized in reusable templates for better clarity and collaboration.
@gemini-code-assist

Copy link
Copy Markdown

Summary of Changes

Hello @teetangh, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly refactors the database generation process by introducing a new template-based system. This change aims to improve the maintainability, organization, and clarity of RLS policies and database triggers. By separating generation logic from SQL content and utilizing reusable templates, the system becomes more robust and easier to manage, while also removing outdated legacy scripts.

Highlights

  • Database Generation Refactor: The entire database generation system has been migrated to a new template-based approach, replacing legacy scripts for RLS policies and database triggers.
  • Separated Generators: Policy and trigger generation logic is now handled by distinct, dedicated generator classes (PolicyGenerator and TriggerGenerator), improving modularity and maintainability.
  • Template-Driven SQL: All SQL content for policies and triggers is now managed through reusable templates, enhancing clarity, collaboration, and ease of modification.
  • Legacy Code Removal: Obsolete database generation scripts and associated documentation from the scripts/supabase/legacy directory have been removed.
  • Enhanced Policy Dropping: The policy generator now includes expanded logic to drop a wider range of policy naming patterns, ensuring cleaner policy re-application.
  • Schema Grants Added: A new schema_grants.sql template has been introduced to explicitly grant necessary schema and table permissions to anon and authenticated roles, preventing common permission errors.
  • Updated App Naming: References to 'Familiarise App' in comments and descriptions have been updated to 'Elluminar App'.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This is a great refactoring that significantly improves the database generation process by migrating to a template-based system. The separation of concerns between Dart logic and SQL templates enhances maintainability and clarity. The removal of legacy scripts and the addition of comprehensive schema grants are excellent improvements. I've found one area with some code duplication that could be addressed to fully align with the new template-based approach.

- Introduced a new SQL policy to allow anonymous users to access consultant names and images for discovery purposes.
- Updated the policy generation logic to include the new public profile read policy specifically for the User model.
- Ensured existing policies are dropped before new ones are created for better management.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant