deepkit-framework
deepkit-framework copied to clipboard
[Feature Suggestion] "version" special Type
I should be able to describe a property as type version in which case the ORM will auto-increment the property on every DB write starting with 1.
You can do this yourself by subscribing to database events. You would want to subscribe to the onPatchPre query event and the onUpdatePre unit of work event.
You can create your own type type Version = number & Data<'version', true> and then use the reflection API to autoincrement columns with that type.
Then you can use it like this
interface BlogPost {
title: string;
createDate: Date;
updateDate: Date;
version: Version = 1;
}