dresende / node-orm2

Object Relational Mapping
http://github.com/dresende/node-orm2
MIT License
3.07k stars 379 forks source link

MantoToOne as key #726

Open olee opened 8 years ago

olee commented 8 years ago

Hi, I want to create a schema with a many-to-one association to be part of the key: I have two entities user and node. Node should use a combination of the user it belongs to + a start time as key:

User [id] 
Node [user_id, start]

I tried adding key: true when registering the association, but it had not effect and even after looking into the source code I could not find anything like that. Is this not possible yet with this library?

dxg commented 8 years ago

Composite keys might work. Not sure if the key syntax supports it though; You may need to pass an option like id: [user_id, start] but I've never tried it.