Saturday, 4 September 2010

unique on multiple columns

In Doctrine documentation I couldn't come across on how to mark in YML file to have unique on 2 columns.
The idea is as this example demonstrates of setting the category_id and user_id fields as unique:
Entry:
columns:
project_name:
type: string(255)
category_id:
type: integer
notnull: true      
user_id:
type: integer(4)
notnull: true
indexes:
category_user_idx:
fields:
user_id: []
category_id: []
type: unique

No comments:

Post a comment