I want to add new fields to a domain class so that it updates the generated table's attributes set. I have a domain class like this,,
Class Book {
String name
static constraints = {
name nullable:false
}
String toString() {
return name
}
}
The GORM generated includes name along with id and version. Now I want to add ISBN to Book domain class as following
Class Book {
String name
String ISBN
static constraints = {
name nullable:false
ISBN nullable:true
}
String toString() {
return name
}
}
I don't want to use create-drop in DataSource.groovy because it will delete all my previous data. My DataSource.groovy looks like this,,
dataSource {
dbCreate = "update"
url = "jdbc:jtds:sqlserver://localhost:1433/databaseName"
username = "username"
password = "password"
}
I want GORM to add ISBN field to book table. But its not happening. Where am I wrong ?
I am using sql server 2008 and grails version 2.1.1