You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Postgres does not create indexes on columns with a foreign key. They have to be created manually. Our ColumnCheck for a FK usually looks something like:
My proposal would be for that format throw an exception for "Foreign key has not specified an index." The new correct options would be:
# When an index existsColumnCheck('space_id', fk='space_spaces.id', required=True, index='ix_categories_space_id')
# When you specifically don't want an index for some reasonColumnCheck('space_id', fk='space_spaces.id', required=True, index=False)
This at least makes it explicit.
We could query the tables indexes and see if any index has the same column/name as the FK column as it's first column, but I think explicit/manual might be better here? Actually make the dev think about what they want to do with the indexes.
The text was updated successfully, but these errors were encountered:
Postgres does not create indexes on columns with a foreign key. They have to be created manually. Our
ColumnCheck
for a FK usually looks something like:My proposal would be for that format throw an exception for "Foreign key has not specified an index." The new correct options would be:
This at least makes it explicit.
We could query the tables indexes and see if any index has the same column/name as the FK column as it's first column, but I think explicit/manual might be better here? Actually make the dev think about what they want to do with the indexes.
The text was updated successfully, but these errors were encountered: