mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
DDC-746: ManyToOne: the generated schema does not enforce NOT NULL on the foreign key by default #918
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @doctrinebot on GitHub (Aug 13, 2010).
Originally assigned to: @beberlei on GitHub.
Jira issue originally created by user djones:
In a @ManyToOne annotation, unless a @JoinColumn annotation with nullable=false is present, the generated schema has DEFAULT NULL rather than the expected NOT NULL for the foreign key.
@doctrinebot commented on GitHub (Aug 13, 2010):
Comment created by romanb:
Why is NOT NULL expected? We chose to default to nullable foreign keys so associations are optional by default.
So this is not a bug but a request to change the current default.
@doctrinebot commented on GitHub (Aug 13, 2010):
Comment created by @beberlei:
Sorry, i was too tired to realize this is the desired behavior. By default aforeign key is nullable. sorry to bother everyone ;)
@doctrinebot commented on GitHub (Aug 13, 2010):
Issue was closed with resolution "Invalid"
@doctrinebot commented on GitHub (Aug 13, 2010):
Comment created by djones:
I was in a discussion on the #doctrine IRC channel where another user seemed to have DEFAULT NULL without the @JoinColumn explicitly set and I asked @beberlei which was the default behaviour and he said that it should be NULL by default and to open a ticket! If it's not a bug, them I'm sorry for wasting anyone's time.
It might be useful to outline what the defaults are in the Annotation Reference in the manual. I was only asking because I'd checked there first and it wasn't documented as far as I could see.