{"action":"created","issue":{"url":"https://api.github.com/repos/softwaremill/slick-eventsourcing/issues/2","labels_url":"https://api.github.com/repos/softwaremill/slick-eventsourcing/issues/2/labels{/name}","comments_url":"https://api.github.com/repos/softwaremill/slick-eventsourcing/issues/2/comments","events_url":"https://api.github.com/repos/softwaremill/slick-eventsourcing/issues/2/events","html_url":"https://github.com/softwaremill/slick-eventsourcing/issues/2","id":120316786,"number":2,"title":"Using play.api.db.slick.dbConfig can't be used directly for creating a new EventsDatabase","user":{"login":"Voltir","id":889215,"avatar_url":"https://avatars.githubusercontent.com/u/889215?v=3","gravatar_id":"","url":"https://api.github.com/users/Voltir","html_url":"https://github.com/Voltir","followers_url":"https://api.github.com/users/Voltir/followers","following_url":"https://api.github.com/users/Voltir/following{/other_user}","gists_url":"https://api.github.com/users/Voltir/gists{/gist_id}","starred_url":"https://api.github.com/users/Voltir/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Voltir/subscriptions","organizations_url":"https://api.github.com/users/Voltir/orgs","repos_url":"https://api.github.com/users/Voltir/repos","events_url":"https://api.github.com/users/Voltir/events{/privacy}","received_events_url":"https://api.github.com/users/Voltir/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-12-04T02:14:56Z","updated_at":"2015-12-07T14:36:26Z","closed_at":"2015-12-07T14:36:26Z","body":"Using play 2.4 and slick (in my case with compile time DI using macwire), Id like to do something like this:\r\n\r\n```scala\r\ntrait DatabaseModule\r\n  extends SlickComponents\r\n  with EventsModule {\r\n\r\n  def ec: ExecutionContext\r\n\r\n  lazy val db: Database = api.dbConfig[StabPostgresDriver](DbName(\"default\")).db\r\n\r\n  override lazy val eventsDatabase = new EventsDatabase(db,models.generated.StabPostgresDriver.profile)\r\n\r\n  lazy val idGenerator = new DefaultIdGenerator(datacenterId = 1)\r\n\r\n  lazy val registry = Registry()\r\n\r\n  lazy val users = wire[UsersDao]\r\n}\r\n```\r\nBut that ends up being a compile time error:\r\n\r\n```\r\n[error] /home/nick/tests/stab-slick-eventsourcing/server/app/modules/DatabaseModule.scala:30: type mismatch;\r\n[error]  found   : models.generated.StabPostgresDriver.profile.api.Database\r\n[error]     (which expands to)  slick.jdbc.JdbcBackend#DatabaseDef\r\n[error]  required: slick.jdbc.JdbcBackend.Database\r\n[error]     (which expands to)  slick.jdbc.JdbcBackend.DatabaseDef\r\n[error]   override lazy val eventsDatabase = new EventsDatabase(db,models.generated.StabPostgresDriver.profile)\r\n[error]                                                         ^\r\n[error] one error found\r\n[error] (server/compile:compile) Compilation failed\r\n```\r\n\r\nBut forcefully casting the type appears to work:\r\n\r\n```scala\r\n  override lazy val eventsDatabase = new EventsDatabase(db.asInstanceOf[slick.jdbc.JdbcBackend.DatabaseDef],models.generated.StabPostgresDriver.profile)\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/softwaremill/slick-eventsourcing/issues/comments/162542631","html_url":"https://github.com/softwaremill/slick-eventsourcing/issues/2#issuecomment-162542631","issue_url":"https://api.github.com/repos/softwaremill/slick-eventsourcing/issues/2","id":162542631,"user":{"login":"adamw","id":60503,"avatar_url":"https://avatars.githubusercontent.com/u/60503?v=3","gravatar_id":"","url":"https://api.github.com/users/adamw","html_url":"https://github.com/adamw","followers_url":"https://api.github.com/users/adamw/followers","following_url":"https://api.github.com/users/adamw/following{/other_user}","gists_url":"https://api.github.com/users/adamw/gists{/gist_id}","starred_url":"https://api.github.com/users/adamw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adamw/subscriptions","organizations_url":"https://api.github.com/users/adamw/orgs","repos_url":"https://api.github.com/users/adamw/repos","events_url":"https://api.github.com/users/adamw/events{/privacy}","received_events_url":"https://api.github.com/users/adamw/received_events","type":"User","site_admin":false},"created_at":"2015-12-07T14:36:26Z","updated_at":"2015-12-07T14:36:26Z","body":"Great, part of 0.1.3 "}}