I have an application in rails 4.2.7.1, when I run the db:migrate in test in works perfectly
➜ bundle exec rake db:drop RAILS_ENV=test
➜ bundle exec rake db:ceate RAILS_ENV=test
➜ bundle exec rake db:migrate RAILS_ENV=test
But when I ran it in development, only the last migration or beginning from a drop database after executing firs migration I get this:
➜ bundle exec rake db:migrate -- --trace
== 20191112204156 MyNewModel: migrating ==============================
-- create_table(:global_clients)
-> 0.0121s
== 20191112204156 MyNewModel: migrated (0.0122s) =====================
rake aborted!
SystemStackError: stack level too deep
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
I'm using ruby 2.1.6, and mysql 0.318 and later 0.4.10, I did rvm implode to start it again and nothing happens. I do not know how to solve it, even I do not know how to debug it. So any tips will be good.
It's a problem with dthe difference from rais test and development environments
Related
this is what I get when I run the project
Hi, I'm working on a project.
When I run my project, I got this problem:
Migrations are pending. To resolve this issue, run:
bin/rake db:migrate RAILS_ENV=development
raise ActiveRecord::PendingMigrationError if ActiveRecord::Migrator.needs_migration?
(connection)
I've already tried several solutions below:
1)
rake db:drop
rake db:create
rake db:migrate
2) bundle exec rake db:migrate
3) bin/rake db:migrate RAILS_ENV=development
but they didn't work, and I got the same error over and over again.
What can I do?
Your first try was close, you need to do
rake db:drop
rake db:create
rake db:schema:load
Check this article it may be helpful.
http://icebergist.com/posts/rake-db-migrate-vs-rake-db-schema-load/
$ rm db/schema.rb
$ bundle exec rake db:drop
$ bundle exec rake db:create
$ bundle exec rake db:migrate
Or just rake db:reset. That always works for me, when I get stuck.
When I'm trying to install the plugins by Rake command I'm getting the below error can any one help?
rake redmine:plugins:migrate:RAILS_ENV=production
rake aborted!
Don't know how to build task 'redmine:plugins:migrate:RAILS_ENV'
Note that im using 2.2.0 version
The RAILS_ENV=production part should be prepended to your command.
Try:
RAILS_ENV=production bundle exec rake redmine:plugins:migrate
After this error in my web page when i have run > rake db:migrate. It shows error such as:
rake aborted!
you have already activated rake 10.1.1 but you gemfile requires rake 10.1.0 using bundle exec may solve this.
when i tried with bundle exec rake db:migrate it works.
And when i tried with the rake db:migrate. i shows error
My question is:
What is the difference between bundle exec rake db:migrate and rake db:migrate.
every time i have to do like this if yes then why?
What is the problem in my project.
Thanks.
bundle exec rake db:migrate will run rake db:migrate with the environment of your Gemfile.
You have an error because your Gemfile requires a version of rake but you have a newer one installed on your system.
By default, rake will run the latest available version, hence the mismatch.
You should always prefix your commands with bundle exec inside a project managed by bundler, I personally alias bx to bundle exec.
You can also use binstubs
Try to run bundle update.
It seems, that your Gemfile.lock is out of sync with your Gemfile.
I am standing up a new Ubuntu server running MySQL. I have Capistrano set up on my development server and am trying to deploy:cold after running deploy:setup. After the deploy script tries to run
executing "cd /home/adm1n/www/knowit/releases/20121112152400 && bundle exec rake RAILS_ENV=production RAILS_GROUPS=assets assets:precompile"
I keep getting this message:
Rake Aborted!
uninitialized constant knowit
Tasks: TOP => environment
Any idea where this constant would be defined? This project is almost entirely new (rails new app Blah). Any suggestions on how I should attempt to troubleshoot this? Thx.
I'm running:
Rake 0.9.2.2
Ruby 1.9.3p194
Capistrano 2.13.5
Bundler 1.1.5
Rails 3.2.8
rvm 1.15.7
UPDATE: knowit is the name of my app. So there apparently there is something not initializing. Not sure where how to troubleshoot this.
UPDATE: Here is my routes.rb file (very basic)
Knowit::Application.routes.draw do
match ':controller(/:action(/:id))(.:format)'
end
How can I create a production database in Rails 3 and load a schema to it?
I tried the following approaches...
I.
rake db:create Rails.env='production' && rake db:schema:load Rails.env='production'
II.
# config/environment.rb
# Set the rails environment
Rails.env='production'
rake db:create && rake db:schema:load
... but neither of them works.
Thanks.
Debian GNU/Linux 5.0.6;
Rails 3.0.0;
Sqlite3 3.7.2.
You can set the rails env off of the environment variable RAILS_ENV
RAILS_ENV=production bundle exec rake db:create db:schema:load
should work
Shouldn't this be
RAILS_ENV=production bundle exec rake db:create db:schema:load