I’ve looked around here and can’t seem to find anyone with the same problem. I’ve twice now tried to create a phoenix with $ mix phx.new my_app --live --binary-id
yet when I generate a migration, they are generated with the regular bigint for primary key.
Secondly, is it possible to convert an app to start using binary ids that wasn’t bootstrapped with --binary-id
? I’ve just been editing the migrations and then changing the schemas to use my custom Schema. While it’s not the end of the world, it’s bit of a pain.
Thanks!
Ok, maybe try to uninstall phoenix with mix archive.uninstall
?
But you can configure manually on your config.exs
:
config :app, App.Repo, migration_primary_key: [type: :binary_id]
# AND
config :app,
ecto_repos: [App.Repo],
generators: [binary_id: true]
1 Like
Awesome, thank you! I actually didn’t try mix archive.uninstall
yet, but I will. It was enough to fix the generators in the current app I’m working on, I was just curious for the future as to why --binary-id
didn’t seem to be working. I can report back here if I figure it out for anyone else who might be having this issue.
1 Like
Good to know! Yeah, I agree with you, it’s so strange that the flag isn’t work, but I don’t even can think about anything that could misconfigure or misrun the phx
command.