Play框架2.0.1不断尝试演变错误的数据库类型 [英] Play framework 2.0.1 keeps trying to evolve wrong database type

查看:140
本文介绍了Play框架2.0.1不断尝试演变错误的数据库类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在玩的2.0.1应用程序部署在openshift DIY应用程序。
我对数据库的困扰,因为play不断试图演变错误的数据库。我有一个mysql数据库和播放创建一个H2数据库进化脚本。
这里是脚本。

I'm working on play 2.0.1 application deployed on openshift DIY-application. I'm having troble with the database because play keeps trying to evolve the wrong database. I have a mysql database and play creates an H2 database evolution script. Here are the scripts.

他想创建什么

create table gif (
id                        bigint not null,
title                     varchar(255),
add_date                  timestamp,
gif_url                   varchar(255),
img_source                varchar(5000),
web_id                    varchar(255),
found_on                  varchar(255),
thumbnail                 varchar(255),
version                   integer not null,
constraint pk_gif primary key (id))
;

create table task (
id                        bigint not null,
action                    varchar(255),
queue                     integer,
type                      varchar(255),
object_id                 bigint,
params                    varchar(255),
working_on                boolean,
version                   integer not null,
constraint pk_task primary key (id))
;

create sequence gif_seq;

create sequence task_seq; 

应创建的内容

# --- Created by Ebean DDL
# To stop Ebean DDL generation, remove this comment and start using Evolutions

# --- !Ups

create table gif (
  id                        bigint auto_increment not null,
  title                     varchar(255),
  add_date                  datetime,
  gif_url                   varchar(255),
  img_source                varchar(5000),
  web_id                    varchar(255),
  found_on                  varchar(255),
  thumbnail                 varchar(255),
  version                   integer not null,
  constraint pk_gif primary key (id))
;

create table task (
  id                        bigint auto_increment not null,
  action                    varchar(255),
  queue                     integer,
  type                      varchar(255),
  object_id                 bigint,
  params                    varchar(255),
  working_on                tinyint(1) default 0,
  version                   integer not null,
  constraint pk_task primary key (id))
;

我的application.conf

My application.conf

# This is the main configuration file for the application running on openshift.
# ~~~~~

include "application"

# Secret key
# ~~~~~
# The secret key is used to secure cryptographics functions.
# If you deploy your application to several instances be sure to use the same key!
application.secret="TsLWj4[^1N<7lkdhfaiusjdpoifnsaodfEkyPDTO[dnh<7_R[j;cN0:lGK6Mm`0048C@3PK]4KR6HobL"

# Openshift database configuration
# ~~~~~
# You can declare as many datasources as you want.
# By convention, the default datasource is named `default`
#
db.default.driver=com.mysql.jdbc.Driver
db.default.url="jdbc:mysql://"${OPENSHIFT_DB_HOST}":"${OPENSHIFT_DB_PORT}/${OPENSHIFT_APP_NAME}
db.default.user=${OPENSHIFT_DB_USERNAME}
db.default.password=${OPENSHIFT_DB_PASSWORD}

#db.default.driver=org.h2.Driver
#db.default.url="jdbc:h2:mem:play"
#db.default.user=sa
#db.default.password=""
#
# You can expose this datasource via JNDI if needed (Useful for JPA)
# db.default.jndiName=DefaultDS


ebean.default= "models.*"

#Akka
akka.default-dispatcher.fork-join-executor.pool-size-max = 64
akka.actor.debug.receive = on
# Logger
# ~~~~~
# You can also configure logback (http://logback.qos.ch/), by providing a logger.xml file in the conf directory .

# Root logger:
logger.root=ERROR

# Logger used by the framework:
logger.play=INFO

# Logger provided to your application:
logger.application=DEBUG

# openshift action_hooks scripts configuration
# ~~~~~
openshift.play.params="-DapplyEvolutions.default=true"

我使用此代码执行:


target/start \
    -Dhttp.port=8080 \
    -Dhttp.address=${OPENSHIFT_INTERNAL_IP} \
    -Dconfig.resource=openshift.conf


推荐答案

我注意到MySQL环境变量在 application.conf 中不正确。正确的MySQL环境变量名称为:

I noticed the MySQL environment variables in your application.conf are incorrect. The correct MySQL environment variable names are:

OPENSHIFT_MYSQL_DB_HOST
OPENSHIFT_MYSQL_DB_PORT
OPENSHIFT_MYSQL_DB_USERNAME
OPENSHIFT_MYSQL_DB_PASSWORD

虽然我不能测试你的配置,看看这个更改是否解决了你的问题,不正确的变量名称似乎值得指出。

Although I can't test your configuration to see if this change solves your problem, the incorrect variable names seemed worth pointing out.

这篇关于Play框架2.0.1不断尝试演变错误的数据库类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