【问题标题】:play framewok postgresql : Database 'default' needs evolution播放框架 postgresql:数据库“默认”需要进化
【发布时间】:2017-04-28 09:09:30
【问题描述】:

我按照教程在heroku中部署了我非常简单的应用程序

当我通过 sbt run 运行它时,它在我的本地主机中运行良好 但它在 heroku 上崩溃了!

这是我的 1.sql:

# --- !Ups

create table contact (
  id                            SERIAL UNIQUE,
  name                          varchar(255),
  email                         varchar(255),
  phone                         varchar(255),
  constraint pk_contact primary key (id)
);
create sequence contact_seq;


# --- !Downs

drop table if exists contact;
drop sequence if exists contact_seq;

heroku 的日志:

p.a.d.DefaultDBApi - Database [default] connected at jdbc:postgresql://...


!!! WARNING! This script contains DOWNS evolutions that are likely destructive
 [warn] p.a.d.e.ApplicationEvolutions - Your production database [default] needs evolutions, including downs!

drop table if exists contact;
 # --- Rev:1,Downs - a56ada6
 name                          varchar(255),
 drop sequence if exists contact_seq;
 email                         varchar(255), phone                         varchar(255),
# --- Rev:1,Ups - 53110fe
 create table contact (
 );
 id                            SERIAL UNIQUE,
 constraint pk_contact primary key (id)
 create sequence contact_seq;

 [warn] p.a.d.e.ApplicationEvolutions - Run with -Dplay.evolutions.db.default.autoApply=true and -Dplay.evolutions.db.default.autoApplyDowns=true if you want to run them automatically, including downs (be careful, especially if your down evolutions drop existing data)
 [info] application - ApplicationTimer demo: Starting application at 2017-04-28T08:59:05.048Z
 Oops, cannot start the server.
 @73o5pe90c: Database 'default' needs evolution!

我还添加了 play.evolutions.db.default.autoApply=true 在我的 application.conf 结束时

【问题讨论】:

    标签: postgresql heroku playframework


    【解决方案1】:

    运行

     -Dplay.evolutions.db.default.autoApply=true 
    

     -Dplay.evolutions.db.default.autoApplyDowns=true 
    

    如果您想自动运行它们,包括下降(要小心,特别是如果下降演变会丢弃现有数据)。

    你可以通过运行来设置这些:

    heroku config:set JAVA_OPTS="-Dplay.evolutions.db.default.autoApply=true -Dplay.evolutions.db.default.autoApplyDowns=true"
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-06
      • 2012-03-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多