I'm focusing on a Ruby on Rails 3 web application using sqlite3. I've been testing my application on-the-fly creating and wrecking things within the Database, sometimes with the
edit actions and often with the Rails console.
I'm thinking about draining my Database totally and getting just the empty tables left. How do i accomplish this? I'm using a team and so i am thinking about two solutions: 1) How do you empty the Database only by me? 2) How do i (if at all possible empty) it through the others (most of which aren't using sqlite3 but MySql)? (many of us are focusing on an exactly the same project via a SVN repository)
To totally reset your database, you are able to run:
That will recreate your database out of your schema.rb file (maintained because of your migrations). This can furthermore safeguard you against migrations that could later fail because of code changes.
Your dev database ought to be distinct for your atmosphere - if you want certain data, combine it with your seed.rb file. Don't share a dev database, as you'll rapidly enter into situations where other changes build your version incompatible.
So far as I understand there's no USER GRANT management in sqlite so it's hard to control access.
You simply can safeguard the database by file access.
If you wish to make use of an empty database for test purpose. Generate it once and copy the file somewhere. and employ a duplicate of the file right before testing.
I discovered that by removing the
deployment.sqlite3 file in the
db folder and placing the command
rake db:migrate within the command line, it solves the issue its my team focusing on sqlite3.