Empty my Sqlite3 database in RoR

I am working on a Ruby on Rails 3 web application using sqlite3. I tested my application on the fly, creating and destroying things in the database, sometimes using the new and edit actions, and sometimes through the Rails console.

I am interested in completely clearing my database and leaving only empty tables. How can i achieve this? I work with a team, so I am interested in two answers: 1) How can I free a database only by me? 2) How can I (if possible, empty) by others (some of which do not use sqlite3, but MySql)? (we are all working on the same project through the SVN repository)

+7
source share
4 answers

I found that by deleting the deployment.sqlite3 file from the db folder and entering the rake db:migrate command on the command line, it solves the problem for my entire sqlite3 team.

0
source

In reset, your database can be started:

 rake db:schema:load 

Your database will be created from the schema.rb file (supported by your migrations). This will further protect you from migrations that may subsequently fail due to code changes.

Your developer database should be different from your environment - if you need certain data, add it to the seed.rb file. Do not share the dev database, as you will quickly find yourself in situations where other changes make your version incompatible.

+18
source

Download sqlitebrower here http://sqlitebrowser.org/

Install it, run it, click the open database (top left) at locationOfYourRailsApp / db / development.sqlite3

Then go to the "Data Overview" tab, where you can delete or add data.

+2
source

As far as I know, in sqlite there is no USER GRANT control, therefore it is difficult to control access.

You can protect the database only by accessing files.

If you want to use an empty database for testing purposes. Create it once and copy the file somewhere. and use a copy of this file just before testing.

0
source

All Articles