Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

herokify

  • Loading branch information...
commit a26fd70072c4a6559665400ce62dd64ba17c7f5b 1 parent c19966e
@jamesward authored
View
2  Procfile
@@ -1 +1 @@
-web: target/start -Dhttp.port=$PORT
+web: target/start -Dhttp.port=$PORT -DapplyEvolutions.default=true -Ddb.default.driver=org.postgresql.Driver -Ddb.default.url=$DATABASE_URL
View
3  README
@@ -1,3 +0,0 @@
-This is a re-write of James Ward tutorial - Play Framework, JPA, JSON, jQuery, & Heroku http://www.jamesward.com/2011/12/11/tutorial-play-framework-jpa-json-jquery-heroku
-
-Using Play 2.0 RC1
View
21 README.md
@@ -1,19 +1,2 @@
-Deploy on Heroku
-----------------
-
-1. [Install the Heroku Toolbelt](http://toolbelt.heroku.com)
-
-2. [Signup for a Heroku Account](http://heroku.com/signup)
-
-3. Login to Heroku:
-
- $ heroku login
-
-4. Create a new Heroku app:
-
- $ heroku create -s cedar
-
-5. Push the local repo to Heroku:
-
- $ git push heroku master
-
+Play2Bars - Scala + Squeryl
+---------------------------
View
14 app/Global.scala
@@ -1,4 +1,5 @@
-import org.squeryl.adapters.H2Adapter
+import org.squeryl.adapters.{H2Adapter, PostgreSqlAdapter}
+import org.squeryl.internals.DatabaseAdapter
import org.squeryl.{Session, SessionFactory}
import play.api.db.DB
import play.api.GlobalSettings
@@ -9,10 +10,13 @@ object Global extends GlobalSettings {
override def onStart(app: Application) {
- SessionFactory.concreteFactory = Some(() =>
- Session.create(
- DB.getConnection()(app),
- new H2Adapter))
+ SessionFactory.concreteFactory = app.configuration.getString("db.default.driver") match {
+ case Some("org.h2.Driver") => Some(() => getSession(new H2Adapter, app))
+ case Some("org.postgresql.Driver") => Some(() => getSession(new PostgreSqlAdapter, app))
+ case _ => None
+ }
}
+ def getSession(adapter:DatabaseAdapter, app: Application) = Session.create(DB.getConnection()(app), adapter)
+
}
View
1  project/Build.scala
@@ -9,6 +9,7 @@ object ApplicationBuild extends Build {
val appDependencies = Seq(
"org.squeryl" %% "squeryl" % "0.9.5",
+ "postgresql" % "postgresql" % "9.1-901-1.jdbc4",
"com.jquery" % "jquery" % "1.7.1"
)
Please sign in to comment.
Something went wrong with that request. Please try again.