$ bundle exec rake db:reset command raising couldn't drop db/development.sqlite3

前端 未结 5 491
醉酒成梦
醉酒成梦 2021-02-04 02:32

I tried to run $ bundle exec rake db:reset and found the following on console

Couldn\'t drop db/development.sqlite3 : #

        
相关标签:
5条回答
  • 2021-02-04 03:12

    When you do db:reset, it's running db:drop and db:setup in sequence. Your error message indicates that db/development.sqlite couldn't be deleted.

    If you're on Windows, maybe you need to stop your Rails server and console. Otherwise, figure out what's preventing the file from being deleted. It could be permission problem. A reboot may solve the problem too.

    0 讨论(0)
  • 2021-02-04 03:12

    I know this is an old post, but I just had this problem (continued sqlite3 issues with Windows), and while rebooting, shutting the command line, and stopping the server didn't work, I did manage to solve it by actually running each of the commands htanta mentioned above sequentially: 1. bundle exec rake db:drop 2. bundle exec rake db:create 3. bundle exec rake db:migrate

    If db:reset is only these commands anyway, I don't understand why it doesn't work but the individual commands do?

    0 讨论(0)
  • 2021-02-04 03:18

    Another possible answer is that you have a database file open. Close those files and stop your server, and it should work.

    0 讨论(0)
  • 2021-02-04 03:20

    Have been trying to resolve the same issue. Stopping Rails Server on Windows didn't help, but restarting the whole environment did the trick, bundle exec rake db:reset went through, but be sure not to start your server before that as it will call the same error. Continue with

    $ bundle exec rake db:reset
    $ bundle exec rake db:populate
    $ bundle exec rake test:prepare
    

    and start Rails Server after that.

    0 讨论(0)
  • 2021-02-04 03:24

    For Dropping entire database just give rake db:setup it drops and again creates the database for you

    0 讨论(0)
提交回复
热议问题