moigagoo / norm

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

column index pragma #180

Closed hamidb80 closed 1 year ago

hamidb80 commented 1 year ago

Hey, IMO it's very good to index columns just like {.unique.} pragma.

  User = ref object of Model
    email {.index.}: string
moigagoo commented 1 year ago

Implementation for SQLite is ready. Need to do the Postgres one and update the docs.

moigagoo commented 1 year ago

Implementation is ready for both SQLite and Postgres.

Two new pragmas are being introduced: index and uniqueIndex. Both pragmas accept a string value. Fields with the same pragma value are included in the same index.

Somehow the book fails to build now even though I didn't change anything. Nimibook got updated probably. I'll fix that and make a release.

hamidb80 commented 1 year ago

Thanks man

moigagoo commented 1 year ago

Too early :-) The tests must pass first.

moigagoo commented 1 year ago

Added in 2.6.1: https://norm.nim.town/changelog.html