我正在尝试使用光滑的postgresql数据库运行Play framework 2.5应用程序。但是在我将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._%-]+@[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
答案 0 :(得分:0)
我发现了一个问题。正确的应用程序配置应该包含
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 = ***