moigagoo / norm

A Nim ORM for SQLite and Postgres
https://norm.nim.town
MIT License
378 stars 34 forks source link

Make creating indices idempotent #203

Closed maxtidev closed 1 week ago

maxtidev commented 1 week ago

This fixes the DbError that occurs when Norm attempts to create an index that already exists in the database.
Using indices was impossible for some database schemas as the recursive nature of createTables can lead to the same Model being processed multiple times. This is no problem for relations that already exist but it causes an uncircumventable DbError for already existing indices.