This is because you are defining the relation the wrong way around.
I take it that a user
may be related to several (e.g.) logins
, so the foreign key column must be in the login
table.
Please note, the term "foreign key" is the name of the column that references a foreign table (formally, the referenced column must be the primary key). So for instance:
User Login ------- ------- id (PK) id (PK) name login ... user_id (FK to user.id) <== this is the foreign key ------- ... -------