deleting the file_data records for the processed files

This commit is contained in:
mike cullerton 2021-12-17 12:57:28 -05:00
parent 3fa5505970
commit 5a46d56158
1 changed files with 7 additions and 1 deletions

View File

@ -9,7 +9,7 @@ Create Date: 2021-12-14 10:52:50.785342
from alembic import op
import sqlalchemy as sa
from crc import app, session
from crc.models.file import FileModel
from crc.models.file import FileModel, FileDataModel
from crc.services.file_service import FileService
from crc.services.temp_migration_service import FromFilesystemService, ToFilesystemService
@ -40,7 +40,13 @@ def upgrade():
processed_files.append(file.id)
# TODO: delete processed files from file_data table
for file_id in processed_files:
processed_models = session.query(FileDataModel).filter(FileDataModel.file_model_id==file_id).all()
for processed_model in processed_models:
session.delete(processed_model)
print(f'upgrade: in processed files: file_id: {file_id}')
# session.commit()
print('upgrade: done: ')