简体   繁体   English

使用Play Framework 1.x,如何让JPA在生产模式下创建缺少的数据库表?

[英]Using Play Framework 1.x, how do I get JPA to create missing DB tables in production mode?

In development Play automatically creates missing tables and indexes in my database, but it doesn't seem to want to do this in production - which makes it hard to set up my production database. 在开发中,Play会自动在我的数据库中创建缺少的表和索引,但它似乎不想在生产中执行此操作 - 这使得设置生产数据库变得很困难。

How do I do this? 我该怎么做呢?

You must configure it in application.conf 您必须在application.conf中配置它

# Specify the ddl generation pattern to use. Set to none to disable it 
# (default to update in DEV mode, and none in PROD mode):
# jpa.ddl=update

update will do the job, but be careful. 更新将完成工作,但要小心。 It works fine if you add a column or table, but not more. 如果添加列或表,它可以正常工作,但不能更多。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM