2017-06-07 8 views
1

J'essaie d'installer une instance de Sharetribe sur un dyno heroku. Je suis au point où j'essaye de créer la base de données. J'ai d'abord essayé rake db: migrate et cela a fonctionné pour la plupart des migrations mais échoué sur l'un d'entre eux.Heroku rake db: structure: charger avec cleardb ne peut pas trouver 'mysql'

On m'a conseillé d'utiliser rake db: structure: load, alors j'ai essayé et j'ai reçu une erreur de Heroku disant que mysql doit être ajouté à la variable PATH. Pourquoi est-ce, et comment puis-je le réparer? Je ne sais pas pourquoi cela se produit sur db: schema: load et db: structure: load mais pas sur db: migrate.

La trace de la pile avec le message d'erreur est:

rake aborted! 
failed to execute: 
mysqlPlease check the output above for any errors and make sure that `mysql` is installed in your PATH and has proper permissions. 

/app/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/tasks/mysql_database_tasks.rb:148:in `run_cmd' 
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/tasks/mysql_database_tasks.rb:72:in `structure_load' 
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/tasks/database_tasks.rb:189:in `structure_load' 
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/tasks/database_tasks.rb:222:in `load_schema_for' 
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/tasks/database_tasks.rb:236:in `block in load_schema_current' 
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/tasks/database_tasks.rb:276:in `block in each_current_configuration' 
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/tasks/database_tasks.rb:275:in `each' 
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/tasks/database_tasks.rb:275:in `each_current_configuration' 
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/tasks/database_tasks.rb:235:in `load_schema_current' 
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.7.1/lib/active_record/railties/databases.rake:293:in `block (3 levels) in <top (required)>' 
/app/vendor/bundle/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/cli/exec.rb:74:in `load' 
/app/vendor/bundle/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/cli/exec.rb:74:in `kernel_load' 
/app/vendor/bundle/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/cli/exec.rb:27:in `run' 
/app/vendor/bundle/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/cli.rb:332:in `exec' 
/app/vendor/bundle/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run' 
/app/vendor/bundle/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command' 
/app/vendor/bundle/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/vendor/thor/lib/thor.rb:359:in `dispatch' 
/app/vendor/bundle/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/cli.rb:20:in `dispatch' 
/app/vendor/bundle/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/vendor/thor/lib/thor/base.rb:440:in `start' 
/app/vendor/bundle/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/cli.rb:11:in `start' 
/app/vendor/bundle/ruby/2.3.0/gems/bundler-1.13.7/exe/bundle:34:in `block in <top (required)>' 
/app/vendor/bundle/ruby/2.3.0/gems/bundler-1.13.7/lib/bundler/friendly_errors.rb:100:in `with_friendly_errors' 
/app/vendor/bundle/ruby/2.3.0/gems/bundler-1.13.7/exe/bundle:26:in `<top (required)>' 
/app/bin/bundle:3:in `load' 
/app/bin/bundle:3:in `<main>' 
Tasks: TOP => db:structure:load 
(See full trace by running task with --trace) 

Merci!

Répondre

-1

Heroku ne prend pas en charge mysql, vous devez utiliser pg gem dans votre gemfile dans le bloc de production. Veuillez lire Getting Started with Rails 5.x on Heroku

+0

Oui, je suis conscient que Heroku ne héberge pas eux-mêmes bases de données MySQL. J'essaie de me connecter à une base de données cloud hébergée avec ClearDB via l'extension Heroku ClearDB. C'est absolument possible et peopel le fait, mais je ne suis pas sûr pourquoi il y a un problème avec cela dans ce cas. – CanadaIT

+0

Donc je suppose que vous avez terminé toutes les étapes à partir d'ici https://devcenter.heroku.com/articles/cleardb est-ce? Et avez-vous supprimé/supprimé pg gem et/ou addon? –

+0

Je l'ai fait, mais heroku n'a jamais affiché l'addon postgres comme existant sur mon dyno. – CanadaIT

0

Si vous devez exécuter heroku run bundle exec rake db:structure:load que vous avez besoin d'installer le client mysql. Pour installer des packages supplémentaires, vous devez ajouter Buildpacks (officiel ou communautaire).

Pour MySQL j'ai utilisé avec succès https://github.com/din-co/heroku-buildpack-mysql

heroku buildpacks:add --index 1 https://github.com/din-co/heroku-buildpack-mysql 
git commit --amend --allow-empty --no-edit 
git push heroku -f