Skip to content

Add populate_tenant_history management command - #347

Merged
atodorov merged 2 commits into
masterfrom
populate-tenant-history
Oct 5, 2026
Merged

atodorov merged 2 commits into
masterfrom
populate-tenant-history

Conversation

@kiwitcms-bot

@kiwitcms-bot kiwitcms-bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Member

This is the multi-tenant version of simple_history's populate_history management command, plus wiring it into upgrade_tenants.

populate_tenant_history inherits from the upstream simple_history.management.commands.populate_history.Command and only adds the multi-tenant bits:

  • handle() loops over all tenants and calls the inherited handle() inside tenant_context() for each one, printing the same per-tenant start/end banners (with timestamp) that the other tenant commands use.
  • add_arguments() adds a --dry-run option.
  • _bulk_history_create() returns early when --dry-run is given, otherwise it delegates to the upstream implementation. All other behaviour (models/--auto/--batchsize, existing-history detection, batching) is reused from upstream.

upgrade_tenants now runs populate_tenant_history --auto as its first step, before refresh_tenant_permissions (the remaining steps are renumbered accordingly).

Includes tests exercising the multi-tenant population and the --dry-run mode.

@kiwitcms-bot
kiwitcms-bot force-pushed the populate-tenant-history branch from 538d17e to 34cb699 Compare October 4, 2026 18:08
@kiwitcms-bot
kiwitcms-bot force-pushed the populate-tenant-history branch from 34cb699 to 4263112 Compare October 4, 2026 18:14
@atodorov
atodorov merged commit c99d30c into master Oct 5, 2026
7 checks passed
@atodorov
atodorov deleted the populate-tenant-history branch October 5, 2026 10:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants