我正在进行Play的todo教程。当我在
我在activator控制台中使用
conf/evolutions/default/1.sql
中创建进化时,什么也没有发生。我只得到异常JdbcSQLException:找不到表“TASK”
,这是有道理的。我在activator控制台中使用
h2-browser
手动将进化应用于数据库,之后它就可以正常工作了。但是进化不会自动显示。
application.conf
# Database configuration
# ~~~~~
# You can declare as many datasources as you want.
# By convention, the default datasource is named `default`
#
db.default.driver=org.h2.Driver
db.default.url="jdbc:h2:mem:play"
db.default.username=sa
db.default.password=""
# New
evolutionplugin=enabled
applyEvolutions.db=true
applyEvolutions.default=true
applyDownEvolutions.default=true
# Evolutions
# ~~~~~
# You can disable evolutions if needed
# play.evolutions.enabled=false
# You can disable evolutions for a specific datasource if necessary
# play.evolutions.db.default.enabled=false
1.sql
# Tasks schema
# --- !Ups
CREATE SEQUENCE task_id_seq;
CREATE TABLE task (
id integer NOT NULL DEFAULT nextval('task_id_seq'),
label varchar(255)
);
# --- !Downs
DROP TABLE task;
DROP SEQUENCE task_id_seq;