用Squeryl存储长串

时间:2012-03-07 17:20:04

标签: mysql string squeryl

我想使用VARCHAR(255)或TEXT MySQL数据类型来存储科学文章的名称。 Squeryl创建VARCHAR(128)字段来存储字符串。如何配置它以使用更大的字段?

1 个答案:

答案 0 :(得分:1)

来自http://squeryl.org/schema-definition.html

object Library extends Schema {
...
...    
  on(borrowals)(b => declare(
    b.numberOfPhonecallsForNonReturn defaultsTo(0),
    b.borrowerAccountId is(indexed),
    columns(b.scheduledToReturnOn, b.borrowerAccountId) are(indexed)
  ))

  on(authors)(s => declare(
    s.email      is(unique,indexed("idxEmailAddresses")), //indexes can be named explicitely
    s.firstName  is(indexed),
    **s.lastName   is(indexed, dbType("varchar(255)")),** // the default column type can be overriden     
    columns(s.firstName, s.lastName) are(indexed) 
  ))
}