From f58b87c9a805f1c407a913485d0146f728ce2686 Mon Sep 17 00:00:00 2001 From: lizerk Date: Thu, 12 Mar 2026 01:08:11 +0300 Subject: [PATCH] =?UTF-8?q?=D1=84=D0=B8=D0=BA=D1=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../0014_migrate_comments_to_communications.py | 13 ++++--------- .../0006_migrate_comments_to_communications.py | 3 ++- .../0010_migrate_comments_to_communications.py | 3 ++- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/backend/documents/migrations/0014_migrate_comments_to_communications.py b/backend/documents/migrations/0014_migrate_comments_to_communications.py index 2e285083..3c2ecbd3 100644 --- a/backend/documents/migrations/0014_migrate_comments_to_communications.py +++ b/backend/documents/migrations/0014_migrate_comments_to_communications.py @@ -45,7 +45,7 @@ def migrate_comments_forward(apps, schema_editor): is_system, has_attachments, is_deleted, is_edited, edited_at, is_pinned, is_forwarded, is_cross_chat, - system_metadata + system_type, system_metadata ) SELECT cc.id, @@ -56,13 +56,7 @@ def migrate_comments_forward(apps, schema_editor): dc.is_edited, CASE WHEN dc.is_edited THEN dc.updated_at ELSE NULL END, FALSE, FALSE, FALSE, - jsonb_build_object( - 'legacy_comment_id', dc.id, - 'legacy_model', 'documents.DocumentComment' - ) - FROM documents_documentcomment dc - JOIN communications_chat cc ON ( - cc.type = 'comments' + '', AND cc.context_content_type_id = (SELECT id FROM django_content_type WHERE app_label='documents' AND model='document') AND cc.context_object_id = dc.document_id ) @@ -83,7 +77,7 @@ def migrate_comments_forward(apps, schema_editor): is_deleted, is_edited, edited_at, is_pinned, is_forwarded, is_cross_chat, reply_to_id, thread_root_id, - system_metadata + system_type, system_metadata ) SELECT cc.id, @@ -96,6 +90,7 @@ def migrate_comments_forward(apps, schema_editor): FALSE, FALSE, FALSE, parent_msg.id, parent_msg.id, + '', jsonb_build_object( 'legacy_comment_id', dc.id, 'legacy_model', 'documents.DocumentComment' diff --git a/backend/feed/migrations/0006_migrate_comments_to_communications.py b/backend/feed/migrations/0006_migrate_comments_to_communications.py index 28a320bc..ba659420 100644 --- a/backend/feed/migrations/0006_migrate_comments_to_communications.py +++ b/backend/feed/migrations/0006_migrate_comments_to_communications.py @@ -44,7 +44,7 @@ def migrate_comments_forward(apps, schema_editor): chat_id, author_id, content, created_at, is_system, has_attachments, is_deleted, is_edited, is_pinned, is_forwarded, is_cross_chat, - system_metadata + system_type, system_metadata ) SELECT cc.id, @@ -54,6 +54,7 @@ def migrate_comments_forward(apps, schema_editor): FALSE, CASE WHEN (c.image != '' OR c.attachment != '') THEN TRUE ELSE FALSE END, FALSE, FALSE, FALSE, FALSE, FALSE, + '', jsonb_build_object( 'legacy_comment_id', c.id, 'legacy_model', 'feed.Comment' diff --git a/backend/requests_app/migrations/0010_migrate_comments_to_communications.py b/backend/requests_app/migrations/0010_migrate_comments_to_communications.py index 77e20f4c..e98d1cf2 100644 --- a/backend/requests_app/migrations/0010_migrate_comments_to_communications.py +++ b/backend/requests_app/migrations/0010_migrate_comments_to_communications.py @@ -43,7 +43,7 @@ def migrate_comments_forward(apps, schema_editor): chat_id, author_id, content, created_at, is_system, has_attachments, is_deleted, is_edited, is_pinned, is_forwarded, is_cross_chat, - system_metadata + system_type, system_metadata ) SELECT cc.id, @@ -51,6 +51,7 @@ def migrate_comments_forward(apps, schema_editor): rc.text, rc.created_at, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, + '', jsonb_build_object( 'legacy_comment_id', rc.id, 'legacy_model', 'requests_app.RequestComment'