Closed smpallen99 closed 7 years ago
I prefer the current table name "users" instead of "coherence_users". the important thing is that it holds users, not that those users are managed by coherence.
Do you want to change the name because of the way "new naming scheme" in Phoenix 1.3 that includes the context? That's been removed from Phoenix in the release candidate because of user feedback (rightly, in mu opinion)
Let me check on that. thanks @tmbbb
just to be clear @tmbb, the change is just to remove the context_ from the table name, right? so, instead of table name :coherence_users
, I should use just :users
?
@tmbb. Just noticed one of your comments above. I'll change it to users. Thanks!!
I think of a contexts as if it were a way to look at a set of DB tables... I'm not sure this is the official gospel, but it's a perspective I find useful... To me it works like this:
The DB tables sit at the bottom of the hierarchy, they basically just store all data the application might need
A schema is a way to look at a DB table, ignoring some of the columns that are not very instersting for what the code is doing right now. You can (should!) have multiple schemas for the same table, possibly with overlapping information (that is, schemas that share some columns). Contexts should be bounded, but there is no need for them to be disjoint.
A context is a simply a self-contained group of schemas with some functions to work on them.
The change you suggest in this Issue is the same as creating a Coherence context with a single schema, the User. I think it's great that coherence embraces contexts, and of course it still works with Tye code in my Pull Request (basically the User schema in the Coherence context would be a superset of all the user contexts defined by the user in the app).
Create default user schema module MyApp.Coherence.User and table "coherence_users".