DavidVII
Phoenix 1.3 generators and table names
Hello, I’m curious about the reasoning behind prefixing the table names when creating a new resource via context generator. What would be the recommendation in the case that someone does what the docs refer to when mentioning that a resource may be a part of different contexts:
Note a resource may also be split over distinct contexts (such as Accounts.User and Payments.User).
What would be the recommended table name here? accounts_users or payments_users or something else?
I understand that you can change it, but being part of a generator somewhat implies that they want to drive the point that we should be thinking about things in terms of contexts and I’m curious what folks have to say about this.
Personally, I would just name my table users, but I’d like to hear from others and get a sense of the conversion.
Most Liked
josevalim
We have reverted this behaviour in master. Phoenix v1.3 will no longer prefix tables: Keep table names simple · phoenixframework/phoenix@c335147 · GitHub
minhajuddin
I too name my tables without prefixes. I believe that contexts should not permeate into the database. So, I always use the --table option while generating models. One of us should send a PR which allows adding a --drop-table-prefix to the generator config (and adding it to the switches).
Aetherus
Sounds like we can create a poll ![]()
By the way, I don’t add context prefix to table names, either.
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #hex









