加载一系列通Capistrano的SQL文件 [英] Load a series of sql files through capistrano

查看:167
本文介绍了加载一系列通Capistrano的SQL文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个问题想通过我们的Capistrano的配方为我们的测试环境,加载一系列SQL文件。

I'm having an issue trying to load a series of sql files through our capistrano recipe for our testing environment.

下面是我走过来:

  desc "Empty database and play sql scripts for fresh db structure"
  task :mysqlrestore, :roles => :app do 

  run "find #{current_release}/migration/ -name '*.sql' -print0 | xargs -0 -I file mysql -hlocalhost -u#{db_username} -p#{db_password} #{db_database} < file"

我Capistrano的控制台输出:

My capistrano console outputs a :

失败:嘘-c查找/主页/工具箱/ WWW /分期/发行/ 20120119111819 /迁移/ -name'\\''。* SQL'\\''-print0 | xargs的-0 -I文件mysql的 - hlocalhost -uUser -ppassword DBNAME&LT;文件关于staging.env.com

failed: "sh -c 'find /home/toolbox/www/staging/releases/20120119111819/migration/ -name '\''*.sql'\'' -print0 | xargs -0 -I file mysql -hlocalhost -uuser -ppassword DBNAME < file'" on staging.env.com

在哪里可能是错的?

推荐答案

我能只是从运行命令删除您单引号执行从砸向你的命令。

I was able to execute your command from bash just by removing your single quotes from your run command.

 run "find #{current_release}/migration/ -name *.sql -print0 | xargs -0 -I file mysql -hlocalhost -u#{db_username} -p#{db_password} #{db_database} < file"

这篇关于加载一系列通Capistrano的SQL文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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