gpt4 book ai didi

postgresql - 玩框架postgresql : Database 'default' needs evolution

转载 作者:行者123 更新时间:2023-11-29 13:20:01 26 4
gpt4 key购买 nike

我按照教程在 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 结束时

最佳答案

运行

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

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

如果你想自动运行它们,包括 downs(小心,特别是如果你的 down evolutions 删除现有数据)。

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

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

关于postgresql - 玩框架postgresql : Database 'default' needs evolution,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43676354/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com