deleting the file_data records for the processed files
This commit is contained in:
parent
3fa5505970
commit
5a46d56158
|
@ -9,7 +9,7 @@ Create Date: 2021-12-14 10:52:50.785342
|
||||||
from alembic import op
|
from alembic import op
|
||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
from crc import app, session
|
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.file_service import FileService
|
||||||
from crc.services.temp_migration_service import FromFilesystemService, ToFilesystemService
|
from crc.services.temp_migration_service import FromFilesystemService, ToFilesystemService
|
||||||
|
|
||||||
|
@ -40,7 +40,13 @@ def upgrade():
|
||||||
processed_files.append(file.id)
|
processed_files.append(file.id)
|
||||||
|
|
||||||
# TODO: delete processed files from file_data table
|
# 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: ')
|
print('upgrade: done: ')
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue