0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

devise

Last updated at Posted at 2020-06-24

asatokensei@MacBook-Air tomalog % rake db:migrate:reset                              
Dropped database 'tomalog_development'
Dropped database 'tomalog_test'
Created database 'tomalog_development'
Created database 'tomalog_test'
== 20200618130702 CreateUsers: migrating ======================================
-- create_table(:users)
   -> 0.0134s
== 20200618130702 CreateUsers: migrated (0.0135s) =============================

== 20200619021757 AddPasswordDigestToUsers: migrating =========================
-- add_column(:users, :password_digest, :string)
   -> 0.0183s
== 20200619021757 AddPasswordDigestToUsers: migrated (0.0184s) ================

== 20200620002508 AddRememberDigestToUsers: migrating =========================
-- add_column(:users, :remember_digest, :string)
   -> 0.0151s
== 20200620002508 AddRememberDigestToUsers: migrated (0.0151s) ================

== 20200620101945 AddAdminToUsers: migrating ==================================
-- add_column(:users, :admin, :boolean)
   -> 0.0144s
== 20200620101945 AddAdminToUsers: migrated (0.0145s) =========================

== 20200621004334 CreatePosts: migrating ======================================
-- create_table(:posts)
   -> 0.0114s
-- add_index(:posts, [:user_id, :created_at])
   -> 0.0146s
== 20200621004334 CreatePosts: migrated (0.0261s) =============================

== 20200621124425 AddImageToPosts: migrating ==================================
-- add_column(:posts, :image, :string)
   -> 0.0155s
== 20200621124425 AddImageToPosts: migrated (0.0157s) =========================

== 20200624083831 AddDeviseToUsers: migrating =================================
-- change_table(:users)
rake aborted!
StandardError: An error has occurred, all later migrations canceled:

Mysql2::Error: Duplicate column name 'email': ALTER TABLE `users` ADD `email` varchar(255) DEFAULT '' NOT NULL
/Users/asatokensei/tomalog/db/migrate/20200624083831_add_devise_to_users.rb:7:in `block in up'
/Users/asatokensei/tomalog/db/migrate/20200624083831_add_devise_to_users.rb:5:in `up'

Caused by:
ActiveRecord::StatementInvalid: Mysql2::Error: Duplicate column name 'email': ALTER TABLE `users` ADD `email` varchar(255) DEFAULT '' NOT NULL
/Users/asatokensei/tomalog/db/migrate/20200624083831_add_devise_to_users.rb:7:in `block in up'
/Users/asatokensei/tomalog/db/migrate/20200624083831_add_devise_to_users.rb:5:in `up'

Caused by:
Mysql2::Error: Duplicate column name 'email'
/Users/asatokensei/tomalog/db/migrate/20200624083831_add_devise_to_users.rb:7:in `block in up'
/Users/asatokensei/tomalog/db/migrate/20200624083831_add_devise_to_users.rb:5:in `up'
Tasks: TOP => db:migrate:reset => db:migrate
(See full trace by running task with --trace)

スクリーンショット 2020-06-24 18.19.53.png
has_secure_password
asatokensei@MacBook-Air tomalog % rake db:migrate:reset
Dropped database 'tomalog_development'
Dropped database 'tomalog_test'
Created database 'tomalog_development'
Created database 'tomalog_test'
== 20200618130702 CreateUsers: migrating ======================================
-- create_table(:users)
   -> 0.0141s
== 20200618130702 CreateUsers: migrated (0.0141s) =============================

== 20200619021757 AddPasswordDigestToUsers: migrating =========================
-- add_column(:users, :password_digest, :string)
   -> 0.0205s
== 20200619021757 AddPasswordDigestToUsers: migrated (0.0207s) ================

== 20200620002508 AddRememberDigestToUsers: migrating =========================
-- add_column(:users, :remember_digest, :string)
   -> 0.0179s
== 20200620002508 AddRememberDigestToUsers: migrated (0.0180s) ================

== 20200620101945 AddAdminToUsers: migrating ==================================
-- add_column(:users, :admin, :boolean)
   -> 0.0184s
== 20200620101945 AddAdminToUsers: migrated (0.0185s) =========================

== 20200621004334 CreatePosts: migrating ======================================
-- create_table(:posts)
   -> 0.0134s
-- add_index(:posts, [:user_id, :created_at])
   -> 0.0156s
== 20200621004334 CreatePosts: migrated (0.0291s) =============================

== 20200621124425 AddImageToPosts: migrating ==================================
-- add_column(:posts, :image, :string)
   -> 0.0155s
== 20200621124425 AddImageToPosts: migrated (0.0156s) =========================

== 20200624083831 AddDeviseToUsers: migrating =================================
-- change_table(:users)
   -> 0.0761s
-- add_index(:users, :email, {:unique=>true})
   -> 0.0127s
-- add_index(:users, :reset_password_token, {:unique=>true})
   -> 0.0126s
== 20200624083831 AddDeviseToUsers: migrated (0.1018s) ========================

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?