[videos] Big guns, SQL delete
This commit is contained in:
@ -1,5 +1,5 @@
|
|||||||
from django.core.management.base import BaseCommand
|
from django.core.management.base import BaseCommand
|
||||||
from django.db import models
|
from django.db import connection, models
|
||||||
|
|
||||||
|
|
||||||
class Command(BaseCommand):
|
class Command(BaseCommand):
|
||||||
@ -88,7 +88,10 @@ class Command(BaseCommand):
|
|||||||
)
|
)
|
||||||
total_moved += video_count
|
total_moved += video_count
|
||||||
|
|
||||||
dup_series.delete()
|
with connection.cursor() as cursor:
|
||||||
|
cursor.execute(
|
||||||
|
"DELETE FROM videos_series WHERE id = %s", [dup_series.id]
|
||||||
|
)
|
||||||
self.stdout.write(f" Deleted series id={dup_series.id}")
|
self.stdout.write(f" Deleted series id={dup_series.id}")
|
||||||
|
|
||||||
self.stdout.write(
|
self.stdout.write(
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
from django.core.management.base import BaseCommand
|
from django.core.management.base import BaseCommand
|
||||||
from django.db import models
|
from django.db import connection, models
|
||||||
|
|
||||||
|
|
||||||
class Command(BaseCommand):
|
class Command(BaseCommand):
|
||||||
@ -80,7 +80,10 @@ class Command(BaseCommand):
|
|||||||
f" Moved {scrobble_count} scrobbles from id={dup_video.id} to id={keeper.id}"
|
f" Moved {scrobble_count} scrobbles from id={dup_video.id} to id={keeper.id}"
|
||||||
)
|
)
|
||||||
|
|
||||||
dup_video.delete()
|
with connection.cursor() as cursor:
|
||||||
|
cursor.execute(
|
||||||
|
"DELETE FROM videos_video WHERE id = %s", [dup_video.id]
|
||||||
|
)
|
||||||
self.stdout.write(f" Deleted video id={dup_video.id}")
|
self.stdout.write(f" Deleted video id={dup_video.id}")
|
||||||
|
|
||||||
self.stdout.write(self.style.SUCCESS("\nDone!"))
|
self.stdout.write(self.style.SUCCESS("\nDone!"))
|
||||||
|
|||||||
Reference in New Issue
Block a user