2012-03-07 45 views
1

我想使用VARCHAR(255)或TEXT MySQL數據類型來存儲科學文章的名稱。 Squeryl創建VARCHAR(128)字段來存儲字符串。我如何配置它以使用更大的字段?用Squeryl存儲長字符串

回答

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) 
)) 
}