如何在Sequelize中使用Postgres的BIGSERIAL?

时间:2018-10-04 16:09:27

标签: node.js database postgresql sequelize.js

我想将PostgreSQL BIG SERIAL类型用作Sequelize Model中的id。我该怎么做呢? 我发现执行此操作时,Sequelize使用SERIAL:

{
  sub⋅obj: {
    ₴dollar⍀backslash: "$\\.end$"
  },
  ₴you⋅must⋅be⋅kidding: {
    sub⋅obj: null,
    ₴you⋅must⋅be⋅kidding: null
  }
}
[12:02:47.691] {
  "sub.obj": {
    $dollar\\backslash: "$\\.end$"
  },
  "$you.must.be.kidding": {
    "sub.obj": {},
    "$you.must.be.kidding": {}
  }
}

但是如何使其成为BIGSERIAL?

1 个答案:

答案 0 :(得分:0)

我认为您的答案可以在此Github问题(https://github.com/sequelize/sequelize/issues/1784

上找到。

基本上,只需设置

type: Sequelize.BIGINT, 
autoIncrement: true