0

New to rails here, and experimenting with using the db\seeds.rb file and such

First, I want to clear all the data in my database using rake db:reset but it's not working!

Here's my output

C:\Sites\sportproject>rake db:reset
Couldn't drop db/development.sqlite3 : #
db/development.sqlite3 already exists
-- create_table("sports", {:force=>true})
   -> 0.0640s
-- create_table("teams", {:force=>true})
   -> 0.0340s
-- add_index("teams", ["sport_id"], {:name=>"index_teams_on_sport_id"})
   -> 0.0160s
-- initialize_schema_migrations_table()
   -> 0.0000s
-- assume_migrated_upto_version(20130531012951, ["C:/Sites/sportproject/db/migra
te"])
   -> 0.0000s

Then I log into my console with rails console and type Sport.all (Sport is the name of one of my models) and it's showing there's still data!

What am I doing wrong?

Ricky
  • 2,850
  • 5
  • 28
  • 41

3 Answers3

1

I found the answer in Patrik's link.

It's because I'm on windows, as the database is possibly being used by another process, hence the "Permission Denied" message. I just needed to ensure no other processes were using the database.

Ricky
  • 2,850
  • 5
  • 28
  • 41
1

If you are using Linux and postgresql you can do

sudo service postgresql restart

and then

rake db:reset

I think with mysql is

sudo service mysql restart
inye
  • 1,786
  • 1
  • 23
  • 31
0

I had the same problem. The reason was because I was running the rake db:reset on my IRB or Console. Instead, I quit out of console and run the code again and it worked. Perhaps Itll work for you too.

Lesly Revenge
  • 894
  • 10
  • 16