What is Schema?

Schema is a class that maps to a database table. You can create an schema by defining a new class and mark it with @Schema

/* ./schemas/photo.ts */
import { Schema, Column, Unique, Default } from 'nexorm/decorators';

@Schema
class PhotoSchema {

@Column
@Unique
static photoId = String;

@Column
static photo = Buffer;

@Column
@Default(new Date())
static date = Date;

};

This will create following database table:

Each schema must be registered in your model:

Last updated