Skip to content

Commit

Permalink
feat: add deleted_at nullable timestamp to base model
Browse files Browse the repository at this point in the history
This will be used to enable soft deletes
  • Loading branch information
ngurenyaga committed Nov 10, 2021
1 parent dc6b177 commit e4b94ad
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 0 deletions.
43 changes: 43 additions & 0 deletions mycarehub/clients/migrations/0007_auto_20211110_0453.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Generated by Django 3.2.9 on 2021-11-10 01:53

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('clients', '0006_clientfacility_notes'),
]

operations = [
migrations.AddField(
model_name='client',
name='deleted_at',
field=models.DateTimeField(blank=True, null=True),
),
migrations.AddField(
model_name='clientfacility',
name='deleted_at',
field=models.DateTimeField(blank=True, null=True),
),
migrations.AddField(
model_name='identifier',
name='deleted_at',
field=models.DateTimeField(blank=True, null=True),
),
migrations.AddField(
model_name='relatedperson',
name='deleted_at',
field=models.DateTimeField(blank=True, null=True),
),
migrations.AddField(
model_name='securityquestion',
name='deleted_at',
field=models.DateTimeField(blank=True, null=True),
),
migrations.AddField(
model_name='securityquestionresponse',
name='deleted_at',
field=models.DateTimeField(blank=True, null=True),
),
]
43 changes: 43 additions & 0 deletions mycarehub/common/migrations/0005_auto_20211110_0453.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Generated by Django 3.2.9 on 2021-11-10 01:53

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('common', '0004_alter_auditlog_timestamp'),
]

operations = [
migrations.AddField(
model_name='address',
name='deleted_at',
field=models.DateTimeField(blank=True, null=True),
),
migrations.AddField(
model_name='auditlog',
name='deleted_at',
field=models.DateTimeField(blank=True, null=True),
),
migrations.AddField(
model_name='contact',
name='deleted_at',
field=models.DateTimeField(blank=True, null=True),
),
migrations.AddField(
model_name='facility',
name='deleted_at',
field=models.DateTimeField(blank=True, null=True),
),
migrations.AddField(
model_name='facilityattachment',
name='deleted_at',
field=models.DateTimeField(blank=True, null=True),
),
migrations.AddField(
model_name='userfacilityallotment',
name='deleted_at',
field=models.DateTimeField(blank=True, null=True),
),
]
1 change: 1 addition & 0 deletions mycarehub/common/models/base_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ class OwnerlessAbstractBase(models.Model, metaclass=ValidationMetaclass):
created_by = models.UUIDField(null=True, blank=True)
updated = models.DateTimeField(default=timezone.now)
updated_by = models.UUIDField(null=True, blank=True)
deleted_at = models.DateTimeField(null=True, blank=True)

objects = OwnerlessAbstractBaseManager()

Expand Down

0 comments on commit e4b94ad

Please sign in to comment.