How can set composite unique constraint ?
e.g. I have class
@Table
class SomeTable {
...
id: number;
...
otherId: number;
...
something: string;
}
and I want to have unique(otherId, something).
Hey @tomislavhren , you can achieve this like so:
const SOME_UNIQUE_KEY = 'test';
@Table
class SomeTable {
@Column({unique: SOME_UNIQUE_KEY})
otherId: number;
@Column({unique: SOME_UNIQUE_KEY})
something: string;
}
Most helpful comment
Hey @tomislavhren , you can achieve this like so: