Skip to content

Custom column annotation

ArteMerlow edited this page May 28, 2025 · 1 revision

Custom column annotation

Today, we have already covered the AutoIncrementId annotation. It is a column annotation. However, you can also create your own annotations with custom behavior:

export const BooleanColumn = ColumnAnnotationFabric.create({
    type: ColumnType.BOOLEAN,
    notNull: true
})

Or this:

export const BooleanColumn = ColumnAnnotationFabric.create(DefaultColumn.BOOLEAN)

It is worth noting that if you create annotations as constants rather than functions (including arrow functions), you don't need to add parentheses when using them. However, if your annotation accepts a value (even an optional one), you must use it with parentheses after the name.

Clone this wiki locally