1

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

4

1 回答 1

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) 
  ))
}  
于 2012-03-07T19:16:34.367 回答