Ruby-on-Rails Tutorial Trouble -
i new both ruby , rails. may easy fix. i'm sorry if is.
i installed ruby-on-rails , started following tutorial on rubyonrails.org shows how make simple blog. running fine until got section 5.5. went run db:migrate , gave me error.
|d:\documents\programs\ruby\blog>rake db:migrate == 20141216061542 createarticles: migrating =================================== -- create_table(:articles) rake aborted! standarderror: error has occurred, , later migrations canceled: sqlite3::sqlexception: table "articles" exists: create table "articles" ("id" integer primary key autoincrement not null, "title" varchar(255), "text" text, "created_at" datetime, "updated_at" datetime) d:/documents/programs/ruby/blog/db/migrate/20141216061542_create_articles.rb:3:in `change ' c:in `migrate' activerecord::statementinvalid: sqlite3::sqlexception: table "articles" exists: create table "articles" ("id" integer primary key autoincrement not null, "title" varchar(255), "text" text, "created_at" datetime, "updated_at" datetime) d:/documents/programs/ruby/blog/db/migrate/20141216061542_create_articles.rb:3:in `change' c:in `migrate' sqlite3::sqlexception: table "articles" exists d:/documents/programs/ruby/blog/db/migrate/20141216061542_create_articles.rb:3:in `change' c:in `migrate' tasks: top => db:migrate (see full trace running task --trace)
i fired server see show , gave me this:
activerecord::pendingmigrationerror migrations pending. resolve issue, run: bin/rake db:migrate rails_env=development
it's been doing ever since. have tried starting on deleting project.(not entirely sure if move.) have tried looking on code. nothing have tried has given me hints on do.
is there way rid of these errors?
thank in advance.
edit: tried reset database 'rake db:reset', gave me this:
|d:\documents\programs\ruby\blog\app\views\articles>rake db:reset (in d:/documents/programs/ruby/blog) permission denied @ unlink_internal - d:/documents/programs/ruby/blog/db/development.sqlite3 c:/railsinstaller/ruby2.1.0/lib/ruby/2.1.0/fileutils.rb:1460:in `unlink' c:/railsinstaller/ruby2.1.0/lib/ruby/2.1.0/fileutils.rb:1460:in `block in remove_file' c:/railsinstaller/ruby2.1.0/lib/ruby/2.1.0/fileutils.rb:1468:in `platform_support' ... rake aborted! errno::eacces: permission denied @ unlink_internal - d:/documents/programs/ruby/blog/db/development. sqlite3 tasks: top => db:schema:load (see full trace running task --trace)
i shortened readability.
and here create_articles migration file:
class createarticles < activerecord::migration def change create_table :articles |t| t.timestamps end end end
you've created particular table. try terminal:
rake db:drop db:create db:migrate
or:
rake db:reset db:migrate
so basically, start database scratch, avoid current error.
note new migrations, run 'rake db:migrate' command otherwise existing data lost.
later on if come across problem in production environment, ensure 'something else' - surely wouldn't want sacrifice production database data.
Comments
Post a Comment