spotorm / spot2

Spot v2.x DataMapper built on top of Doctrine's Database Abstraction Layer
http://phpdatamapper.com
BSD 3-Clause "New" or "Revised" License
601 stars 101 forks source link

Multiple compound unique index support #207

Closed FlipEverything closed 7 years ago

FlipEverything commented 7 years ago

@splio-aleroux added multiple compound index support, but forgot to enable it on unique indexes.

vlucas commented 7 years ago

Thanks for this. 👍

FlipEverything commented 7 years ago

I happen to run into some difficulties with this PR. The migration() works perfectly, it creates the expected SQL expression like this: UNIQUE KEY `key_name` (`col1`, `col2`).

But the validation doesn't seem to "understand" that kind of unique constraint. The validation fails as like the individual column was unique. Like col1 is unique and col2 is unique, not col1 and col2 is unique together.

I'll look into this issue later. Could somebody provide some feedback regarding this issue or is it just me?

splio-aleroux commented 7 years ago

Indeed, i haven't used this for unique index.