티스토리 뷰
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
Entities - typeorm
int, int2, int4, int8, smallint, integer, bigint, decimal, numeric, real, float, float4, float8, double precision, money, character varying, varchar, character, char, text, citext, hstore, bytea, bit, varbit, bit varying, timetz, timestamptz, timestamp, ti
orkhan.gitbook.io
- decimal number field
@Entity({ name: 'weathers' })
export class Weathers {
// mysql 데이터베이스에서 tempCelsius의 타입을 float 으로 지정
@Column({ type: 'float', name: 'tempCelsius', comment: '섭씨온도' })
tempCelsius: number;
}
Entities - typeorm
int, int2, int4, int8, smallint, integer, bigint, decimal, numeric, real, float, float4, float8, double precision, money, character varying, varchar, character, char, text, citext, hstore, bytea, bit, varbit, bit varying, timetz, timestamptz, timestamp, ti
orkhan.gitbook.io
How to properly handle decimals with TypeORM
JavaScript does not natively have a decimal type, so it will natively handle all decimals as floating points. This will create floating…
medium.com
- typeorm + mysql : 문자열길이 제한 변경
[MySQL] TypeORM String 타입 사용 시 문자열 길이 제한 변경
DB를 기존에 사용하던 PostgreSQL에서 MySQL로 변경하고 나서 동일한 Entity의 String 타입으로 지정된 칼럼의 문자열 길이가 공백 포함 255자 이상은 저장되지 않는 이슈가 생겼다. 기존 Entity는 Id, 생성
eight20.tistory.com
Typeorm 엔티티 데코레이션
https://yangeok.github.io/orm/2020/12/14/typeorm-decorators.html
Yangeok
Yangwook Ian Jeongs' Development Blog
yangeok.github.io
'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
- 클린아키텍쳐
- nestjs
- IT용어
- 참고
- 미완
- TypeScript
- Mongoose
- 개발용어
- 디지털디톡스
- MySQL
- MongoDB
- 한달독서
- node.js
- 스마트폰중독
- nestjs jest
- jest
- 바이트디그리
- vscode
- git
- 나도 할 수 있다
- 한달어스
- RDBMS
- gem
- Nest.js
- typeORM
- TDD
- 갓생살자
- 습관개선
- OS
- Jekyll
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |