rake数据库:迁移不适用于travis

编程入门 行业动态 更新时间:2024-10-26 00:23:23
本文介绍了rake数据库:迁移不适用于travis-ci版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我试图在Travis-CI上从github构建我的Ruby on Rails项目,但是我遇到了迁移问题。它运行一个rake任务进行迁移,但它后来抱怨同样的迁移步骤。

它跟在我的.travis.yml文件中:

语言:ruby rvm: - 1.9.2 before_script: - rake db:migrate RAILS_ENV = test

以下是构建输出:

1使用worker:ruby4.worker.travis-ci:travis-ruby-3 2 3 4 5 $ cd〜/ builds 6 7 8 $ git clone --depth = 100 --quiet git://github/rafaelportela/bacilo.git rafaelportela / bacilo 9 10 11 12 $ cd rafaelportela / bacilo 13 14 $ git checkout -qf 7553b7351b7a642e39ea7b55204de6cd4f320c36 15 16 17 $出口TRAVIS_RUBY_VERSION = 1.9.2 18 19 $ rvm使用1.9.2 20Using /home/vagrant/.rvm/gems/ruby-1.9.2-p290 21 22 $ ruby​​ --version 23ruby 1.9.2p290(2011-07-09修订版32553)[i686-linux] 24 25 $ gem - 版本 261.8.17 27 28 29 $ export BUNDLE_GEMFILE = / home / vagrant / builds / rafaelportela / bacilo / Gemfile 30 31 $ bundle install 32从https:// ruby​​gems获取gem元数据 / ....... 33使用rake(0.9.2.2) 34安装i18n(0.6.0) 35安装multi_json(1.3.4) 36安装主动支持3.2.2) 37安装建造者(3.0.0) 38安装主动模型(3.2.2) 39安装erubis(2.7.0) 40安装旅程(1.0.3) 41安装机架(1.4.1) 42安装机架高速缓存(1.2) 43安装机架测试(0.6.1) 44安装加固(1.2.1) 45安装倾斜(1.3.3) 46安装链轮(2.1.3) 47安装动作包(3.2.2) 48安装MIME类型(1.18) 49安装多边货币(0.3.3) 50安装树枝(1.4.10) 51安装邮件(2.4.4) 52安装actionmailer(3.2.2) 53安装arel(3.0.2) 54安装tzinfo 0.3.33) 55安装主动记录(3.2.2)安装活动资源(3.2.2) 57使用本机扩展安装bcrypt-ruby(3.0.1)安装coffee-script-source(1.3.1) 59安装execjs(1.3.1) 60安装咖啡脚本(2.2.0) 61安装rack-ssl(1.3.2) 62使用原生扩展安装json(1.7.0) 63安装rdoc(3.12) 64安装Thor(0.14.6) 65安装rappers(3.2.2) 66安装咖啡栏(3.2.2) 67安装orm_adapter(0.0.7) 68安装warden(1.1.1) 69安装设计(2.0.4) 70安装jquery-rails(2.0.2) 71使用原生扩展安装pg(0.13.2) 72使用捆绑器(1.1.3) 73安装rails(3.2.2) 74安装sass(3.1.16) 75安装sass-rails(3.2.5) 76安装sqlite3(1.3.6) )与原生扩展 77安装uglifier(1.2.4) 78您的包已完成!使用`bundle show [gemname]`来查看捆绑的gem的安装位置。 79从rdoc发送邮件安装消息: 80根据您的ruby版本,您可能需要安装ruby rdoc / ri数据: 81 82 <= 1.8.6:不支持 83 = 1.8.7:gem install rdoc-data; rdoc-data --install 84 = 1.9.1:gem install rdoc-data; rdoc-data --install 85> = 1.9.2:无所事事!好极了! 86 87 88 $ rake db:migrate RAILS_ENV = test 89 == DeviseCreateUsers:migrating ================= ============================= 90-- create_table(:users) 91 - > 0.0174s 92-- add_index(:users,:email,{:unique => true}) 93 - > 0.0017s 94-- add_index(:users,:reset_password_token,{:unique => true}) 95 - > 0.0010s 96 == DeviseCreateUsers:迁移(0.0239s)================================== === 97 98 99 $ bundle exec rake 100您有1个未决迁移: 101 20120508052346 DeviseCreateUsers 102Run`rake db:migrate`更新你的数据库,然后再试一次。 103 104 105Done。生成脚本退出:1

我很感激任何建议! =]

解决方案

当我试图让我的Rails 3.2应用程序与Travis CI配合工作时,这篇博文帮助了我极大的帮助,实际工作的 .travis.yml 文件。这是我的参考,所以希望它有帮助: $ b

.travis.yml

语言:ruby rvm: - 1.9.2 - 1.9.3 env: - DB = sqlite - DB = mysql - DB = postgresql 脚本: - RAILS_ENV =测试包exec rake db:migrate --trace - bundle exec rake db:test :准备 - bundle exec rspec spec / before_script: - mysql -e'create database my_app_test' - psql -c'create database my_app_test'-U postgres bundler_args:--binstubs =。/ bundler_stubs

