如何在CloudFoundry中执行mysql脚本 [英] How to execute mysql scripts in cloudfoundry

查看:88
本文介绍了如何在CloudFoundry中执行mysql脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个.sql文件(初始sql脚本)。我最近在cloudfoundry中部署了应用程序,因此我想运行这些脚本来使应用程序正常工作,这些脚本将更新5个以上的db表。

I have a .sql file (initial sql scripts). I have recently deployed application in cloudfoundry, So I want to run these scripts to make application work, Scripts will update more than 5 db tables.

在启动时是否还有其他方法可以从grails应用程序运行mysql脚本?或者是否有任何规定可以在cloudfoundry中运行脚本。

Is there any other way to run the mysql scripts from the grails application on start up Or Is there any provision to run the scripts in the cloudfoundry.

推荐答案

您在这里有几个选择。


  • 第一个(我建议)是使用 http://liquibase.org/ 之类的(一个Grails插件: http://grails.org/plugin/liquibase )。该工具将确保您提供的任何脚本都将在应用程序启动之前运行,而无需两次运行相同的脚本,等等。这对于跟踪数据库更改非常有用。
    这独立于CloudFoundry起作用,并且可以帮助任何安装具有最新架构的应用的人

  • The first one (which I recommend), is to use something like http://liquibase.org/ (there is a Grails plugin for it: http://grails.org/plugin/liquibase). This tool will make sure that any script you give it will run prior to the app starting, without running the same script twice, etc. This is great to keep track of your database changes. This works independently of CloudFoundry and would help anyone installing your app having an up to date schema

第二个选择是隧道传输到CloudFoundry数据库并运行脚本到数据库。看看 http://docs.cloudfoundry.com/tools/vmc/caldecott.html 或什至更容易使用STS: http://blog.cloudfoundry.com/2012/07/31/cloud-foundry-integration-for-eclipse-now-supports-tunneling-to-services/

The second option would be to tunnel to the CloudFoundry database and run the script to the db. Have a look at http://docs.cloudfoundry.com/tools/vmc/caldecott.html or even easier with STS : http://blog.cloudfoundry.com/2012/07/31/cloud-foundry-integration-for-eclipse-now-supports-tunneling-to-services/

这篇关于如何在CloudFoundry中执行mysql脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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