commands.reset_db

Management command to reset the database and migrations.

Attributes

Classes

Command

Management command to reset the database and migrations.

Module Contents

commands.reset_db.ENGINE_SQLITE = 'django.db.backends.sqlite3'[source]
commands.reset_db.ENGINE_POSTGRESQL = 'django.db.backends.postgresql'[source]
class commands.reset_db.Command(stdout=None, stderr=None, no_color=False, force_color=False)[source]

Bases: django.core.management.BaseCommand

Management command to reset the database and migrations.

help = 'Resets the database by deleting current version migrations, dropping the database, then running...[source]
add_arguments(parser)[source]

Adds command arguments/options.

Parameters:

parser (django.core.management.base.CommandParser)

Return type:

None

handle(*_args, **options)[source]

Executes the command.

Parameters:
  • _args (tuple[str])

  • options (dict[str, str])

Return type:

None

_remove_migration_files(base_path, *_args, keep_established)[source]

Removes all Django migration files.

Parameters:
  • base_path (pathlib.Path)

  • _args (tuple)

  • keep_established (bool)

Return type:

None

_reset_sqlite(base_path)[source]

Deletes the SQLite database file.

Parameters:

base_path (pathlib.Path)

Return type:

None

_reset_postgresql()[source]

Drops and recreates the PostgreSQL database.

Return type:

None