[erlang-questions] Understanding ChicagoBoss model
Ivan Carmenates García
co7eb@REDACTED
Thu May 1 19:08:59 CEST 2014
Hi all,
I have some troubles with the CB ORM model, and I would love to know if
there is at least one way to do something like follow:
I have made a database model in postgres and when I tried to fix that model
in the CB model I encounter with some inconvenient, first do I have
obligatory to have and id for each table in the database? Including the many
to many normalized relationship like this one or a model with more than one
foreign keys
%%% Module attributes definition.
-module(user_friend_ships, [
Id,
Users1Id,
Users2Id
]).
-compile(export_all).
-belongs_to(users).
When you compile it, it expects a field name called UsersId, even I tried to
specify in the users model de custom fk and nothing expected happens. In the
database I can have one fk called users_id that matches with one in the CB
model, but the other? It need to have a different name!.
-module(users, [
Id,
Username,
Password,
PasswordOld,
Status
]).
-compile(export_all).
-has({user_friend_ships, many, [{foreign_key, "users1_id"}]}).
-has({user_friend_ships, many, [{foreign_key, "users2_id"}]}).
The other thing is the obligatory id even for the many to many
relationships.
Best regards,
Ivan.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20140501/9d4b232d/attachment.htm>
More information about the erlang-questions
mailing list