tl-its-umich-edu / remote-office-hours-queue

Virtual queuing tool supporting Zoom video conferencing and/or in person meetings.
https://officehours.it.umich.edu/
Apache License 2.0
12 stars 28 forks source link

Avoid triggering migrations for get_backend_types #574

Open jonespm opened 3 weeks ago

jonespm commented 3 weeks ago

In the model there's this code for choices this is both in the Queue and Meetings. This results in a new migration whenever get_backend_types() changes. This is dynamic and cannot be predicted

   backend_type = models.CharField(
        max_length=20,
        choices=get_backend_types(),
        null=False,
        default=get_default_backend,
    )

and

    allowed_backends = ArrayField(
        models.CharField(max_length=20, choices=get_backend_types(), blank=False),
        default=get_default_allowed_backends,
    )

This shouldn't be in the model because it makes it think a migration is missing. Instead we probably should move the choices completely out of the model and into the API.

To test this, you'll have to start up both without Zoom credentials (only in person) and ensure only Zoom appears. Then start with Zoom credentials and insure both In Person and Zoom appears. Also the migrations will need to be run to remove this from the migration process.