1

I'd like to use VARCHAR(255) or TEXT MySQL data type to store a name of scientific article. Squeryl creates VARCHAR(128) fields to store strings. How do I configure it to use larger fields?

Basilevs
  • 22,440
  • 15
  • 57
  • 102

1 Answers1

1

From 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) 
  ))
}  
Ben English
  • 3,900
  • 2
  • 22
  • 32