doorcontrol: Convert HIDEvent.raw_card_number to TextField

Turns out that those are not just representing a uint, and can be much
longer. Also Text fields in Postgres doesn't have any performance
penalty.
This commit is contained in:
Adam Goldsmith 2024-09-03 11:05:32 -04:00
parent 6c80ed05bd
commit de36c6844c
2 changed files with 18 additions and 3 deletions

View File

@ -0,0 +1,17 @@
# Generated by Django 5.1 on 2024-09-03 14:56
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("doorcontrol", "0001_initial"),
]
operations = [
migrations.AlterField(
model_name="hidevent",
name="raw_card_number",
field=models.TextField(blank=True, db_column="rawCardNumber", null=True),
),
]

View File

@ -159,9 +159,7 @@ class HIDEvent(models.Model):
io_state = models.BooleanField(blank=True, null=True, db_column="ioState")
new_time = models.DateTimeField(blank=True, null=True, db_column="newTime")
old_time = models.DateTimeField(blank=True, null=True, db_column="oldTime")
raw_card_number = models.CharField(
max_length=8, blank=True, null=True, db_column="rawCardNumber"
)
raw_card_number = models.TextField(blank=True, null=True, db_column="rawCardNumber")
# Based on `function isRedEvent` from /html/hid-global.js on a HID EDGE EVO Solo
is_red = models.GeneratedField(