2017-04-07 1 views
1

sails-mysql을 사용하여 워터 라인 모델에서 bigint 타입을 어떻게 정의 할 수 있습니까? 그것에 대한 적절한 문서를 찾을 수 없습니다. bigint 타입을 지원하지 않는 것 같아요. 그러나 정말로 필요합니다. 소스 코드를 파헤쳐 보려고 뭔가를 발견했습니다. https://github.com/balderdashy/sails-mysql/blob/987f4674785970951bc52becdfdb479864106da1/helpers/private/schema/build-schema.js#L29 하지만 여전히 작동하지 않습니다.워터 라인 BIGINT 타입 (sails-mysql 포함)

module.exports = { 
    attributes: { 

     userId: { 
      type: 'bigint', 
      autoIncrement: true, 
      primaryKey: true, 
      unique: true, 
     }, 
    } 
}; 

이 필드는 여전히 데이터베이스에 정수 필드를 생성합니다.

답변

2

소스 코드를 파고 들자 마자 이라는 추가 속성을 설정해야한다는 것을 알았습니다.이 필드의 크기는입니다. 64로 설정하면 흘수선이 BIGINT 필드를 생성합니다.

module.exports = { 
    attributes: { 

     userId: { 
      type: 'integer', 
      size: 64, // waterline will translate this as bigint 
      autoIncrement: true, 
      primaryKey: true, 
      unique: true, 
     }, 
    } 
}; 
관련 문제