Error db: migrate - ruby-on-rails

After migrating the database to the new server from my application, when I run the command RAILS_ENV = production rake db: migrate, got the following error:
== AggregatedGlobalRolesMigrations: migrating ================================
-- add_column(:roles, :type, :string, {:limit=>30, :default=>"Role"})
rake aborted!
StandardError: An error has occurred, all later migrations canceled:
Mysql2::Error: Duplicate column name 'type': ALTER TABLE `roles` ADD `type` varchar(30) DEFAULT 'Role'/home/openproject/.rvm/gems/ruby-2.1.4/gems/activerecord-3.2.21/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:245:in `query'
/home/openproject/.rvm/gems/ruby-2.1.4/gems/activerecord-3.2.21/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:245:in `block in execute'
/home/openproject/.rvm/gems/ruby-2.1.4/gems/activerecord-3.2.21/lib/active_record/connection_adapters/abstract_adapter.rb:280:in `block in log'
/home/openproject/.rvm/gems/ruby-2.1.4/gems/activesupport-3.2.21/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/home/openproject/.rvm/gems/ruby-2.1.4/gems/activerecord-3.2.21/lib/active_record/connection_adapters/abstract_adapter.rb:275:in `log'
/home/openproject/.rvm/gems/ruby-2.1.4/gems/activerecord-3.2.21/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:245:in `execute'
/home/openproject/.rvm/gems/ruby-2.1.4/gems/activerecord-3.2.21/lib/active_record/connection_adapters/mysql2_adapter.rb:213:in `execute'
/home/openproject/.rvm/gems/ruby-2.1.4/gems/activerecord-3.2.21/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:461:in `add_column' ..........
Has anyone had similar problems and can help?

Clearly you already have a column type
type is used in ActiveRecord for STI... you could try using a different column name, say type_of, and see if that sorts it.

Related

Rails rake aborted!t.sqlite3 already exists

I'm reinstalling the paperclip gem but encountered an error when trying to run the migration. (Note: I only deleted the original migration file from text editor). Specifically, when I ran:
$ rake db:migrate
I encountered:
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:
SQLite3::SQLException: duplicate column name: image_file_name: ALTER TABLE "pins" ADD "image_file_name" varchar
c:/Users/Jaye/Desktop/inspireboard/db/migrate/20160929074428_add_attachment_image_to_pins.rb:4:in `block in up'
c:/Users/Jaye/Desktop/inspireboard/db/migrate/20160929074428_add_attachment_image_to_pins.rb:3:in `up'
c:in `migrate'
ActiveRecord::StatementInvalid: SQLite3::SQLException: duplicate column name: image_file_name: ALTER TABLE "pins" ADD "image_file_name" varchar
c:/Users/Jaye/Desktop/inspireboard/db/migrate/20160929074428_add_attachment_image_to_pins.rb:4:in `block in up'
c:/Users/Jaye/Desktop/inspireboard/db/migrate/20160929074428_add_attachment_image_to_pins.rb:3:in `up'
c:in `migrate'
SQLite3::SQLException: duplicate column name: image_file_name
c:/Users/Jaye/Desktop/inspireboard/db/migrate/20160929074428_add_attachment_image_to_pins.rb:4:in `block in up'
c:/Users/Jaye/Desktop/inspireboard/db/migrate/20160929074428_add_attachment_image_to_pins.rb:3:in `up'
c:in `migrate'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
After seeing the above, I tried to run rake db:drop , but encountered:
Permission denied # unlink_internal
Could anyone suggest how to work around this? (Note: I'm using Windows 8, rails 4.2.5.1, paperclip 4.3.7)
Appreciate a lot!
Removing the development.sqlite3 file and rerun db:migrate solved the problem!
Check if you close the Rails Server to run the rake db:drop. I was having the same issue, and then you reinstall the papperclip. I hope that I helped.

StandardError: An error has occurred, all later migrations canceled: Mysql2::Error: Table 'hiredjob_development.admins' doesn't exist:

I am a new ROR developer. We are developing an application using Rails and AngularJS. A brief background of what I was trying to do:
Another developer developed an application (partial) named hiredjob. I have to continue development with his application changing the name of the application to hiredtoday and also changing all the models from admin_X to X . For that following is the sequence of steps I follow:
Method 1:
Copy the old hiredjob application to a new application hiredtoday.
Delete all db/migrate.
rails generate devise admin.
rake db:migrate gives error
Error from rake db:migrate:
home/arshi/.rvm/gems/ruby-2.2.3/gems/devise-
3.5.2/lib/devise/rails/routes.rb:485:in `raise_no_devise_method_error!': Admin does not respond to 'devise' method. This usually means you haven't loaded your ORM file or it's being loaded too late. To fix it, be sure to require 'devise/orm/YOUR_ORM' inside 'config/initializers/devise.rb' or before your application definition in 'config/application.rb' (RuntimeError)
On searching solution for above on the internet, I comment devise_for :admins in config/route.rb
After which on running rake db:migrate again I got an error.
Error is as follow:
StandardError: An error has occurred, all later migrations canceled:
Mysql2::Error: Table 'hiredjob_development.admins' doesn't exist: ALTER TABLE 'admins' ADD 'email' varchar(255) DEFAULT '' NOT NULL/home/arshi/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.4/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:305:in `query'
/home/arshi/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.4/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:305:in `block in execute'
/home/arshi/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.4/lib/active_record/connection_adapters/abstract_adapter.rb:473:in `block in log'
/home/arshi/.rvm/gems/ruby-2.2.3/gems/activesupport-4.2.4/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/home/arshi/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.4/lib/active_record/connection_adapters/abstract_adapter.rb:467:in `log'
/home/arshi/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.4/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:305:in `execute'
/home/arshi/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.4/lib/active_record/connection_adapters/mysql2_adapter.rb:231:in `execute'
/home/arshi/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.4/lib/active_record/connection_adapters/abstract/schema_statements.rb:393:in `add_column'
/home/arshi/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.4/lib/active_record/connection_adapters/abstract/schema_definitions.rb:573:in `block (3 levels) in <class:Table>'
/home/arshi/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.4/lib/active_record/connection_adapters/abstract/schema_definitions.rb:572:in `each'
/home/arshi/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.4/lib/active_record/connection_adapters/abstract/schema_definitions.rb:572:in `block (2 levels) in <class:Table>'
Note: I have also tried to do run: rake db:drop db:create db:migrate. But still does not work.
i think you are getting this error because devise depends on the table already having been created. you need to:
1) delete the devise migration
2) write a migration to create the admins table http://guides.rubyonrails.org/active_record_migrations.html#creating-a-table
3) regenerate the devise migration.

Mysql2::Error: Table 'conversations' already exists

I'm getting this error after trying to update a gem (mailboxer) and removing it.
Mysql2::Error: Table 'conversations' already exists: CREATE TABLE conversations (id int(11) DEFAULT NULL auto_increment PRIMARY KEY, subject varchar(255) DEFAULT '', created_at datetime NOT NULL, updated_at datetime NOT NULL)
I tried:
Bundle exec rake db:migrate rollback then rake db:migrate
Bundle exec rake db:migrate v= xxxxxxxx then rake db:migrate
getting rid of the migration files (that worked but I don't like the though of just getting rid of code)
I do not want to loose my data and drop the tables.
Any thoughts?
Update:
Rake db:migrate:status
up 20140526010413 Adduserfollowme to users
up 20140703193119 Add vote weight to votes
up 20140713211140 Add partime to user
up 20140716024440 Add devise to admin users
up 20140716024510 Create active admin comments
up 20140727042518 ********** NO FILE **********
up 20140727051902 Add slug to activities
down 20140728031732 Create mailboxer.mailboxer engine
down 20140728031733 Add notified object.mailboxer engine
down 20140728031734 Add notification code.mailboxer engine
down 20140728031735 Add attachments.mailboxer engine
down 20140728031736 Rename receipts read.mailboxer engine
down 20140728031737 Add global notification support.mailboxer engine
rake db:rollback
== AddSlugToActivities: reverting ============================================
-- remove_index("activities", {:column=>:slug})
-> 0.0215s
-- remove_column("activities", :slug)
-> 0.0342s
== AddSlugToActivities: reverted (0.0559s) ===================================
Rake db:migrate
== AddSlugToActivities: migrating ============================================
-- add_column(:activities, :slug, :string)
-> 0.0266s
-- add_index(:activities, :slug)
-> 0.0104s
== AddSlugToActivities: migrated (0.0373s) ===================================
== CreateMailboxer: migrating ================================================
-- create_table(:conversations)
rake aborted!
StandardError: An error has occurred, all later migrations canceled:
Mysql2::Error: Table 'conversations' already exists: CREATE TABLE `conversations` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `subject` varchar(255) DEFAULT '', `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL) ENGINE=InnoDB/home/bill/apps/woomatch/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.12/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:243:in `query'
/home/bill/apps/woomatch/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.12/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:243:in `block in execute'
/home/bill/apps/woomatch/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.12/lib/active_record/connection_adapters/abstract_adapter.rb:280:in `block in log'
/home/bill/apps/woomatch/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.12/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/home/bill/apps/woomatch/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.12/lib/active_record/connection_adapters/abstract_adapter.rb:275:in `log'
/home/bill/apps/woomatch/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.12/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:243:in `execute'
/home/bill/apps/woomatch/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.12/lib/active_record/connection_adapters/mysql2_adapter.rb:211:in `execute'
/home/bill/apps/woomatch/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.12/lib/active_record/connection_adapters/abstract/schema_statements.rb:170:in `create_table'
/home/bill/apps/woomatch/shared/bundle/ruby/1.9.1/gems/foreigner-1.6.1/lib/foreigner/connection_adapters/abstract/schema_statements.rb:14:in `create_table'
/home/bill/apps/woomatch/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.12/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:432:in `create_table'
/home/bill/apps/woomatch/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.12/lib/active_record/migration.rb:466:in `block in method_missing'
/home/bill/apps/woomatch/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.12/lib/active_record/migration.rb:438:in `block in say_with_time'
/home/bill/apps/woomatch/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.12/lib/active_record/migration.rb:438:in `say_with_time'
/home/bill/apps/woomatch/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.12/lib/active_record/migration.rb:458:in `method_missing'
/home/bill/apps/woomatch/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.12/lib/active_record/migration.rb:334:in `method_missing'
/home/bill/apps/woomatch/releases/20140728100705/db/migrate/20140728031732_create_mailboxer.mailboxer_engine.rb:6:in `up'
/home/bill/apps/woomatch/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.12/lib/active_record/migration.rb:370:in `up'
/home/bill/apps/woomatch/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.12/lib/active_record/migration.rb:410:in `block (2 levels) in migrate'
/home/bill/apps/woomatch/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.12/lib/active_record/migration.rb:410:in `block in migrate'
/home/bill/apps/woomatch/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.12/lib/active_record/connection_adapters/abstract/connection_pool.rb:129:in `with_connection'
/home/bill/apps/woomatch/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.12/lib/active_record/migration.rb:389:in `migrate'
/home/bill/apps/woomatch/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.12/lib/active_record/migration.rb:528:in `migrate'
/home/bill/apps/woomatch/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.12/lib/active_record/migration.rb:720:in `block (2 levels) in migrate'
/home/bill/apps/woomatch/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.12/lib/active_record/migration.rb:777:in `call'
/home/bill/apps/woomatch/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.12/lib/active_record/migration.rb:777:in `ddl_transaction'
/home/bill/apps/woomatch/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.12/lib/active_record/migration.rb:719:in `block in migrate'
/home/bill/apps/woomatch/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.12/lib/active_record/migration.rb:700:in `each'
/home/bill/apps/woomatch/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.12/lib/active_record/migration.rb:700:in `migrate'
/home/bill/apps/woomatch/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.12/lib/active_record/migration.rb:570:in `up'
/home/bill/apps/woomatch/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.12/lib/active_record/migration.rb:551:in `migrate'
/home/bill/apps/woomatch/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.12/lib/active_record/railties/databases.rake:179:in `block (2 levels) in <top (required)>'
Tasks: TOP => db:migrate
What should I do next?
There is no rake db:migrate rollback, only rake db:rollback
Try rake db:migrate:status, then use rake db:rollback to make unwanted migrations to be down.
Sometimes when 'something went wrong' and you migrate-rollback a lot, it is necessary to comment up some lines, make migrate\rollback and incomment them again.
If it doesnt work, try show code of migrations that fail

