Храните длинные струны с помощью Squeryl - PullRequest
1 голос
/ 07 марта 2012

Я бы хотел использовать тип данных VARCHAR (255) или TEXT MySQL для хранения названия научной статьи. Squeryl создает поля VARCHAR (128) для хранения строк. Как настроить его для использования больших полей?

1 Ответ

1 голос
/ 07 марта 2012

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