Create a model

Create a model

Working with a database starts from creating tables.How do you tell TypeORM to create a database table?The answer is - through the models.Your models in your app are your database tables.

For example, you have a Photo model:

export class Photo {
    id: number;
    name: string;
    description: string;
    filename: string;
    views: number;
    isPublished: boolean;
}

And you want to store photos in your database.To store things in the database, first you need a database table,and database tables are created from your models.Not all models, but only those you define as entities.