0018.4 TypeORM ๐พ
- 0018 Javascript โ๏ธ
- ๊ณต์๋ฌธ์
- sequelize, a MySQL ORM for javascript
- https://docs.nestjs.com/techniques/database
README#
sequalize์์ ์ฐจ์ด์ ์์ฃผ๋ก CRUD, ์ํฐํฐ, repository, relation ์์ฃผ๋ก ๋น ๋ฅด๊ฒ ์ ๋ฆฌํ๊ฒ ์ต๋๋ค.
๋์ฌ๊ฒจ ๋ณผ๋งํ ์ฃผ์ ๋ค
- entities & columns
- entity manager?
- repository
- associations (relations)
- eager & lazy relations
- cascades
ํบ์๋ณด๊ธฐ...#
And your domain logic looks like this:
const userRepository = MyDataSource.getRepository(User);
const user = new User();
user.firstName = "Timber";
user.lastName = "Saw";
user.age = 25;
await userRepository.save(user);
const allUsers = await userRepository.find();
const firstUser = await userRepository.findOneBy({
id: 1,
});
const timber = await userRepository.fineOneBy({
firstName: "Timber",
lastName: "Saw",
});
timber.age = 26;
await userRepository.save(timber);
const [users, userCount] = await userRepository.findAndCount();
await userRepository.remove(timber);
- Column Types {typeorm}
- DataSource {typeorm}
- EntityManager {typeorm}
- Repository {typeorm}
- JoinColumn options {typeorm}
- save related entities only with PK {typeorm}
- save both relations {typeorm}
- cascade option {typeorm}
- Bidirectional relationships using inverse relation {typeorm}
๋ ์์๋ณด๊ธฐ#
- find options {typeorm}
- Migrations
- DateColumn Decorators {typeorm}
- enum column type {typeorm}
- Validation {typeorm}
- typeorm ์ฐ๊ด ์ปฌ๋ผ์ ๊ฐ์ฒด๊ฐ ์๋๋ผ id number๋ก ๋ถ๋ฌ์ค๊ธฐ
- indexing
postgresql#
- EC2 Postgresql์ ์ฅ๊ณ ๊ธฐ๋ณธ ๋ฐ์ดํฐ๋ฒ ์ด์ค๋ก ํ์ฉํ๊ธฐ โถ ์๋ ์ฅ๊ณ ์ฌ์ฉํ๋ฉด์ ๊ฒช์๋ ๊ฐ๊ณ ์ ๋ชจ์๋์ ๋ฌธ์
- postgresql on docker ๋จ์ ๋ช ๋ น์ด ๋ชจ์
- rds postgresql ssl ์ธ์ฆ์ ๋ฐ๊ธํ์ฌ ์ ์ํ๊ธฐ