Open markstory opened 1 week ago
How do we handle (unique) indexes? Similar?
How do we handle (unique) indexes? Similar?
Yeah I could see a fluent builder object for indexes as well. I'd love to add support for conditional indexes in the future and having a builder would help with that.
Building foreign keys through the
addForeignKey
method requires remembering 4 positional arguments, and the ordering. While it is decent to use when writing migrations it is more reads with more difficulty.Is the current API. We've used up a really good method name with
addForeignKey
and the alternative names I could come up with clunky. What we could do with relative ease though is widen the type on the first parameter ofaddForeignKey
to include a new builder object:While this is more verbose, it is more clear about what is going on, and the API can be well-typed.