diff --git a/care/facility/migrations/0395_assetlocationdutystaff_assetlocation_users.py b/care/facility/migrations/0395_assetlocationdutystaff_assetlocation_users.py index 5ee979ca3c..f0e6510152 100644 --- a/care/facility/migrations/0395_assetlocationdutystaff_assetlocation_users.py +++ b/care/facility/migrations/0395_assetlocationdutystaff_assetlocation_users.py @@ -1,4 +1,6 @@ -# Generated by Django 4.2.5 on 2023-11-17 06:36 +# Generated by Django 4.2.5 on 2023-11-17 13:25 + +import uuid import django.db.models.deletion from django.conf import settings @@ -24,7 +26,19 @@ class Migration(migrations.Migration): verbose_name="ID", ), ), - ("deleted", models.BooleanField(default=False)), + ( + "external_id", + models.UUIDField(db_index=True, default=uuid.uuid4, unique=True), + ), + ( + "created_date", + models.DateTimeField(auto_now_add=True, db_index=True, null=True), + ), + ( + "modified_date", + models.DateTimeField(auto_now=True, db_index=True, null=True), + ), + ("deleted", models.BooleanField(db_index=True, default=False)), ( "asset_location", models.ForeignKey( @@ -48,6 +62,9 @@ class Migration(migrations.Migration): ), ), ], + options={ + "abstract": False, + }, ), migrations.AddField( model_name="assetlocation", diff --git a/care/facility/models/asset.py b/care/facility/models/asset.py index b7c193aefa..a785bd6259 100644 --- a/care/facility/models/asset.py +++ b/care/facility/models/asset.py @@ -59,14 +59,12 @@ class RoomType(enum.Enum): ) -class AssetLocationDutyStaff(models.Model): +class AssetLocationDutyStaff(BaseModel): asset_location = models.ForeignKey( AssetLocation, on_delete=models.CASCADE, null=False, blank=False ) user = models.ForeignKey(User, on_delete=models.CASCADE, null=False, blank=False) - deleted = models.BooleanField(default=False) - created_by = models.ForeignKey( User, on_delete=models.PROTECT, @@ -113,7 +111,11 @@ class Asset(BaseModel): choices=AssetTypeChoices, default=AssetType.INTERNAL.value ) asset_class = models.CharField( - choices=AssetClassChoices, default=None, null=True, blank=True, max_length=20 + choices=AssetClassChoices, + default=None, + null=True, + blank=True, + max_length=20, ) status = models.IntegerField(choices=StatusChoices, default=Status.ACTIVE.value) current_location = models.ForeignKey( @@ -124,7 +126,9 @@ class Asset(BaseModel): serial_number = models.CharField(max_length=1024, blank=True, null=True) warranty_details = models.TextField(null=True, blank=True, default="") # Deprecated meta = JSONField( - default=dict, blank=True, validators=[JSONFieldSchemaValidator(ASSET_META)] + default=dict, + blank=True, + validators=[JSONFieldSchemaValidator(ASSET_META)], ) # Vendor Details vendor_name = models.CharField(max_length=1024, blank=True, null=True)