尝试将我的数据库从 SQLite 迁移到 PostgreSQL 时,我遇到了一个整数超出范围
错误。
我想我已经指出了问题所在:我的模型中的 IntegerField
字段中有一些巨大的整数。
基本按照52675215334的顺序
当我将此值更改为较小的数字(例如 1)然后尝试迁移我的数据库时,一切正常。
除了 IntegerField 之外,我应该使用其他数据类型来存储这些大值吗?
最佳答案
尝试使用 BigIntegerField如果你的整数那么大。来自文档:
A 64 bit integer, much like an IntegerField except that it is guaranteed to fit numbers from -9223372036854775808 to 9223372036854775807. The admin represents this as an
<input type="text">
(a single-line input).
关于python - 整数超出范围,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11302711/