发挥框架演变不运行
问题描述:
我想运行Playglob框架2.5应用程序与PostgreSQL数据库使用光滑。但是在将1.sql添加到conf/evolutions/default后,没有检测到进化。我究竟做错了什么?发挥框架演变不运行
Application.conf
play.evolutions {
db.default.enabled = true
}
evolutions.autocommit=false
db {
slick.dbs.default.driver = "org.postgresql.Driver"
slick.dbs.default.db.driver = "com.postgresql.jdbc.Driver"
slick.dbs.default.db.url = "jdbc:mysql://localhost/doctor_moda"
slick.dbs.default.db.user = "doctor_moda"
slick.dbs.default.db.password = "doctor_moda"
}
build.sbt
name := """doctor_moda"""
version := "1.0-SNAPSHOT"
lazy val root = (project in file(".")).enablePlugins(PlayScala)
scalaVersion := "2.11.7"
libraryDependencies ++= Seq(
cache,
evolutions,
ws,
"org.scalatestplus.play" %% "scalatestplus-play" % "1.5.1" % Test,
"com.typesafe.slick" %% "slick" % "3.1.1",
"org.slf4j" % "slf4j-nop" % "1.6.4",
"com.typesafe.slick" %% "slick-hikaricp" % "3.1.0",
"org.postgresql" % "postgresql" % "9.4-1201-jdbc41",
"com.typesafe.play" %% "play-slick-evolutions" % "1.1.1"
)
1.SQL
# Initial version
# --- !Ups
CREATE SCHEMA role;
CREATE TABLE role.users (
id PRIMARY KEY DEFAULT nextval('serial'),
username VARCHAR NOT NULL UNIQUE,
email VARCHAR NOT NULL UNIQUE
CHECK (email ~* '^[A-Za-z0-9._%-][email protected][A-Za-z0-9.-]+[.][A-Za-z]+$'),
password VARCHAR NOT NULL,
salt VARCHAR NOT NULL,
created DATE NOT NULL
);
# --- !Downs
DROP SCHEMA role;
-- User schema
答
,我发现了一个问题。正确的应用程序配置应该包括
slick.dbs.default.driver = "org.postgresql.Driver"
slick.dbs.default.db.driver = "com.postgresql.jdbc.Driver"
slick.dbs.default.db.url = "jdbc:postgresql://localhost/doctor_moda"
slick.dbs.default.db.user = ***
slick.dbs.default.db.password = ***
你可以尝试移动你的'slick.dbs.default' conf部分在你的配置中'db'对象之外吗? – mfirry