I'm trying to build my Ruby on Rails project from github on Travis-CI, but I 'm running into a migration problem. It runs a rake task for migration, but it complains about the same migration step after that.

It follows my .travis.yml file:

language: ruby rvm: - 1.9.2 before_script: - "rake db:migrate RAILS_ENV=test"

And here's the build output:

1Using worker: ruby4.worker.travis-ci:travis-ruby-3 2 3 4 5$ cd ~/builds 6 7 8$ git clone --depth=100 --quiet git://github/rafaelportela/bacilo.git rafaelportela/bacilo 9 10 11 12$ cd rafaelportela/bacilo 13 14$ git checkout -qf 7553b7351b7a642e39ea7b55204de6cd4f320c36 15 16 17$ export TRAVIS_RUBY_VERSION=1.9.2 18 19$ rvm use 1.9.2 20Using /home/vagrant/.rvm/gems/ruby-1.9.2-p290 21 22$ ruby --version 23ruby 1.9.2p290 (2011-07-09 revision 32553) [i686-linux] 24 25$ gem --version 261.8.17 27 28 29$ export BUNDLE_GEMFILE=/home/vagrant/builds/rafaelportela/bacilo/Gemfile 30 31$ bundle install 32Fetching gem metadata from rubygems/....... 33Using rake (0.9.2.2) 34Installing i18n (0.6.0) 35Installing multi_json (1.3.4) 36Installing activesupport (3.2.2) 37Installing builder (3.0.0) 38Installing activemodel (3.2.2) 39Installing erubis (2.7.0) 40Installing journey (1.0.3) 41Installing rack (1.4.1) 42Installing rack-cache (1.2) 43Installing rack-test (0.6.1) 44Installing hike (1.2.1) 45Installing tilt (1.3.3) 46Installing sprockets (2.1.3) 47Installing actionpack (3.2.2) 48Installing mime-types (1.18) 49Installing polyglot (0.3.3) 50Installing treetop (1.4.10) 51Installing mail (2.4.4) 52Installing actionmailer (3.2.2) 53Installing arel (3.0.2) 54Installing tzinfo (0.3.33) 55Installing activerecord (3.2.2) 56Installing activeresource (3.2.2) 57Installing bcrypt-ruby (3.0.1) with native extensions 58Installing coffee-script-source (1.3.1) 59Installing execjs (1.3.1) 60Installing coffee-script (2.2.0) 61Installing rack-ssl (1.3.2) 62Installing json (1.7.0) with native extensions 63Installing rdoc (3.12) 64Installing thor (0.14.6) 65Installing railties (3.2.2) 66Installing coffee-rails (3.2.2) 67Installing orm_adapter (0.0.7) 68Installing warden (1.1.1) 69Installing devise (2.0.4) 70Installing jquery-rails (2.0.2) 71Installing pg (0.13.2) with native extensions 72Using bundler (1.1.3) 73Installing rails (3.2.2) 74Installing sass (3.1.16) 75Installing sass-rails (3.2.5) 76Installing sqlite3 (1.3.6) with native extensions 77Installing uglifier (1.2.4) 78Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed. 79Post-install message from rdoc: 80Depending on your version of ruby, you may need to install ruby rdoc/ri data: 81 82<= 1.8.6 : unsupported 83 = 1.8.7 : gem install rdoc-data; rdoc-data --install 84 = 1.9.1 : gem install rdoc-data; rdoc-data --install 85>= 1.9.2 : nothing to do! Yay! 86 87 88$ rake db:migrate RAILS_ENV=test 89== DeviseCreateUsers: migrating ============================================== 90-- create_table(:users) 91 -> 0.0174s 92-- add_index(:users, :email, {:unique=>true}) 93 -> 0.0017s 94-- add_index(:users, :reset_password_token, {:unique=>true}) 95 -> 0.0010s 96== DeviseCreateUsers: migrated (0.0239s) ===================================== 97 98 99$ bundle exec rake 100You have 1 pending migrations: 101 20120508052346 DeviseCreateUsers 102Run `rake db:migrate` to update your database then try again. 103 104 105Done. Build script exited with: 1

I'd appreciate any suggestion! =]

解决方案

This blog post helped me tremendously when I was trying to get my Rails 3.2 app working with Travis CI, and write a .travis.yml file that actually worked. Here's mine for your reference, so hope it helps:

.travis.yml

language: ruby rvm: - 1.9.2 - 1.9.3 env: - DB=sqlite - DB=mysql - DB=postgresql script: - RAILS_ENV=test bundle exec rake db:migrate --trace - bundle exec rake db:test:prepare - bundle exec rspec spec/ before_script: - mysql -e 'create database my_app_test' - psql -c 'create database my_app_test' -U postgres bundler_args: --binstubs=./bundler_stubs

更多推荐

rake数据库:迁移不适用于travis

本文发布于:2023-10-27 00:19:52,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1531771.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:不适用于   数据库   rake   travis

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!