mirror of
https://github.com/meeb/tubesync.git
synced 2025-06-25 22:46:34 +00:00
Update fix-mariadb.py
This commit is contained in:
parent
5235c53dad
commit
ba87e39e3d
@ -63,9 +63,9 @@ class Command(BaseCommand):
|
|||||||
fields = self._get_fields(table_str)
|
fields = self._get_fields(table_str)
|
||||||
return 'uuid' in [ f.name for f in fields if 'char(32)' == f.type_code ]
|
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)
|
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):
|
def handle(self, *args, **options):
|
||||||
if 'mysql' != db.connection.vendor:
|
if 'mysql' != db.connection.vendor:
|
||||||
@ -96,9 +96,11 @@ class Command(BaseCommand):
|
|||||||
self._using_char_for_uuid('sync_media')
|
self._using_char_for_uuid('sync_media')
|
||||||
)
|
)
|
||||||
if not both_tables:
|
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.')
|
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.')
|
log.notice('The media table is already using a native UUID column.')
|
||||||
else:
|
else:
|
||||||
raise CommandError(_(
|
raise CommandError(_(
|
||||||
|
Loading…
Reference in New Issue
Block a user