ferrosoft.apps.ferrobase.management.commands package¶
Submodules¶
ferrosoft.apps.ferrobase.management.commands.addtenant module¶
- class ferrosoft.apps.ferrobase.management.commands.addtenant.Command(stdout=None, stderr=None, no_color=False, force_color=False)[source]¶
Bases:
BaseCommandManagement command that provisions a new tenant on the platform.
Creates the tenant record, sets up a dedicated PostgreSQL database, loads the requested fixtures, and optionally configures contact details. The organization must already exist in the master database.
- handle(*args, **options)[source]¶
The actual logic of the command. Subclasses must implement this method.
- help = 'Add tenants to Ferrosoft Platform'¶
ferrosoft.apps.ferrobase.management.commands.deltenant module¶
- class ferrosoft.apps.ferrobase.management.commands.deltenant.Command(stdout=None, stderr=None, no_color=False, force_color=False)[source]¶
Bases:
BaseCommandManagement command that removes one or more tenants from the platform.
Without
--force, only the tenant record is deleted and the SQL commands to drop the database and role are printed for manual review. With--force, the database and PostgreSQL role are also dropped immediately.- handle(*args, **options)[source]¶
The actual logic of the command. Subclasses must implement this method.
- help = 'Delete tenants from Ferrosoft Platform'¶
ferrosoft.apps.ferrobase.management.commands.dumpdata_tenant module¶
- class ferrosoft.apps.ferrobase.management.commands.dumpdata_tenant.Command(stdout=None, stderr=None, no_color=False, force_color=False)[source]¶
Bases:
BaseCommandManagement command that dumps fixture data from a tenant database.
Thin wrapper around Django’s
dumpdatathat activates the specified tenant database connection before delegating to the built-in command. The--tenantargument is required.
ferrosoft.apps.ferrobase.management.commands.ferrobase_cleanup module¶
- class ferrosoft.apps.ferrobase.management.commands.ferrobase_cleanup.Command(stdout=None, stderr=None, no_color=False, force_color=False)[source]¶
Bases:
BaseCommandManagement command that removes stale resources from all databases.
Runs
CleanupServiceagainst the master database first, then against every active tenant database in alphabetical order.- handle(*args, **options)[source]¶
The actual logic of the command. Subclasses must implement this method.
- help = 'Clean up old resources.'¶
ferrosoft.apps.ferrobase.management.commands.ferrobase_update module¶
- class ferrosoft.apps.ferrobase.management.commands.ferrobase_update.Command(stdout=None, stderr=None, no_color=False, force_color=False)[source]¶
Bases:
BaseCommandManagement command that synchronises database resources with the current release.
Invokes
Updater.runwhich upserts built-in data (countries, languages, measurement units, subscription plans, etc.) into the master database. Progress and errors are reported throughCommandStatusWriter.- handle(*args, **options)[source]¶
The actual logic of the command. Subclasses must implement this method.
- help = 'Update database resources with data from current release.'¶
- class ferrosoft.apps.ferrobase.management.commands.ferrobase_update.CommandStatusWriter(output, style)[source]¶
Bases:
StatusWriterBridges
Updaterstatus callbacks to Django management command output.Maps
StatusWriterseverity levels (error, notice, success) to the corresponding DjangoOutputWrapperstyle methods so that messages are coloured consistently with other management output.
ferrosoft.apps.ferrobase.management.commands.listtenants module¶
- class ferrosoft.apps.ferrobase.management.commands.listtenants.Command(stdout=None, stderr=None, no_color=False, force_color=False)[source]¶
Bases:
BaseCommandManagement command that lists tenants with their database sizes.
Outputs a tabulated view of tenant ID, name, active status, and the pretty-printed PostgreSQL database size. Pass
--allto include inactive tenants.
ferrosoft.apps.ferrobase.management.commands.loaddata_tenant module¶
- class ferrosoft.apps.ferrobase.management.commands.loaddata_tenant.Command(stdout=None, stderr=None, no_color=False, force_color=False)[source]¶
Bases:
TenantAwareCommandManagement command that loads fixtures into a tenant database.
Wraps Django’s
loaddatawith tenant context activation and runs the import inside an atomic transaction so a partial fixture failure does not leave the database in an inconsistent state.- handle_tenant(*args, **options)[source]¶
Execute command logic for the active tenant context.
Called by
handleafter activating the tenant database connection.self.tenantholds the activeTenantinstance (orNonewhen running against the master database).- Parameters:
*args – Positional arguments forwarded from the CLI parser.
**options – Keyword arguments forwarded from the CLI parser.
ferrosoft.apps.ferrobase.management.commands.migratetenants module¶
- class ferrosoft.apps.ferrobase.management.commands.migratetenants.Command(stdout=None, stderr=None, no_color=False, force_color=False)[source]¶
Bases:
BaseCommandManagement command that runs Django migrations for every active tenant.
Iterates over active tenants in alphabetical order, activates each tenant’s database connection, and calls
migrate. Accepts optionalapp_labelandmigration_namearguments that are forwarded verbatim tomigrate, allowing targeted migration or rollback for all tenants.