Heroku pg migration error "PG:DataCorrupted: Error"

I am getting the following error when trying to run heroku run rake db:migrate. I have tried heroku pg:reset, I have tried heroku restart. I also tried creating a new app and starting over, but the problem persists. What could be the problem here?
Running `rake db:migrate` attached to terminal... up, run.7662
Migrating to CreateChannels (20140424224543)
== CreateChannels: migrating =================================================
-- create_table(:channels)
PG::DataCorrupted: ERROR: could not read block 0 in file "base/57396/12684": read only 0 of 8192 bytes
: CREATE TABLE "channels" ("id" serial primary key, "name" character varying(255), "user_id" integer, "created_at" timestamp, "updated_at" timestamp)
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:
PG::DataCorrupted: ERROR: could not read block 0 in file "base/57396/12684": read only 0 of 8192 bytes
: CREATE TABLE "channels" ("id" serial primary key, "name" character varying(255), "user_id" integer, "created_at" timestamp, "updated_at" timestamp) /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.2/lib/active_record/connection_adapters/postgresql/database_statements.rb:128:in `async_exec'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.2/lib/active_record/connection_adapters/postgresql/database_statements.rb:128:in `block in execute'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.2/lib/active_record/connection_adapters/abstract_adapter.rb:435:in `block in log'
/app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.2/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.2/lib/active_record/connection_adapters/abstract_adapter.rb:430:in `log'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.2/lib/active_record/connection_adapters/postgresql/database_statements.rb:127:in `execute'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.2/lib/active_record/connection_adapters/abstract/schema_statements.rb:190:in `create_table'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.2/lib/active_record/migration.rb:625:in `block in method_missing'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.2/lib/active_record/migration.rb:597:in `block in say_with_time'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.2/lib/active_record/migration.rb:597:in `say_with_time'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.2/lib/active_record/migration.rb:617:in `method_missing'
/app/db/migrate/20140424224543_create_channels.rb:3:in `change'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.2/lib/active_record/migration.rb:571:in `exec_migration'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.2/lib/active_record/migration.rb:555:in `block (2 levels) in migrate'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.2/lib/active_record/migration.rb:554:in `block in migrate'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:294:in `with_connection'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.2/lib/active_record/migration.rb:553:in `migrate'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.2/lib/active_record/migration.rb:709:in `migrate'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.2/lib/active_record/migration.rb:959:in `block in execute_migration_in_transaction'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.2/lib/active_record/migration.rb:1005:in `block in ddl_transaction'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.2/lib/active_record/connection_adapters/abstract/database_statements.rb:202:in `block in transaction'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.2/lib/active_record/connection_adapters/abstract/database_statements.rb:210:in `within_new_transaction'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.2/lib/active_record/connection_adapters/abstract/database_statements.rb:202:in `transaction'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.2/lib/active_record/transactions.rb:209:in `transaction'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.2/lib/active_record/migration.rb:1005:in `ddl_transaction'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.2/lib/active_record/migration.rb:958:in `execute_migration_in_transaction'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.2/lib/active_record/migration.rb:920:in `block in migrate'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.2/lib/active_record/migration.rb:916:in `each'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.2/lib/active_record/migration.rb:916:in `migrate'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.2/lib/active_record/migration.rb:764:in `up'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.2/lib/active_record/migration.rb:742:in `migrate'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.2/lib/active_record/railties/databases.rake:42:in `block (2 levels) in <top (required)>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
[Edit] My migration file for creating the channels table looks like the following (Nothing out of the ordinary)
class CreateChannels < ActiveRecord::Migration
def change
create_table :channels do |t|
t.string :name
t.integer :user_id
t.timestamps
end
end
end
I had the same issue, I deleted the database from https://dashboard.heroku.com/apps (this was Navy)
Added a new PG Database (this was blue)
From the terminal ran:
heroku config
You should see your db url
heroku config:set DATABASE_URL=postgres://your-db-url
Ran
heroku run rake db:migrate
And everything worked.
I am still not sure why that happened!
I contacted heroku support team last night, I was having the same issue, everything is back to normal now. bellow is their response.
Unfortunately, it looks like there was an issue with your database
last night which caused an outage for a couple hours, however it's
since been recovered by one of our on-call database engineers. This
issue wasn't caused by you at all, it was a hardware failure on the
host server.
Hope this helps.
I'm now having the same issue. I didn't have any production data so will just set up a new database. Very annoying though
Edit: Has just fixed itself when I ran the migration again
Edit 2: Is still broken. When I tried to run my second migration file I get the error
PG::DataCorrupted: ERROR: could not read block 1 in file "base/117039/12684": read only 0 of 8192 bytes
Very annoying
Just tried to file a ticket on Heroku. Filled out the form with loads of information and submitted only to get a message to say that I have not created any support tickets!

Rails STI model without a table on migrations

I've got a model, say User, and a model Admin which inherits from User. I have some code in lib folder which uses those two models. But if I install a new database and try to run the migrations rails crashes saying that there is no such model as User. Are there any best practices to bypass this error?
`Mysql2::Error: Table 'testing_interface_development.users' doesn't exist: SHOW FULL FIELDS FROM `users`
/home/arthurborisow/Programming/my_project/test_interface/lib/active_record/timed_out_queries_hotfix.rb:9:in `query'
/home/arthurborisow/Programming/my_project/test_interface/lib/active_record/timed_out_queries_hotfix.rb:9:in `query_with_reconnect'
/home/arthurborisow/Programming/my_project/test_interface/lib/active_record/timed_out_queries_hotfix.rb:31:in `block in execute'
/home/arthurborisow/.rvm/gems/ruby-1.9.3-p362-railsexpress#test_interface_install/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract_adapter.rb:280:in `block in log'
/home/arthurborisow/.rvm/gems/ruby-1.9.3-p362-railsexpress#test_interface_install/gems/activesupport-3.2.11/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/home/arthurborisow/.rvm/gems/ruby-1.9.3-p362-railsexpress#test_interface_install/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract_adapter.rb:275:in `log'
/home/arthurborisow/Programming/my_project/test_interface/lib/active_record/timed_out_queries_hotfix.rb:31:in `execute'
/home/arthurborisow/.rvm/gems/ruby-1.9.3-p362-railsexpress#test_interface_install/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:259:in `execute_and_free'
/home/arthurborisow/.rvm/gems/ruby-1.9.3-p362-railsexpress#test_interface_install/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:426:in `columns'
/home/arthurborisow/.rvm/gems/ruby-1.9.3-p362-railsexpress#test_interface_install/gems/activerecord-3.2.11/lib/active_record/connection_adapters/schema_cache.rb:12:in `block in initialize'
/home/arthurborisow/.rvm/gems/ruby-1.9.3-p362-railsexpress#test_interface_install/gems/activerecord-3.2.11/lib/active_record/model_schema.rb:228:in `yield'
/home/arthurborisow/.rvm/gems/ruby-1.9.3-p362-railsexpress#test_interface_install/gems/activerecord-3.2.11/lib/active_record/model_schema.rb:228:in `columns'
/home/arthurborisow/.rvm/gems/ruby-1.9.3-p362-railsexpress#test_interface_install/gems/activerecord-3.2.11/lib/active_record/model_schema.rb:237:in `columns_hash'
/home/arthurborisow/.rvm/gems/ruby-1.9.3-p362-railsexpress#test_interface_install/gems/activerecord-3.2.11/lib/active_record/inheritance.rb:19:in `descends_from_active_record?'
/home/arthurborisow/.rvm/gems/ruby-1.9.3-p362-railsexpress#test_interface_install/gems/activerecord-3.2.11/lib/active_record/inheritance.rb:25:in `finder_needs_type_condition?'
/home/arthurborisow/.rvm/gems/ruby-1.9.3-p362-railsexpress#test_interface_install/gems/activerecord-3.2.11/lib/active_record/base.rb:455:in `relation'
/home/arthurborisow/.rvm/gems/ruby-1.9.3-p362-railsexpress#test_interface_install/gems/activerecord-3.2.11/lib/active_record/scoping/named.rb:37:in `scoped'
/home/arthurborisow/.rvm/gems/ruby-1.9.3-p362-railsexpress#test_interface_install/gems/activerecord-3.2.11/lib/active_record/querying.rb:9:in `where'
/home/arthurborisow/Programming/my_project/test_interface/app/models/admin.rb:15:in `<class:Admin>'
/home/arthurborisow/Programming/my_project/test_interface/app/models/admin.rb:1:in `<top (required)>'`
When setting up a completely fresh database (instead of upgrading your existing one), it is better to use rake db:setup to load the schema.rb file instead of running each migration in succession. This question explains the various db Rake tasks pretty well:
Difference between rake db:migrate db:reset and db:schema:load
rake db:setup
Is the best option also,
You can also specify your migration version which do you want to migrate using below command:
rake db:migrate:up VERSION=20080906120000

Resources