Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions health_check/db/migrations/0002_alter_testmodel_options.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Generated by Django 4.2.20 on 2025-03-20 11:10

from django.db import migrations


def remove_test_model_default_permissions(apps, schema_editor):
ContentType = apps.get_model("contenttypes", "ContentType")
Permission = apps.get_model("auth", "Permission")
db_alias = schema_editor.connection.alias

try:
test_model_content_type = ContentType.objects.using(db_alias).get(app_label='db', model='testmodel')
Permission.objects.using(db_alias).filter(content_type=test_model_content_type).delete()
except ContentType.DoesNotExist:
return


class Migration(migrations.Migration):
dependencies = [
('db', '0001_initial'),
]

operations = [
migrations.AlterModelOptions(
name='testmodel',
options={'default_permissions': ()},
),
migrations.RunPython(
code=remove_test_model_default_permissions,
reverse_code=migrations.RunPython.noop,
),
]
1 change: 1 addition & 0 deletions health_check/db/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ class TestModel(models.Model):

class Meta:
db_table = "health_check_db_testmodel"
default_permissions = ()