From ba87e39e3d710b2820257cbb5840eddbcc862f8d Mon Sep 17 00:00:00 2001 From: tcely Date: Sun, 4 May 2025 03:58:56 -0400 Subject: [PATCH] Update fix-mariadb.py --- tubesync/sync/management/commands/fix-mariadb.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tubesync/sync/management/commands/fix-mariadb.py b/tubesync/sync/management/commands/fix-mariadb.py index cb6b5c1d..24eabcee 100644 --- a/tubesync/sync/management/commands/fix-mariadb.py +++ b/tubesync/sync/management/commands/fix-mariadb.py @@ -63,9 +63,9 @@ class Command(BaseCommand): fields = self._get_fields(table_str) return 'uuid' in [ f.name for f in fields if 'char(32)' == f.type_code ] - def _uuid_column_type(self, table_str, /): + def _column_type(self, table_str, column_str='uuid', /): fields = self._get_fields(table_str) - return [ f.type_code for f in fields if 'uuid' == f.name ][0] + return [ f.type_code for f in fields if column_str.lower() == f.name.lower() ][0] def handle(self, *args, **options): if 'mysql' != db.connection.vendor: @@ -96,9 +96,11 @@ class Command(BaseCommand): self._using_char_for_uuid('sync_media') ) if not both_tables: - if 'uuid' == self._uuid_column_type('sync_source').lower(): + if 'uuid' == self._column_type('sync_source', 'uuid').lower(): log.notice('The source table is already using a native UUID column.') - elif 'uuid' == self._uuid_column_type('sync_media').lower(): + elif 'uuid' == self._column_type('sync_media', 'uuid').lower(): + log.notice('The media table is already using a native UUID column.') + elif 'uuid' == self._column_type('sync_media', 'source_id').lower(): log.notice('The media table is already using a native UUID column.') else: raise CommandError(_(