dresende / node-orm2

Object Relational Mapping
http://github.com/dresende/node-orm2
MIT License
3.07k stars 376 forks source link

Unique constraint #815

Open xahon opened 6 years ago

xahon commented 6 years ago

Is it possible to define field of table as unique?

{ type: '', key: true } is buggy

Using { type: 'text', key: true } and ...createAsync({ name: 'Ilya' }) it throws

(node:21380) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: ER_TRUNCATED_WRONG_VALUE_FOR_FIELD: Incorrect integer value: 'Ilya' for column 'name' at row 1