sev-2 / raiden

A Framework for Supabase
MIT License
24 stars 2 forks source link

Auto index foreign key #74

Open vani-rf opened 2 months ago

vani-rf commented 2 months ago

Problem

I'm facing performance issues in Supabase, where foreign keys are not automatically indexed. This causes some queries to be inefficient, particularly when working with large datasets. Supabase's performance editor highlights this as a key optimization concern, and I have to manually create indexes for foreign keys, which is not ideal for scalability or developer experience.

Solution

I would like Raiden to automatically create indexes on foreign key columns when models are applied to Supabase. This feature should ensure that whenever a foreign key is added, the corresponding index is automatically generated, improving query performance without manual intervention.

toopay commented 1 month ago

Also add the foreign key options (both in cloud and local drivers) for on delete/on update.

toopay commented 1 month ago

@vani-rf It seems the feature is able to generate the model, but after updating the tag, it still tries to generate the same tag (see screenshot). It looks like this needs to be revisited, especially the part that compares the differences—because there is no difference here, yet it keeps showing as if there is.

Screenshot 2024-10-22 at 20 35 46