I have a Grails 1.3.7 domain class that is declared like this:
class Document {
String url
Map metadata = new HashMap()
static constraints = {
url(nullable:false, blank: false, maxSize: 2048)
metadata()
}
}
The schema that is generated looks like this:
+-------------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------------+--------------+------+-----+---------+----------------+
| id | bigint(20) | NO | PRI | NULL | auto_increment |
| url | longtext | NO | | NULL | |
+-------------+--------------+------+-----+---------+----------------+
+--------------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+--------------+--------------+------+-----+---------+-------+
| metadata | bigint(20) | YES | | NULL | |
| metadata_idx | varchar(255) | YES | | NULL | |
| metadata_elt | varchar(255) | NO | | NULL | |
+--------------+--------------+------+-----+---------+-------+
I am wondering how I can specify different types (specifically, different size) for the document_metadata table. I would like to be able to store strings longer than 255 characters. I could not find any relevant documentation online, possibly because I couldn't come up with any good keywords. Map and Collection are pretty generic terms!
Thanks,
Gene