Skip to content

Refactor removal of deprecated features while preserving database state#15009

Merged
Maffooch merged 2 commits into
devfrom
removed-features-keep-tables
Jun 15, 2026
Merged

Refactor removal of deprecated features while preserving database state#15009
Maffooch merged 2 commits into
devfrom
removed-features-keep-tables

Conversation

@Maffooch

Copy link
Copy Markdown
Contributor

Update the migration process to remove the Stub Findings and Credential Manager features from Django's state while retaining their underlying database tables. This approach allows for data preservation during downgrades, ensuring a smoother transition for users.

@Maffooch Maffooch requested a review from mtesauro as a code owner June 15, 2026 15:10
@github-actions github-actions Bot added the New Migration Adding a new migration file. Take care when merging. label Jun 15, 2026
…e-only removal

The state-only removal in 0266 left dojo_system_settings.enable_credentials
in place (NOT NULL, no DB default) for downgrade safety, but the model no
longer supplies a value on INSERT. New System_Settings rows then failed with
a NotNullViolation, surfacing as 28 errors in
unittests.test_apply_finding_template.

Split the field handling into its own SeparateDatabaseAndState: drop the
field from Django state while a database_operations RunSQL sets a server-side
default of true (matching the field's original default) on the retained
column, so inserts that omit it still satisfy the NOT NULL constraint.

Verified locally: the 28 test_apply_finding_template errors reproduce before
the change and pass after; makemigrations --check reports no drift; and the
cred_*/stub_finding tables, the enable_credentials column, and the cred_user
pghistory triggers all remain in the database.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@mtesauro mtesauro left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved

@Maffooch Maffooch merged commit e6da78b into dev Jun 15, 2026
150 checks passed
@Maffooch Maffooch deleted the removed-features-keep-tables branch June 15, 2026 20:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

New Migration Adding a new migration file. Take care when merging.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants