Knex increments creates two different types of id integer, int(10) unsigned and int(11)

knex increments creates two different types of id integer, int(10) unsigned and int(11), and the foreign keys are not compatible. mysql

One is unsigned and one is signed, the signed one has the extra bit to show if it’s negative or not. It only refers to how it’s displayed, not the actual size of it (int/bigint/etc are the size). But you can’t build a foreign key from a field with an unsigned key to one with a signed key. They need to be the same

very excellent, so it was not my id that was the problem but an unsigned integer that could not be a foreign key to a signed id integer

1 Like

I’m not the best at SQL DBs, there’ll be a few people on here who are a lot more knowledgeable, but I think you want them both unsigned, that seems to make sense to me without too much digging through Google

so it looks like if the field will never contain a negative value, you use unsigned.