See this answer for how I implemented string primary keys in my rails app: https://stackoverflow.com/a/1434819/4585520
In the migrations, id: false
is specified and some custom postgres execution code is added (i.e. execute "ALTER TABLE users ADD PRIMARY KEY (uid);"
where uid
is a string). Also, in the models, self.primary_key = :uid
is usedThe result is that I have no 'id' columns, just 'uid' columns which are all strings.
However, when I deploy this to Heroku and run my seed generation, I get errors because of duplicate uids. I notice that the added uid values are integers. Perhaps the string values I'm providing are being converted to integers (I have UIDs in a JSON file and am importing those, so no uid generation is occurring), which would explain why they're producing duplicate values.
Why are my uids integers on heroku when they're correctly running as strings in development?