codestates / codestates/Cogether

[❓에러 핸들링 ] 박세희 / 2021-10-26 / throw new Error(A column called 'id' was added to the attributes of '${this.tableName}' but not marked with 'primaryKey: true');

Open
#29 0 comments 0 reactions 1 assignee Claimed by @Sehee-Park-93 View on GitHub
Back-End Error
Dominant language
JavaScript
Stars
3
Forks
2
PR merge metrics
No merged PRs in 30d

Description

## **어떤 에러가 발생했나요?**

`throw new Error(A column called 'id' was added to the attributes of '${this.tableName}' but not marked with 'primaryKey: true');`

## **에러 핸들링 방법**

`id: {
type: DataTypes.INTEGER,
primaryKey: true,
},`

## **에러 설명 및 해결 과정 설명**

Sequelize-cli로 모델 생성시 따로 특정 column이 필요하지 않아,
id 를 추가했었는데, 이 때 에러에서 설명하는 primaryKey : true 라는 속성을 주지 않아 발생했다.
에러를 구글링 하여 모델을 정의해주는 부분에 해당 속성을 지정해주는 코드를 입력 후 해결하였다.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.