The db migrate is not working well in the device.

Asked 2 years ago, Updated 2 years ago, 92 views

I'm a beginner.

rails 4.2.1
sqlite33.6.20
I wanted to use the device in , so I tried bundle installing 3.4.1 and rakedb:migrate.
There is an application error and it doesn't work well.

1—Application error message
Migrations are pending.Toresolve this issue, run:bin/rakedb:migrateRAILS_ENV=development

2: Do the following
bin/rakedb:migrateRAILS_ENV=development

3—An error occurs.

rake aborted!
StandardError: Error has occurred, this and all later migrations cancelled:

SQLite3::SQLException: duplicate column name:email:ALTER TABLE"users"ADD"email"varchar DEFAULT'"NOT NULL/home/.rvm/gems/ruby-2.2.0/gems/sqlite3-1.3.10/lib/sqlite3/database.rb:91:inode /home/.rvm/gems/ruby-2.2.0/gems/sqlite3-1.3.10/lib/sqlite3/database.rb:91:in new'
/home/.rvm/gems/ruby-2.2.0/gems/sqlite3-1.3.10/lib/sqlite3/database.rb:91:in prepare'
/home/.rvm/gems/ruby-2.2.0/gems/sqlite3-1.3.10/lib/sqlite3/database.rb:134:in
execute'

~~~Continued

If you look at other questions, isn't the email column covered?The error appears to be

If you look at the migrate file below and the DB table itself, the column "email" is
It did not exist.

20150503133518_create_lists.rb (file used by original application)
20150528001224_add_device_to_users.rb (files generated by device)

☆After a lot of fiddling with it

1—The error itself is
20150528001224_add_device_to_users.rb (file generated by device)
Remove the from the migrate folder.

2: When I changed the email in the migration file to email1, the following column got the same error:

3:
20150528001224_add_device_to_users.rb (file generated by device)

Name your
20150428001224_add_device_to_users.rb

DB doesn't exist, so somehow
20150528001224_add_device_to_users.rb (file generated by device)
I think there is a file that conflicts with the contents of
Is the direction wrong?

I may not have been able to disclose the necessary files for the answer, but
Thank you for your cooperation.

ruby-on-rails devise

2022-09-30 14:14

1 Answers

What about rakedb:reset?

This command is to delete all DBs once and then recreate them.
Note that all values in the database will disappear.


2022-09-30 14:14

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.