From nobody Fri Oct 18 05:18:08 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=patchew-devel-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=patchew-devel-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1663680369; cv=none; d=zohomail.com; s=zohoarc; b=FhepvcrLtoHlErQiyNed7DPwXmSrd4azisBHtf+HKwCi9oJokwzGRnJg0zikC/Ls+5Er/S8LRWP5+MwuV6XwqeKu7I40rEqeuHRxbkNZrYCh27lE4ltMl3N5CwTZ5t/hBCpkwdD7cBMyL6FXyZpQX3ooMQssxofqwMeES1jilzo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1663680369; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=lu+62X/leU3gDir8m8TyapQk1+eP4QHs9XJhAXrf58k=; b=m7TICuJufz2OzQBpq47pk9PV2BQ9v2w1ZbP5Rw3tTvP3q9VBC1ub1Uj9xQMYaZrsOlASiuciQtI1KvfjBQn45+6jsF5NT62f6szT4hChJ5OsOyRFMtjlBKyfQeHvcyBjkkmgmxBBTQHumRh6ApCWpAKG7BjBs/St9PNo//hExqs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=patchew-devel-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1663680369292465.75628525068373; Tue, 20 Sep 2022 06:26:09 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-158-Bej3yQ52Nh2Fcs1OfVOPoA-1; Tue, 20 Sep 2022 09:26:05 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E316E101A943; Tue, 20 Sep 2022 13:26:04 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id DB98B2028E98; Tue, 20 Sep 2022 13:26:04 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id A78861946A46; Tue, 20 Sep 2022 13:26:04 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 4215D1946588 for ; Tue, 20 Sep 2022 13:04:13 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 0DB912024CC5; Tue, 20 Sep 2022 13:04:13 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast09.extmail.prod.ext.rdu2.redhat.com [10.11.55.25]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 064482024CBF for ; Tue, 20 Sep 2022 13:04:12 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id DABCA29AA2EF for ; Tue, 20 Sep 2022 13:04:12 +0000 (UTC) Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-122-PTF71jgoM8C_WU-w2_zEOw-1; Tue, 20 Sep 2022 09:04:09 -0400 Received: by mail-ej1-f71.google.com with SMTP id qf40-20020a1709077f2800b0077b43f8b94cso1351763ejc.23 for ; Tue, 20 Sep 2022 06:04:09 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:9af8:e5f5:7516:fa89]) by smtp.gmail.com with ESMTPSA id g6-20020a170906538600b0077086d2db8esm829153ejo.140.2022.09.20.06.04.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Sep 2022 06:04:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1663680368; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=lu+62X/leU3gDir8m8TyapQk1+eP4QHs9XJhAXrf58k=; b=F+YOk/tW7ARuVonwAhaMt2UyVwaycp70848CoBfX3IKUBAXm/MiQEwhwVJz/qMG/k4n/4J UoeETjR1SEXti94WV35n2bJjVKlyB2lPDRuI2ebavHcbgojpirPGCtS1W+IiEfEfksgAVR QepBS7BYLG2uYpw+OaRsFKGLb+pzz6Y= X-MC-Unique: Bej3yQ52Nh2Fcs1OfVOPoA-1 X-Original-To: patchew-devel@listman.corp.redhat.com X-MC-Unique: PTF71jgoM8C_WU-w2_zEOw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=bm8BS1BVEZZgdgoZZwN+LvkaGASC9YuEE2Gcr6WK6GE=; b=LXQRLMWP26+FypJGGTiChiqBOWxIrqkXIVbXa3OsRc84XfI+Ca4UQwIE5V5Gt3CRK1 N06semLwtyo5xCXkjhxcX+5IRXew/w8PQaOhX5Gq7HrrnNTIL7IV42hOpefOTsikYria tOUp8Ez4kVc48C7utsLq4IAaPkl+uj1vybT9L4z6CPcPtyByMgzmuLkeRsz1EXIm35nF M6AQILoRQyB8i5wPruhy5xYnETMcAvRysAY8Yq1IdXl3Ghaqjq/+eQRV8sCBXa0rTKpj idKYRDVzDLIr6v0x7plOAl3w7svaHpcX8sB6YBlVFFrPbWsRHtYH1FMV1+dRvVRyiUmN d2TQ== X-Gm-Message-State: ACrzQf3sg3VuarXrzg+bRgBp1iRiMjTuaEvl6WCzTck/VXUUw6QFP0OB Z068UUn4SmKzfNNd78HPq3gSBA3f2j6DhQc9xj9ADR3RmxU7516KdQ6Ez93t0SYvUBszST8UKWZ FnLpq0jjx0eOawHn4QfgxH5nFTzjJrvyhfc2TboByUFdxk+Kacc1bcx/H3tQbvN9e/6zGw49J1w == X-Received: by 2002:a17:907:7f91:b0:77f:c4c7:9155 with SMTP id qk17-20020a1709077f9100b0077fc4c79155mr16737153ejc.476.1663679048123; Tue, 20 Sep 2022 06:04:08 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6P6/LP3DAQc3K6GKgECW2SzzHYzYCntriHjq6TowC6FbXyTGFgKkkVrjvlPwqT2YiLH7Wn7g== X-Received: by 2002:a17:907:7f91:b0:77f:c4c7:9155 with SMTP id qk17-20020a1709077f9100b0077fc4c79155mr16737118ejc.476.1663679047744; Tue, 20 Sep 2022 06:04:07 -0700 (PDT) From: Paolo Bonzini To: patchew-devel@redhat.com Date: Tue, 20 Sep 2022 15:04:01 +0200 Message-Id: <20220920130404.39806-2-pbonzini@redhat.com> In-Reply-To: <20220920130404.39806-1-pbonzini@redhat.com> References: <20220920130404.39806-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 Subject: [Patchew-devel] [PATCH 1/4] models: add denormalized Project link to Result X-BeenThere: patchew-devel@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Patchew development and discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dcaratti@redhat.com Errors-To: patchew-devel-bounces@redhat.com Sender: "Patchew-devel" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1663680370115100003 Content-Type: text/plain; charset="utf-8" This is needed to handle the series/unapplied queries efficiently. The ProjectResult.project field is generalized and moved to Result. Because the ProjectResult.project field will be removed, make it temporarily NULL so that the migration can work backwards and populate it from Result.project. Signed-off-by: Paolo Bonzini --- api/migrations/0066_auto_20220919_1004.py | 24 +++++++++++++++++++++++ api/models.py | 10 +++++++--- 2 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 api/migrations/0066_auto_20220919_1004.py diff --git a/api/migrations/0066_auto_20220919_1004.py b/api/migrations/006= 6_auto_20220919_1004.py new file mode 100644 index 0000000..548481b --- /dev/null +++ b/api/migrations/0066_auto_20220919_1004.py @@ -0,0 +1,24 @@ +# Generated by Django 3.1.14 on 2022-09-19 10:04 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies =3D [ + ('api', '0065_auto_20220411_1153'), + ] + + operations =3D [ + migrations.AddField( + model_name=3D'result', + name=3D'project_denorm', + field=3Dmodels.ForeignKey(null=3DTrue, on_delete=3Ddjango.db.m= odels.deletion.CASCADE, related_name=3D'+', to=3D'api.project'), + ), + migrations.AlterField( + model_name=3D'projectresult', + name=3D'project', + field=3Dmodels.ForeignKey(null=3DTrue, on_delete=3Ddjango.db.m= odels.deletion.CASCADE, related_name=3D'results', to=3D'api.project'), + ), + ] diff --git a/api/models.py b/api/models.py index cd0285d..45c7f70 100644 --- a/api/models.py +++ b/api/models.py @@ -63,6 +63,10 @@ class Result(models.Model): log_entry =3D models.OneToOneField(LogEntry, on_delete=3Dmodels.CASCAD= E, null=3DTrue) data =3D jsonfield.JSONField(default=3D{}) =20 + project_denorm =3D models.ForeignKey( + "Project", related_name=3D"+", on_delete=3Dmodels.CASCADE, null=3D= True + ) + class Meta: index_together =3D [("status", "name")] =20 @@ -327,12 +331,12 @@ class Project(models.Model): return len(updated_series) =20 def create_result(self, **kwargs): - return ProjectResult(project=3Dself, **kwargs) + return ProjectResult(project=3Dself, project_denorm=3Dself, **kwar= gs) =20 =20 class ProjectResult(Result): project =3D models.ForeignKey( - Project, related_name=3D"results", on_delete=3Dmodels.CASCADE + Project, related_name=3D"results", on_delete=3Dmodels.CASCADE, nul= l=3DTrue ) =20 @property @@ -938,7 +942,7 @@ class Message(models.Model): emit_event("SeriesMerged", project=3Dself.project, series=3Dself) =20 def create_result(self, **kwargs): - return MessageResult(message=3Dself, **kwargs) + return MessageResult(message=3Dself, project_denorm=3Dself.project= , **kwargs) =20 def __str__(self): return self.project.name + "/" + self.subject --=20 2.37.2 _______________________________________________ Patchew-devel mailing list Patchew-devel@redhat.com https://listman.redhat.com/mailman/listinfo/patchew-devel