I’m working on a project and connecting to a pre-existing database. The tables use alphaneumeric id feilds or 14 digit neumeric keys. How can I define a the primary key (id) variable type.
Your exceeding the maximum size of a PG integer (specifically the id field is set to a serial datatype which has a maximum of 2^31-1 or 2,147,483,648).
I can’t image you have already exceeded 2.1 billion entries in your database let alone 4.2 trillion entries
A bigserial type exists but we never implemented because I can’t even begin to fathom a reason why someone would need 9.2 Quintilian entries in a database (the maximum for bigserial) let alone the issues you would have within Javascript with bitint support.
Yes. I understand the constraints on the database or javascript. I wanted to see if I could define the Id key variable type or have a different primary key variable name.
I’m connecting to a pre-existing database for a client. This hardly has 100,000 records. The keys are strangely that large. sadly can’t change them. I imported the database and was able to run strapi project on the data. I face this issue sometimes when i try to fetch models with relations
They must have manually set the data type to big serial and manually set the starting ID to something very high. We won’t be able to handle big serials until the v4 (maybe, I haven’t tested but I will in the beta). But you may hit issues with Javascript and Big Integer support with the existing database.
Functionally though, we don’t plan to support existing databases that weren’t created by a Strapi project.