deepkit-framework
deepkit-framework copied to clipboard
[orm] Migrate validator constraints to SQL schemas
When having an entity like
interface User {
id: number & PrimaryKey & AutoIncrement;
username: string & MinLength<3>;
}
then the generated SQL should contain the minLength and other supported constraints
CREATE TABLE `user` (
`id` double NOT NULL AUTO_INCREMENT,
`username` longtext NOT NULL,
PRIMARY KEY (`id`),
CONSTRAINT username_minLength CHECK (LENGTH(username) >= 3)
)