Open rhodri opened 8 years ago
I whole heartedly agree. There are other problems with the current enum situation - namely that once created they can be difficult to change or drop.
I use a different approach alltogether:
var THINGS = ['cat', 'dog'];
# properties
thing: { type: 'text', defaultValue: 'cat', required: true }
# validations
thing: orm.validators.insideList(THINGS, "Invalid thing")
It's much easier to work with and I don't have so many columns in the table for space to be a problem.
When using the sqlite driver:
I realise that enum types are not available in SQLite – but surely the ORM should be verifying it, not the driver!