Suppose you have the following domain classes
class User {
static hasMany = [books:Book]
}
class Book {
static belongsTo = [user:User]
}
Gorm adds a user_id column and a foreign key to the Book table. How can I add an index on this column?
It seems the simplest way works as expected. You don't need to specify the foreign key or something else.
class Book {
static belongsTo = [user:User]
static mapping = {
user index:'index_book_user_id'
}
}