Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package Models
- // AUTO-GENERATED Slick data model
- /** Stand-alone Slick data model for immediate use */
- object Tables extends {
- val profile = slick.driver.MySQLDriver
- } with Tables
- /** Slick data model trait for extension, choice of backend or usage in the cake pattern. (Make sure to initialize this late.) */
- trait Tables {
- val profile: slick.driver.JdbcProfile
- import profile.api._
- import slick.model.ForeignKeyAction
- // NOTE: GetResult mappers for plain SQL are only generated for tables where Slick knows how to map the types of all columns.
- import slick.jdbc.{GetResult => GR}
- /** DDL for all tables. Call .create to execute. */
- lazy val schema: profile.SchemaDescription = Address.schema ++ Customer.schema ++ CustomerAddress.schema ++ Images.schema
- @deprecated("Use .schema instead of .ddl", "3.0")
- def ddl = schema
- /** Entity class storing rows of table Address
- * @param id Database column id SqlType(INT), AutoInc, PrimaryKey
- * @param street Database column street SqlType(VARCHAR), Length(128,true)
- * @param city Database column city SqlType(VARCHAR), Length(128,true)
- * @param zipcode Database column zipcode SqlType(VARCHAR), Length(10,true) */
- case class AddressRow(id: Int, street: String, city: String, zipcode: String)
- /** GetResult implicit for fetching AddressRow objects using plain SQL queries */
- implicit def GetResultAddressRow(implicit e0: GR[Int], e1: GR[String]): GR[AddressRow] = GR{
- prs => import prs._
- AddressRow.tupled((<<[Int], <<[String], <<[String], <<[String]))
- }
- /** Table description of table address. Objects of this class serve as prototypes for rows in queries. */
- class Address(_tableTag: Tag) extends Table[AddressRow](_tableTag, "address") {
- def * = (id, street, city, zipcode) <> (AddressRow.tupled, AddressRow.unapply)
- /** Maps whole row to an option. Useful for outer joins. */
- def ? = (Rep.Some(id), Rep.Some(street), Rep.Some(city), Rep.Some(zipcode)).shaped.<>({r=>import r._; _1.map(_=> AddressRow.tupled((_1.get, _2.get, _3.get, _4.get)))}, (_:Any) => throw new Exception("Inserting into ? projection not supported."))
- /** Database column id SqlType(INT), AutoInc, PrimaryKey */
- val id: Rep[Int] = column[Int]("id", O.AutoInc, O.PrimaryKey)
- /** Database column street SqlType(VARCHAR), Length(128,true) */
- val street: Rep[String] = column[String]("street", O.Length(128,varying=true))
- /** Database column city SqlType(VARCHAR), Length(128,true) */
- val city: Rep[String] = column[String]("city", O.Length(128,varying=true))
- /** Database column zipcode SqlType(VARCHAR), Length(10,true) */
- val zipcode: Rep[String] = column[String]("zipcode", O.Length(10,varying=true))
- }
- /** Collection-like TableQuery object for table Address */
- lazy val Address = new TableQuery(tag => new Address(tag))
- /** Entity class storing rows of table Customer
- * @param id Database column id SqlType(INT), AutoInc, PrimaryKey
- * @param name Database column name SqlType(VARCHAR), Length(255,true)
- * @param imageId Database column image_id SqlType(INT), Default(None) */
- case class CustomerRow(id: Int, name: String, imageId: Option[Int] = None)
- /** GetResult implicit for fetching CustomerRow objects using plain SQL queries */
- implicit def GetResultCustomerRow(implicit e0: GR[Int], e1: GR[String], e2: GR[Option[Int]]): GR[CustomerRow] = GR{
- prs => import prs._
- CustomerRow.tupled((<<[Int], <<[String], <<?[Int]))
- }
- /** Table description of table customer. Objects of this class serve as prototypes for rows in queries. */
- class Customer(_tableTag: Tag) extends Table[CustomerRow](_tableTag, "customer") {
- def * = (id, name, imageId) <> (CustomerRow.tupled, CustomerRow.unapply)
- /** Maps whole row to an option. Useful for outer joins. */
- def ? = (Rep.Some(id), Rep.Some(name), imageId).shaped.<>({r=>import r._; _1.map(_=> CustomerRow.tupled((_1.get, _2.get, _3)))}, (_:Any) => throw new Exception("Inserting into ? projection not supported."))
- /** Database column id SqlType(INT), AutoInc, PrimaryKey */
- val id: Rep[Int] = column[Int]("id", O.AutoInc, O.PrimaryKey)
- /** Database column name SqlType(VARCHAR), Length(255,true) */
- val name: Rep[String] = column[String]("name", O.Length(255,varying=true))
- /** Database column image_id SqlType(INT), Default(None) */
- val imageId: Rep[Option[Int]] = column[Option[Int]]("image_id", O.Default(None))
- /** Foreign key referencing Images (database name imagekey) */
- lazy val imagesFk = foreignKey("imagekey", imageId, Images)(r => Rep.Some(r.id), onUpdate=ForeignKeyAction.NoAction, onDelete=ForeignKeyAction.NoAction)
- }
- /** Collection-like TableQuery object for table Customer */
- lazy val Customer = new TableQuery(tag => new Customer(tag))
- /** Entity class storing rows of table CustomerAddress
- * @param customerId Database column customer_id SqlType(INT)
- * @param addressId Database column address_id SqlType(INT) */
- case class CustomerAddressRow(customerId: Int, addressId: Int)
- /** GetResult implicit for fetching CustomerAddressRow objects using plain SQL queries */
- implicit def GetResultCustomerAddressRow(implicit e0: GR[Int]): GR[CustomerAddressRow] = GR{
- prs => import prs._
- CustomerAddressRow.tupled((<<[Int], <<[Int]))
- }
- /** Table description of table customer_address. Objects of this class serve as prototypes for rows in queries. */
- class CustomerAddress(_tableTag: Tag) extends Table[CustomerAddressRow](_tableTag, "customer_address") {
- def * = (customerId, addressId) <> (CustomerAddressRow.tupled, CustomerAddressRow.unapply)
- /** Maps whole row to an option. Useful for outer joins. */
- def ? = (Rep.Some(customerId), Rep.Some(addressId)).shaped.<>({r=>import r._; _1.map(_=> CustomerAddressRow.tupled((_1.get, _2.get)))}, (_:Any) => throw new Exception("Inserting into ? projection not supported."))
- /** Database column customer_id SqlType(INT) */
- val customerId: Rep[Int] = column[Int]("customer_id")
- /** Database column address_id SqlType(INT) */
- val addressId: Rep[Int] = column[Int]("address_id")
- /** Primary key of CustomerAddress (database name customer_address_PK) */
- val pk = primaryKey("customer_address_PK", (customerId, addressId))
- /** Foreign key referencing Address (database name address) */
- lazy val addressFk = foreignKey("address", addressId, Address)(r => r.id, onUpdate=ForeignKeyAction.NoAction, onDelete=ForeignKeyAction.NoAction)
- /** Foreign key referencing Customer (database name customer) */
- lazy val customerFk = foreignKey("customer", customerId, Customer)(r => r.id, onUpdate=ForeignKeyAction.NoAction, onDelete=ForeignKeyAction.NoAction)
- }
- /** Collection-like TableQuery object for table CustomerAddress */
- lazy val CustomerAddress = new TableQuery(tag => new CustomerAddress(tag))
- /** Entity class storing rows of table Images
- * @param id Database column id SqlType(INT), PrimaryKey
- * @param image Database column image SqlType(MEDIUMBLOB) */
- case class ImagesRow(id: Int, image: java.sql.Blob)
- /** GetResult implicit for fetching ImagesRow objects using plain SQL queries */
- implicit def GetResultImagesRow(implicit e0: GR[Int], e1: GR[java.sql.Blob]): GR[ImagesRow] = GR{
- prs => import prs._
- ImagesRow.tupled((<<[Int], <<[java.sql.Blob]))
- }
- /** Table description of table images. Objects of this class serve as prototypes for rows in queries. */
- class Images(_tableTag: Tag) extends Table[ImagesRow](_tableTag, "images") {
- def * = (id, image) <> (ImagesRow.tupled, ImagesRow.unapply)
- /** Maps whole row to an option. Useful for outer joins. */
- def ? = (Rep.Some(id), Rep.Some(image)).shaped.<>({r=>import r._; _1.map(_=> ImagesRow.tupled((_1.get, _2.get)))}, (_:Any) => throw new Exception("Inserting into ? projection not supported."))
- /** Database column id SqlType(INT), PrimaryKey */
- val id: Rep[Int] = column[Int]("id", O.PrimaryKey)
- /** Database column image SqlType(MEDIUMBLOB) */
- val image: Rep[java.sql.Blob] = column[java.sql.Blob]("image")
- }
- /** Collection-like TableQuery object for table Images */
- lazy val Images = new TableQuery(tag => new Images(tag))
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement