Reset database

The rosemary db:reset command is a powerful tool for resetting your project’s database to its initial state. This command deletes all the data in your database, making it ideal for fixing any inconsistencies we may have created during development.

Table of contents

  1. Basic Usage
  2. Clear migrations

Basic Usage

To reset your database and clear all table data except for migration records, run:

rosemary db:reset

The rosemary db:reset command also clears the uploads directory as part of the reset process, ensuring that any files uploaded during development or testing are removed.

Clear migrations

If you need to completely rebuild your database from scratch, including removing all migration history and starting fresh, you can use the --clear-migrations option:

rosemary db:reset --clear-migrations

Be careful! This command will…

  • Delete all data from the database, including the migration history.
  • Clear the migrations directory.
  • Initialize a new set of migrations.
  • Apply the migrations to rebuild the database schema.