I've rails app that has some migrations. When I hit rake db:migrate:status
to see what status is set, all except ********** NO FILE **********
were down. But the migrations have already made, so there seems no problem about model side. Here are files may help to explain:
Output of rake db:migrate:status
:
up 20130727003912 ********** NO FILE **********
down 20130728000151 Devise create users
down 20130728000335 Create friends
down 20130728000346 Create addresses
down 20130728000356 Create authies
down 20130728000413 Add indexes
At this time, rake db:migrate
output:
== DeviseCreateUsers: migrating ==============================================
-- create_table(:users)
NOTICE: CREATE TABLE will create implicit sequence "users_id_seq1" for serial column "users.id"
rake aborted!
An error has occurred, this and all later migrations canceled:
PG::DuplicateTable: ERROR: relation "users" already exists
: CREATE TABLE "users" ("id" serial primary key, "username" character varying(255), "email" character varying(255) DEFAULT '' NOT NULL, "encrypted_password" character varying(255) DEFAULT '' NOT NULL, "reset_password_token" character varying(255), "reset_password_sent_at" timestamp, "remember_created_at" timestamp, "sign_in_count" integer DEFAULT 0, "current_sign_in_at" timestamp, "last_sign_in_at" timestamp, "current_sign_in_ip" character varying(255), "last_sign_in_ip" character varying(255), "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) /home/ekrem/workspace/contactman/db/migrate/20130728000151_devise_create_users.rb:3:in `change'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
db/schema.rb
:
ActiveRecord::Schema.define(:version => 20130727003912) do
create_table "addresses", :force => true do |t|
t.string "title"
t.text "address"
t.string "phone"
t.string "city"
t.integer "friend_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "slug"
t.string "country"
end
add_index "addresses", ["friend_id"], :name => "index_addresses_on_friend_id"
add_index "addresses", ["slug"], :name => "index_addresses_on_slug", :unique => true
create_table "authies", :force => true do |t|
t.string "provider"
t.string "uid"
t.integer "user_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
add_index "authies", ["user_id"], :name => "index_authies_on_user_id"
create_table "friends", :force => true do |t|
t.string "name"
t.string "surname"
t.integer "user_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "slug"
t.string "imported_file_name"
t.string "imported_content_type"
t.integer "imported_file_size"
t.datetime "imported_updated_at"
end
add_index "friends", ["slug"], :name => "index_friends_on_slug", :unique => true
add_index "friends", ["user_id"], :name => "index_friends_on_user_id"
create_table "users", :force => true do |t|
t.string "email", :default => "", :null => false
t.string "encrypted_password", :default => "", :null => false
t.string "reset_password_token"
t.datetime "reset_password_sent_at"
t.datetime "remember_created_at"
t.integer "sign_in_count", :default => 0
t.datetime "current_sign_in_at"
t.datetime "last_sign_in_at"
t.string "current_sign_in_ip"
t.string "last_sign_in_ip"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "username"
end
add_index "users", ["email"], :name => "index_users_on_email", :unique => true
add_index "users", ["reset_password_token"], :name => "index_users_on_reset_password_token", :unique => true
end
How can I fix this issue to make all migrations seem up?