database
dev_tool.commands.database
log = logging.getLogger(__name__)
module-attribute
DatabaseCommandGroup
Bases: CommandGroup
A command group for database operations.
This class provides commands for interacting with databases, including seeding, flushing, resetting, and dumping operations.
The constructor for the DatabaseCommandGroup class.
This method initializes the command group with required services and registers all command methods.
Parameters:
-
docker(DockerService) –The Docker service for container management.
-
django(DjangoService) –The Django service for Django operations.
-
portal(PortalService) –The Portal service for API integration.
-
postgres(PostgresService) –The PostgreSQL service for database operations.
Source code in dev_tool/commands/database.py
django = django
instance-attribute
docker = docker
instance-attribute
portal = portal
instance-attribute
postgres = postgres
instance-attribute
__str__
The string representation of the command group.
This method returns the category name for the command group.
Returns:
-
str–The category name as a string.
database_operations
A command that opens a submenu for seeding operations.
This method returns a menu for different seeding operations.
Returns:
-
Menu–A submenu for seeding operations.
Source code in dev_tool/commands/database.py
dump_cloud
A command that dumps a cloud database to the local development environment.
This method checks for required environment variables and then dumps a cloud database to the local Docker database, with options to (re)dump or reuse existing dump files.
Source code in dev_tool/commands/database.py
backup_production
A command that backs up a production database to a .sql file.
Source code in dev_tool/commands/database.py
dump_production
A command that dumps a production database to the local development environment.
Source code in dev_tool/commands/database.py
restore_from_file
A command that opens a submenu for restoring databases from files.
This method returns a menu for selecting database files to restore from.
Returns:
-
Menu–A submenu for restoring databases from files.