Advertisement
Guest User

Untitled

a guest
Apr 29th, 2015
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 1.01 KB | None | 0 0
  1. // this code works ok
  2. val id = (models returning models.map(_.id)) += Dashboard.makeObject(name = newModel.name, description = newModel.maybeDescription)
  3.  
  4. containers += Container.makeObject(1, defaultlayoutId, id)
  5.  
  6. // ...
  7.  
  8. // table definition for Dashboard
  9. class Dashboards(tag: Tag) extends Table[Dashboard](tag, "dashboards") {
  10.  
  11.   def id = column[Long]("id", O.PrimaryKey, O.AutoInc)
  12.  
  13.   def name = column[String]("name", O.NotNull)
  14.  
  15.   def description = column[Option[String]]("description", O.Nullable)
  16.  
  17.   def created = column[Timestamp]("created", O.NotNull, O.DBType("timestamp default now()"))
  18.  
  19.   def lastUpdated = column[Timestamp]("last_updated", O.NotNull, O.DBType("timestamp default now()"))
  20.  
  21.   def idx = index("dashboards_unique_name", (name), unique = true)
  22.  
  23.   //define the "shape" of a single data record
  24.   //we're telling that an object of class Dashboard should be returned
  25.   def * = (id, name, description, created, lastUpdated) <>((Dashboard.apply _).tupled, Dashboard.unapply)
  26.  
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement