본문 바로가기

분류 전체보기

(293)
PostgreSQL - port 5432 already in use (postgresql 다운시 port 5433으로 입력해야할때) 출처:https://dev.to/balt1794/postgresql-port-5432-already-in-use-1pcf PostgreSQL - port 5432 already in use For more content, visit: baltlogs When installing your Postgres database for the first time, one... dev.to 포트 5432에서 이미 실행중인것 터미널에서 확인 후 종료 $ sudo lsof -i :5432 $ sudo pkill -u postgres
pgadmin backup restore 하는 방법 출처:https://baekh-93.tistory.com/26 [PostgreSQL] pgAdmin4을 이용한 DataBase 백업 및 복구하기(DB dump, DB백업,pgAdmin) PostgreSQL 을 백업하는 방법에는 두가지방법이 있다. 첫번째: pgAdmin을 이용하는 방법 (tool) 두번째: cmd창에서 처리하는 방법 오늘은 먼저 pgAdmin을 이용하는 방법에 대해 다뤄볼 것이다(더 쉬움!, cmd baekh-93.tistory.com 1.실제 서버 있음 2. local서버 만들기 : postgres계정으로 전환후 user,db,권한설정 3. 실제 서버 데이터 backup & localserver에 restore 4. 만약 데이터베이스 사용안할시 삭제 : drop 시 에러메시지 발생 (데..
A function whose declared type is neither 'void' nor 'any' must return a value.137 async addPosting(files, req: PostingDto): Promise<CoreOutput> async addPosting(files, req: PostingDto): Promise { const result = new CoreOutput(); [...] } result를 return 해주지 않아서 생기는 오류였다..
entity cascade ManyToOne, OneToMany —> 이 릴레이션은 쌍으로 쓰게 되어 있는데, ManyToOne 데코레이션을 쓰는 쪽에 ForeignKey가 생성된다. 보통 OneToMany 데코를 쓰는 쪽이 부모(주체)가 되고 ManyToOne 데코를 쓰는 쪽이 자식(객체)가 된다. ex) Author(글쓴이): OneToMany , Posting(글): ManyToOne 한 글쓴이는 자신의 아이디로 많은 글을 올릴수 있지만(Posting), 한 포스팅 아이디는 (글을 나눠서 공동으로 쓰지 않는한) 한 글쓴이로 밖에 매핑이 안된다. JoinColumn은 객체쪽에서 지정을 해준다. CASCADE 옵션을 줄때는, 객체 쪽(Posting)에 { onDelete: “CASCADE”}, 주체 쪽(Author)에 {casc..
any를 활용하여 database 내부 value 값이 array 일 때 filtering async searchKeyword(req: KeywordSearchReq): Promise { const result = new PostingKeywordResDto(); result.ok = true; try { if (req.keyword !== undefined) { this.postings.createQueryBuilder('Posting').where(''); //any let searchResul = await this.postings .createQueryBuilder('Postings') .where(`'` + req.keyword + `' = ANY(keyword)`) .getMany(); result.postingList = searchResul; console.log(searchRe..
typeorm update async Function(req:AEntity):Promise{ [....] const checkTrueAwating = await getRepository(BEntity).update( req.questionId, //AEntity의 questionId = BEntity의 id { aWaiting: true }, ); // Function 실행시 AEntity에 수정삽입삭제... 후 // BEntity를 불러와 BEntity내의 key aWating 을 true로 변경 } 참고: https://www.tutorialspoint.com/typeorm/typeorm_working_with_repository.htm
[0]NESTJS typeorm date 타입 날짜 between으로 데이터 찾기 출처: https://www.kindacode.com/snippet/typeorm-selecting-rows-between-2-dates/ import { Between } from "typeorm"; /* Other code */ const userRepository = dataSource.getRepository(User); const users = await userRepository.find({ where: { createdAt: Between( new Date(2019, 5, 3), new Date(2022, 5, 3) ), } }) console.log(users);
[0]nestjs typeorm OR, AND 참고: https://orkhan.gitbook.io/typeorm/docs/find-options //AND 연산 userRepository.find({ where: { firstName: "Timber", lastName: "Saw" } }); //OR 연산 userRepository.find({ where: [ { firstName: "Timber", lastName: "Saw" }, { firstName: "Stan", lastName: "Lee" }, ], });