S Ahmed
2012-Feb-18 16:42 UTC
rake db:reset doesn''t work, fails with unknown attribute: user_status
If I manually drop the database, and run create, then migrate it works fine. But doing a: rake db:reset it fails with: unknown attribute: user_status Does this mean my migrations are not dropping things correctly? -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Colin Law
2012-Feb-18 17:05 UTC
Re: rake db:reset doesn''t work, fails with unknown attribute: user_status
On 18 February 2012 16:42, S Ahmed <sahmed1020-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> If I manually drop the database, and run create, then migrate it works fine. > > But doing a: > > rake db:reset > > it fails with: > > unknown attribute: user_status > > > Does this mean my migrations are not dropping things correctly?I believe that rake db:reset re-creates the db and loads the schema from schema.rb rather than running the migrations [1]. Is there something odd in schema.rb, possibly related to user_status? [1] http://guides.rubyonrails.org/migrations.html#resetting-the-database Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Robert Walker
2012-Feb-18 21:51 UTC
Re: rake db:reset doesn''t work, fails with unknown attribute: user_status
Colin Law wrote in post #1047551:> On 18 February 2012 16:42, S Ahmed <sahmed1020-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> >> Does this mean my migrations are not dropping things correctly? > > I believe that rake db:reset re-creates the db and loads the schema > from schema.rb rather than running the migrations [1]. Is there > something odd in schema.rb, possibly related to user_status? > > [1] http://guides.rubyonrails.org/migrations.html#resetting-the-databaseYou might also try: rake db:migrate:reset As I understand it that will actually drop the database and recreate it by running all your migration. This should then also recreate your schema.rb file. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
S Ahmed
2012-Feb-19 01:43 UTC
Re: Re: rake db:reset doesn''t work, fails with unknown attribute: user_status
It would be nice if there was a way to mirror things to RAILS_ENV=test also. I hate having to do it for both. On Sat, Feb 18, 2012 at 4:51 PM, Robert Walker <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Colin Law wrote in post #1047551: > > On 18 February 2012 16:42, S Ahmed <sahmed1020-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > >> > >> Does this mean my migrations are not dropping things correctly? > > > > I believe that rake db:reset re-creates the db and loads the schema > > from schema.rb rather than running the migrations [1]. Is there > > something odd in schema.rb, possibly related to user_status? > > > > [1] http://guides.rubyonrails.org/migrations.html#resetting-the-database > > You might also try: > > rake db:migrate:reset > > As I understand it that will actually drop the database and recreate it > by running all your migration. This should then also recreate your > schema.rb file. > > -- > Posted via http://www.ruby-forum.com/. > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Peter Vandenabeele
2012-Feb-19 13:06 UTC
Re: rake db:reset doesn''t work, fails with unknown attribute: user_status
On Sat, Feb 18, 2012 at 5:42 PM, S Ahmed <sahmed1020-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> If I manually drop the database, and run create, then migrate it works > fine. > > But doing a: > > rake db:reset > > it fails with: > > unknown attribute: user_status > > > Does this mean my migrations are not dropping things correctly? >First thing to do seems to check with --trace. $ rake --trace db:reset and study the order of execution of rake tasks in detail until the point where it fails ... HTH, Peter -- *** Available for a new project *** Peter Vandenabeele http://twitter.com/peter_v http://rails.vandenabeele.com http://coderwall.com/peter_v -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Dheeraj Kumar
2012-Feb-19 15:02 UTC
Re: rake db:reset doesn''t work, fails with unknown attribute: user_status
Why doesn''t rake -T show db:reset? Where can I find a list of these hidden rake commands? On Feb 19, 2012 6:36 PM, "Peter Vandenabeele" <peter-jNuWw7i2w7syMbTcgqFhxg@public.gmane.org> wrote:> On Sat, Feb 18, 2012 at 5:42 PM, S Ahmed <sahmed1020-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > >> If I manually drop the database, and run create, then migrate it works >> fine. >> >> But doing a: >> >> rake db:reset >> >> it fails with: >> >> unknown attribute: user_status >> >> >> Does this mean my migrations are not dropping things correctly? >> > > First thing to do seems to check with --trace. > > $ rake --trace db:reset > > and study the order of execution of rake tasks in detail until the > point where it fails ... > > HTH, > > Peter > > -- > *** Available for a new project *** > > Peter Vandenabeele > http://twitter.com/peter_v > http://rails.vandenabeele.com > http://coderwall.com/peter_v > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Peter Vandenabeele
2012-Feb-19 16:30 UTC
Re: rake db:reset doesn''t work, fails with unknown attribute: user_status
On Sun, Feb 19, 2012 at 4:02 PM, Dheeraj Kumar <a.dheeraj.kumar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>wrote:> Why doesn''t rake -T show db:reset? >Because the `desc` is not defined or is commented out. Where can I find a list of these hidden rake commands?>Checking these files could help you. The migration tasks are in the first one. peterv@ASUS:~/b/github/rails/rails$ find . -name ''*.rake'' ./activerecord/lib/active_record/railties/databases.rake ./actionpack/lib/sprockets/assets.rake ./railties/lib/rails/tasks/framework.rake ./railties/lib/rails/tasks/log.rake ./railties/lib/rails/tasks/tmp.rake ./railties/lib/rails/tasks/annotations.rake ./railties/lib/rails/tasks/routes.rake ./railties/lib/rails/tasks/middleware.rake ./railties/lib/rails/tasks/engine.rake ./railties/lib/rails/tasks/documentation.rake ./railties/lib/rails/tasks/misc.rake ./railties/lib/rails/tasks/statistics.rake ./railties/lib/rails/generators/rails/plugin_new/templates/lib/tasks/%name%_tasks.rake ./railties/lib/rails/test_unit/testing.rake As you will see, some tasks have no `desc` above them, or the `desc` is commented out (probably because it is not intended as a public available command). E.g. `rake db:reset` is defined as such: db_namespace = namespace :db do ... # desc ''Drops and recreates the database from db/schema.rb for the current env ironment and loads the seeds.'' task :reset => :environment do db_namespace["drop"].invoke db_namespace["setup"].invoke end ... end with the `desc` commented out. and `rake db:migrate:reset` as such: db_namespace = namespace :db do ... namespace :migrate do ... # desc ''Resets your database using your migrations for the current environment'' task :reset => [''db:drop'', ''db:create'', ''db:migrate''] ... end ... end HTH, Peter -- *** Available for a new project *** Peter Vandenabeele http://twitter.com/peter_v http://rails.vandenabeele.com http://coderwall.com/peter_v -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.