Skip to content

Commit 7a247f2

Browse files
authored
fix(queries): fix index for expiration job (#2423)
Signed-off-by: Jose I. Paris <[email protected]>
1 parent b68fd78 commit 7a247f2

File tree

4 files changed

+9
-7
lines changed

4 files changed

+9
-7
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
-- atlas:txmode none
2+
3+
-- Drop index "workflowrun_state_created_at" from table: "workflow_runs"
4+
DROP INDEX "workflowrun_state_created_at";
5+
-- Create index "workflowrun_state_created_at" to table: "workflow_runs"
6+
CREATE INDEX CONCURRENTLY "workflowrun_state_created_at" ON "workflow_runs" ("state", "created_at");

app/controlplane/pkg/data/ent/migrate/migrations/atlas.sum

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
h1:aDLoUdZ7A/XcJmyQg4Qia82eQ6BN67RfTrTVh+uZoHo=
1+
h1:zMUQdCsdxlu5WHgd4G0cKNp4VzU0ViSDSSMojr38oXQ=
22
20230706165452_init-schema.sql h1:VvqbNFEQnCvUVyj2iDYVQQxDM0+sSXqocpt/5H64k8M=
33
20230710111950-cas-backend.sql h1:A8iBuSzZIEbdsv9ipBtscZQuaBp3V5/VMw7eZH6GX+g=
44
20230712094107-cas-backends-workflow-runs.sql h1:a5rzxpVGyd56nLRSsKrmCFc9sebg65RWzLghKHh5xvI=
@@ -112,3 +112,4 @@ h1:aDLoUdZ7A/XcJmyQg4Qia82eQ6BN67RfTrTVh+uZoHo=
112112
20250820171503.sql h1:SsLD5Tf6woeFE7/FLI9XVQpnEgx4CJ9d7fWwNOZvOrA=
113113
20250827093032.sql h1:K+XDWewSLoGBM+zjkBMag3mMQFFQyoQ9SePzfRxC694=
114114
20250902095134.sql h1:e1DP8uYf/CX7RCiCF+E2/TKXiFUR6EUQBPy0wh5Xxl0=
115+
20250908160222.sql h1:bNjptbt2xPpSXqa4eVuWkMnovHt9LMkiakoGrFGZJ0g=

app/controlplane/pkg/data/ent/migrate/schema.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -813,11 +813,6 @@ var (
813813
Name: "workflowrun_state_created_at",
814814
Unique: false,
815815
Columns: []*schema.Column{WorkflowRunsColumns[3], WorkflowRunsColumns[1]},
816-
Annotation: &entsql.IndexAnnotation{
817-
DescColumns: map[string]bool{
818-
WorkflowRunsColumns[1].Name: true,
819-
},
820-
},
821816
},
822817
{
823818
Name: "workflowrun_state_finished_at",

app/controlplane/pkg/data/ent/schema/workflowrun.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ func (WorkflowRun) Indexes() []ent.Index {
8484
index.Fields("workflow_id", "created_at").Annotations(entsql.DescColumns("created_at")),
8585
index.Fields("workflow_id", "state", "created_at").Annotations(entsql.DescColumns("created_at")),
8686
// Expiration job
87-
index.Fields("state", "created_at").Annotations(entsql.DescColumns("created_at")),
87+
index.Fields("state", "created_at"),
8888
// search and order by finish date
8989
index.Fields("state", "finished_at"),
9090
// Referrer

0 commit comments

Comments
 (0)