TypeORM์ DB relationship์ ์๋์ผ๋ก ์ฒ๋ฆฌํ์ง ๋ชปํจ\-> ๋ฐ๋ก ์๊ตฌํด์ผ๋ง ๊ฐ์ ธ์ฌ ์ ์์id๋ง ๊ฐ์ ธ์ค๋ ๋ฐฉ๋ฒclassํต์งธ๋ก ๊ฐ์ ธ์ค๋ ๋ฐฉ๋ฒ
@RelationId((์ํฐํฐ: ์ํฐํฐํ์ ) =>๋๊ตฌ์ relation id์ธ์ง ๋ช ์)relation์ id๋ฅผ ๋ก๋ ํจEx)https://github.com/typeorm/typeorm/blob/master/docs/decorator-reference.md
์ญ์ ์ ๋ฐ์ดํฐ๋ฒ ์ด์ค์์ ์ข ์์ ์ผ๋ก ์ผ์ด๋ ์ก์ delete types ( Ex - ์ฌ์ง์ ๊ฐ์ง๊ณ ์๋ ์ฃผ์ธ์ ์ญ์ ํ๋ฉด)CASCADE: ์ฐ์์ ์ผ๋ก ์ญ์ ex) ์ฌ์ง๋ค๋ ์ญ์ ๋จSET NULL: null๊ฐ์ผ๋ก ๋ฐ๊ฟex) ์ฌ์ง์ ์ฃผ์ธ ๋ถ๋ถ์ ๊ฐ์ null์ด ๋จnull๊ฐ์ด ๊ฐ
๋ค๋๋ค์ ๊ด๊ณMany-to-many์์๋ @JoinTable()์ด ํ์์ ์ด๋ค. ๋๊ตฐ๋ฐ ์ค ์์ ํ๊ณ ์๋ ์ชฝ์ relation์ ์ถ๊ฐํ๋ฉด ๋๋ค.Ex)https://typeorm.io/
์ผ๋๋ค, ๋ค๋์ผ์ ๊ด๊ณ์๋ฅผ ๋ค์ด, ํ ์ฌ๋์ด ๋ง์ ์ฌ์ง์ ๊ฐ์ง๊ณ ์๋ค.์ฌ๋ ์ชฝ์ด @OneToMany(ํ๋ํ์ , ์ฐ๊ฒฐ๋ ํ๋)์ฌ์ง ์ชฝ์ด @ManyToOne(ํ๋ํ์ , ์ฐ๊ฒฐ๋ ํ๋)Ex)https://typeorm.io/
entity์ ์ด๋ค ์ด๋ฒคํธ๊ฐ ๋ฐ์ํ ๋ ์คํ ๋จ@AfterLoad, @BeforeInsert, @AfterInsert, @BeforeUpdate, @AfterUpdate, @BeforeRemove, @AfterRemove ์กด์ฌhttps://typeorm.io/
entity: ๋ฐ์ดํฐ๋ฒ ์ด์ค์์ ์ ์ฅ๋๋ ๋ฐ์ดํฐ์ ํํ๋ฅผ ๋ณด์ฌ์คtypeorm์ด db์ ์ ์ฅํ๊ฒ ํด์ค์ด์ ๋ง๋ค์ด์คapp.module.ts
postgresql, typeorm setting