Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8695029
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T00:55:51+00:00 2026-06-13T00:55:51+00:00

Hi every one i’m new on ruby on rails so i got this problem

  • 0

Hi every one i’m new on ruby on rails so i got this problem with rake db:migrate
So i use –trace up on it to understand but i didn’t get a clue of what to do .
i put my migrate .rb file below.

 $ rake db:migrate --trace
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Invoke db:load_config (first_time)
** Execute db:load_config
** Execute db:migrate
==  AlterUsers: migrating =====================================================
-- rename_table("users", "admin_users")
rake aborted!
An error has occurred, all later migrations canceled:

Mysql2::Error: Table 'admin_users' already exists: RENAME TABLE `users` TO `admin_users`
/Library/Ruby/Gems/1.8/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:245:in `query'
/Library/Ruby/Gems/1.8/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:245:in `execute'
/Library/Ruby/Gems/1.8/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract_adapter.rb:280:in `log'
/Library/Ruby/Gems/1.8/gems/activesupport-3.2.8/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/Library/Ruby/Gems/1.8/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract_adapter.rb:275:in `log'
/Library/Ruby/Gems/1.8/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:245:in `execute'
/Library/Ruby/Gems/1.8/gems/activerecord-3.2.8/lib/active_record/connection_adapters/mysql2_adapter.rb:211:in `execute'
/Library/Ruby/Gems/1.8/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:457:in `rename_table'
/Library/Ruby/Gems/1.8/gems/activerecord-3.2.8/lib/active_record/migration.rb:466:in `send'
/Library/Ruby/Gems/1.8/gems/activerecord-3.2.8/lib/active_record/migration.rb:466:in `method_missing'
/Library/Ruby/Gems/1.8/gems/activerecord-3.2.8/lib/active_record/migration.rb:438:in `say_with_time'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/benchmark.rb:293:in `measure'
/Library/Ruby/Gems/1.8/gems/activerecord-3.2.8/lib/active_record/migration.rb:438:in `say_with_time'
/Library/Ruby/Gems/1.8/gems/activerecord-3.2.8/lib/active_record/migration.rb:458:in `method_missing'
/Users/seydoukonate/Sites/simple_cms/db/migrate/20121015072622_alter_users.rb:3:in `up'
/Library/Ruby/Gems/1.8/gems/activerecord-3.2.8/lib/active_record/migration.rb:410:in `send'
/Library/Ruby/Gems/1.8/gems/activerecord-3.2.8/lib/active_record/migration.rb:410:in `migrate'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/benchmark.rb:293:in `measure'
/Library/Ruby/Gems/1.8/gems/activerecord-3.2.8/lib/active_record/migration.rb:410:in `migrate'
/Library/Ruby/Gems/1.8/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:123:in `with_connection'
/Library/Ruby/Gems/1.8/gems/activerecord-3.2.8/lib/active_record/migration.rb:389:in `migrate'
/Library/Ruby/Gems/1.8/gems/activerecord-3.2.8/lib/active_record/migration.rb:528:in `__send__'
/Library/Ruby/Gems/1.8/gems/activerecord-3.2.8/lib/active_record/migration.rb:528:in `migrate'
/Library/Ruby/Gems/1.8/gems/activerecord-3.2.8/lib/active_record/migration.rb:720:in `migrate'
/Library/Ruby/Gems/1.8/gems/activerecord-3.2.8/lib/active_record/migration.rb:777:in `call'
/Library/Ruby/Gems/1.8/gems/activerecord-3.2.8/lib/active_record/migration.rb:777:in `ddl_transaction'
/Library/Ruby/Gems/1.8/gems/activerecord-3.2.8/lib/active_record/migration.rb:719:in `migrate'
/Library/Ruby/Gems/1.8/gems/activerecord-3.2.8/lib/active_record/migration.rb:700:in `each'
/Library/Ruby/Gems/1.8/gems/activerecord-3.2.8/lib/active_record/migration.rb:700:in `migrate'
/Library/Ruby/Gems/1.8/gems/activerecord-3.2.8/lib/active_record/migration.rb:570:in `up'
/Library/Ruby/Gems/1.8/gems/activerecord-3.2.8/lib/active_record/migration.rb:551:in `migrate'
/Library/Ruby/Gems/1.8/gems/activerecord-3.2.8/lib/active_record/railties/databases.rake:153
/Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'
/Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `execute'
/Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
/Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
/Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `invoke_with_call_chain'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
/Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task'
/Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `top_level'
/Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each'
/Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `top_level'
/Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'
/Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `run'
/Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/bin/rake:33
/usr/bin/rake:23:in `load'
/usr/bin/rake:23
Tasks: TOP => db:migrate

Here is whats inside my _create_user.rb file.

class CreateUsers < ActiveRecord::Migration
  def change
    create_table :users do |t|

      t.string "first_name", :limit => 25
      t.string "last_name", :limit => 50
      t.string "email", :default => "", :null => false
      t.string "password", :limit => 40
      t.timestamps
    end
  end
  def self.down
    drop_table :users
  end
end

and here is what is inside alter_user.rb file

class AlterUsers < ActiveRecord::Migration
  def up
    rename_table("users", "admin_users")
    add_column("admin_users", "username", :string, :limit => 25)
    change_column("admin_users", "email", :string, :limit => 100)
    rename_column("admin_users", "password", "hashed_password")
    add_column("admin_users", "salt", :string, :limit => 40)
    puts "*** About to add and index ***"
    add_index("admin_users", "username")
  end

  def down
    remove_index("admin_users", "username")
    remove_column("admin_users", "salt")
    rename_column("admin_users", "hashed_apssword", "password")
    change_column("admin_users", "email", :string, :default => "", :null => false)
    remove_column("admin_users", "username")
    rename_table("admin_users", "users")
  end
end
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T00:55:52+00:00Added an answer on June 13, 2026 at 12:55 am

    You probably have devise gem installed which already created a table named admin_users.

    You either need to remove the table admin_users (and corresponding migration file) before your run the alter; or you can rename users to something else than admin_users

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi to every one I'm new with symfony2, and i got two questions, the
hello every one i face this problem and iam too weak in DB i
every one i m new with ASP .net and I dont know how to
hii every one i am new to iphone , can any one tell me
Hi every one I have the following problem I need to build a vector
hi every one I'm using this code, through this I'm getting wrong time,i need
I use try catch statements in almost every one of my insert or update
every one i am having a problem in greybox when the box/popup appears,there are
Hello every one this is extension to my previous question.Here is the link File
Hi every one I have an XML file, it's contain same tags like this:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.