Grails 添加域字段作为数据库索引
我在我的项目中使用 grails 1.2.2 和 1.3.7。 我想向域表添加索引。
class Test {
String name
String surname
static mapping = {
name column: 'name', index: 'test_dx'
surname column: 'surname', index: 'test_dx'
}
我尝试
使用两个版本的 grails 和 dbCreate = "create" 或 dbCreate = "create-drop" 或 dbCreate = "update" (是我想使用的),但没有创建“自定义索引”。
I'm using grails 1.2.2 and 1.3.7 in my project.
I want to add an index to the domain's table.
class Test {
String name
String surname
static mapping = {
name column: 'name', index: 'test_dx'
surname column: 'surname', index: 'test_dx'
}
}
I tried with the two version of grails and with dbCreate = "create" or dbCreate = "create-drop" or dbCreate = "update" (is the one I want to use) but no "custom index" created.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你的例子对我有用。如果我使用 MySQL 数据库在
update
模式下运行我的应用程序,那么我会从 MySQL 控制台得到以下信息:您正在使用什么数据库?
Your example works for me. If I run my app in
update
mode with a MySQL database, then I get this from the MySQL console:What database are you using?