Step-by-Step Guide
What are you expecting from ORM? First of all, you are expecting it will create database tables for you and find / insert / update / delete your data without the pain of having to write lots of hardly maintainable SQL queries. This guide will show you how to setup TypeORM from scratch and make it do what you are expecting from an ORM.
- Create a model
- Create an entity
- Adding table columns
- Creating a primary column
- Creating an auto generated column
- Column data types
- Creating a connection to the database
- Loading all entities from the directory
- Running the application
- Creating and inserting a photo into the database
- Using async/await syntax
- Using Entity Manager
- Using Repositories
- Loading from the database
- Updating in the database
- Removing from the database
- Creating a one-to-one relation
- Save a one-to-one relation
- Inverse side of the relationship
- Loading objects with their relations
- Using cascades to automatically save related objects
- Creating a many-to-one / one-to-many relation
- Creating a many-to-many relation
- Using QueryBuilder