and [CompositeIndex(nameof(CustomerId), nameof(Day), nameof(Server), Unique = true)]
Are equivalent in terms of functionality and are fully interchangeable?
Or it’s better to use the CompositeIndex because the UniqueConstraint just check uniqueness and there’s no related index or it doesn’t act like an index at all?
From what I can find online it seems that there’s an index on a unique constraint (in MySql at least) but I got this on stackoverflow and the multiples answers felt more like opinions (even the accepted answer) than a definitive answer.
[UniqueConstraint] creates a unique RDBMS constraint, whilst [CompositeIndex] creates a composite RDBMS index, adding Unique=true generates a UNIQUE composite index. You’d decide which to use based on whether or not your System would benefit from the existence of this specific composite index, if you’re unsure don’t create it.
These attributes do not have any affect of OrmLite’s behavior at runtime, i.e. they’re only used when OrmLite creates the table.