Command
This class prints the SQL statements required to reset sequences for a specified set of application models. It allows users to nominate a specific database and generates the necessary SQL to synchronize sequence values with their associated table data.
Attributes
| Attribute | Type | Description |
|---|---|---|
| help | string = Prints the SQL statements for resetting sequences for the given app name(s). | Prints the SQL statements for resetting sequences for the given app name(s). |
| output_transaction | boolean = true | A boolean flag indicating whether the output SQL should be wrapped in a transaction block. |
Methods
add_arguments()
@classmethod
def add_arguments(
parser: ArgumentParser
) - > null
Configures the argument parser to include a database selection flag for the command.
Parameters
| Name | Type | Description |
|---|---|---|
| parser | ArgumentParser | The argument parser instance to which the --database argument and other base arguments are added |
Returns
| Type | Description |
|---|---|
null | Nothing is returned; the parser object is modified in place. |
handle_app_config()
@classmethod
def handle_app_config(
app_config: [AppConfig](../../../../apps/config/appconfig.md?sid=django_apps_config_appconfig),
**options: dict
) - > string
Generates the SQL statements required to reset sequences for the models within a specific application configuration.
Parameters
| Name | Type | Description |
|---|---|---|
| app_config | [AppConfig](../../../../apps/config/appconfig.md?sid=django_apps_config_appconfig) | The configuration object for the application whose sequences are being processed |
| **options | dict | A dictionary of runtime options, including the target database alias and verbosity level |
Returns
| Type | Description |
|---|---|
string | A newline-separated string of SQL statements for resetting sequences, or an empty string if no sequences are found. |