Skip to content

[orm] Migrate validator constraints to SQL schemas #125

@marcj

Description

@marcj

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)
    )

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions