Ruby on Rails Wednesday, January 27, 2016

i have problem with 'rake db:migrate'

i use this tutorial =>
http://www.tutorialspoint.com/ruby-on-rails/rails-routes.htm

form first step to this step.

when i type 'rake db:migrate' in my terminal.

i get this error =>

== 20160127215334 Books: migrating
============================================
-- create_table(:books)
rake aborted!
StandardError: An error has occurred, this and all later migrations
canceled:

PG::DuplicateTable: ERROR: relation "books" already exists
: CREATE TABLE "books" ("id" serial primary key, "title" character
varying(32) NOT NULL, "price" float, "subject_id" integer, "description"
text, "created_at" timestamp)
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/postgresql/database_statements.rb:155:in
`async_exec'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/postgresql/database_statements.rb:155:in
`block in execute'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract_adapter.rb:472:in
`block in log'
/var/lib/gems/2.1.0/gems/activesupport-4.2.5/lib/active_support/notifications/instrumenter.rb:20:in
`instrument'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract_adapter.rb:466:in
`log'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/postgresql/database_statements.rb:154:in
`execute'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/schema_statements.rb:208:in
`create_table'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:665:in
`block in method_missing'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:634:in
`block in say_with_time'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:634:in
`say_with_time'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:654:in
`method_missing'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:416:in
`method_missing'
/root/Desktop/Rails/library/db/migrate/20160127215334_books.rb:4:in `up'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:571:in
`up'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:611:in
`exec_migration'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:592:in
`block (2 levels) in migrate'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:591:in
`block in migrate'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:292:in
`with_connection'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:590:in
`migrate'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:768:in
`migrate'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:998:in
`block in execute_migration_in_transaction'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:1044:in
`block in ddl_transaction'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in
`block in transaction'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/transaction.rb:184:in
`within_new_transaction'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in
`transaction'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/transactions.rb:220:in
`transaction'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:1044:in
`ddl_transaction'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:997:in
`execute_migration_in_transaction'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:959:in
`block in migrate'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:955:in
`each'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:955:in
`migrate'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:823:in
`up'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:801:in
`migrate'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/tasks/database_tasks.rb:137:in
`migrate'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/railties/databases.rake:44:in
`block (2 levels) in <top (required)>'
ActiveRecord::StatementInvalid: PG::DuplicateTable: ERROR: relation
"books" already exists
: CREATE TABLE "books" ("id" serial primary key, "title" character
varying(32) NOT NULL, "price" float, "subject_id" integer, "description"
text, "created_at" timestamp)
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/postgresql/database_statements.rb:155:in
`async_exec'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/postgresql/database_statements.rb:155:in
`block in execute'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract_adapter.rb:472:in
`block in log'
/var/lib/gems/2.1.0/gems/activesupport-4.2.5/lib/active_support/notifications/instrumenter.rb:20:in
`instrument'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract_adapter.rb:466:in
`log'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/postgresql/database_statements.rb:154:in
`execute'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/schema_statements.rb:208:in
`create_table'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:665:in
`block in method_missing'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:634:in
`block in say_with_time'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:634:in
`say_with_time'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:654:in
`method_missing'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:416:in
`method_missing'
/root/Desktop/Rails/library/db/migrate/20160127215334_books.rb:4:in `up'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:571:in
`up'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:611:in
`exec_migration'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:592:in
`block (2 levels) in migrate'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:591:in
`block in migrate'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:292:in
`with_connection'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:590:in
`migrate'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:768:in
`migrate'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:998:in
`block in execute_migration_in_transaction'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:1044:in
`block in ddl_transaction'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in
`block in transaction'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/transaction.rb:184:in
`within_new_transaction'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in
`transaction'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/transactions.rb:220:in
`transaction'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:1044:in
`ddl_transaction'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:997:in
`execute_migration_in_transaction'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:959:in
`block in migrate'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:955:in
`each'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:955:in
`migrate'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:823:in
`up'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:801:in
`migrate'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/tasks/database_tasks.rb:137:in
`migrate'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/railties/databases.rake:44:in
`block (2 levels) in <top (required)>'
PG::DuplicateTable: ERROR: relation "books" already exists
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/postgresql/database_statements.rb:155:in
`async_exec'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/postgresql/database_statements.rb:155:in
`block in execute'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract_adapter.rb:472:in
`block in log'
/var/lib/gems/2.1.0/gems/activesupport-4.2.5/lib/active_support/notifications/instrumenter.rb:20:in
`instrument'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract_adapter.rb:466:in
`log'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/postgresql/database_statements.rb:154:in
`execute'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/schema_statements.rb:208:in
`create_table'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:665:in
`block in method_missing'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:634:in
`block in say_with_time'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:634:in
`say_with_time'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:654:in
`method_missing'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:416:in
`method_missing'
/root/Desktop/Rails/library/db/migrate/20160127215334_books.rb:4:in `up'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:571:in
`up'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:611:in
`exec_migration'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:592:in
`block (2 levels) in migrate'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:591:in
`block in migrate'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:292:in
`with_connection'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:590:in
`migrate'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:768:in
`migrate'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:998:in
`block in execute_migration_in_transaction'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:1044:in
`block in ddl_transaction'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in
`block in transaction'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/transaction.rb:184:in
`within_new_transaction'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in
`transaction'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/transactions.rb:220:in
`transaction'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:1044:in
`ddl_transaction'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:997:in
`execute_migration_in_transaction'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:959:in
`block in migrate'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:955:in
`each'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:955:in
`migrate'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:823:in
`up'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:801:in
`migrate'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/tasks/database_tasks.rb:137:in
`migrate'
/var/lib/gems/2.1.0/gems/activerecord-4.2.5/lib/active_record/railties/databases.rake:44:in
`block (2 levels) in <top (required)>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)


what i have to do now?

--
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 unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/008c63a5c5a33be320fd2fb03a730f06%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment