티스토리 뷰
728x90
반응형
database: mysql
- 엔티티 컬럼 길이 조정
export class Posts {
@PrimaryGeneratedColumn({
type: 'int',
name: 'postId',
comment: '게시글 아이디'
})
postId: number;
// 글자수 20자 제한
@Column({ name: 'title', length: 20, comment:'게시글 제목' })
title: string;
// 글자수 200자 제한
@Column({ name: 'content', length: 200, comment: '게시글 본문' })
content: string;
}
https://orkhan.gitbook.io/typeorm/docs/entities
- decimal number field
@Entity({ name: 'weathers' })
export class Weathers {
// mysql 데이터베이스에서 tempCelsius의 타입을 float 으로 지정
@Column({ type: 'float', name: 'tempCelsius', comment: '섭씨온도' })
tempCelsius: number;
}
- typeorm + mysql : 문자열길이 제한 변경
Typeorm 엔티티 데코레이션
https://yangeok.github.io/orm/2020/12/14/typeorm-decorators.html
728x90
반응형
'Backend > 꾸준히 TIL' 카테고리의 다른 글
[Jest+NestJS] Jest 테스트 환경세팅 (0) | 2022.11.05 |
---|---|
[NestJS + regex] 정규표현식 활용하기 (0) | 2022.11.05 |
[에러 해결] Cannot find module bcrypt_lib.node (0) | 2022.11.05 |
[NestJS + Typescript ] URL 깨짐 원인과 typeorm where in (1) | 2022.11.04 |
[nestJs + typeorm] 날짜데이터를 insert 하기 (0) | 2022.11.03 |
반응형
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- Nest.js
- 스마트폰중독
- 한달어스
- 디지털디톡스
- Jekyll
- 나도 할 수 있다
- Mongoose
- 클린아키텍쳐
- MySQL
- 한달독서
- nestjs
- 참고
- IT용어
- node.js
- 갓생살자
- 미완
- OS
- MongoDB
- RDBMS
- 개발용어
- TypeScript
- TDD
- 바이트디그리
- git
- nestjs jest
- gem
- jest
- vscode
- typeORM
- 습관개선
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
글 보관함