Skip to content

Commit 576f0f0

Browse files
committed
Fix migration not unwrapping products column
1 parent cc1c879 commit 576f0f0

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/components/product/migrations/backfill-empty-mediums.migration.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@ import { updateProperty, variable } from '~/core/database/query';
77
import { ProductMedium as Medium, Product } from '../dto';
88
import { ProductService } from '../product.service';
99

10-
@Migration('2024-06-24T09:00:00')
10+
@Migration('2024-06-24T09:00:01')
1111
export class BackfillEmptyMediumsMigration extends BaseMigration {
1212
constructor(private readonly productService: ProductService) {
1313
super();
1414
}
1515

1616
async up() {
17-
const engagements = await this.db.query<
18-
Array<{ id: ID; mediums: Medium[] }>
19-
>().raw`
17+
const engagements = await this.db.query<{
18+
products: Array<{ id: ID; mediums: Medium[] }>;
19+
}>().raw`
2020
match (eng:Engagement)
2121
where exists((eng)-[:product { active: true }]->(:Product)-[:mediums { active: true }]->(:Property { value: [] }))
2222
match (eng)-[:product { active: true }]->(prod:Product)-[:mediums { active: true }]->(mediums:Property)
@@ -28,7 +28,7 @@ export class BackfillEmptyMediumsMigration extends BaseMigration {
2828
`Found ${engagements.length} engagements with some empty mediums`,
2929
);
3030

31-
const updates = engagements.flatMap((products) => {
31+
const updates = engagements.flatMap(({ products }) => {
3232
const grouped = groupBy(products, (p) =>
3333
uniq(p.mediums)
3434
.sort((a, b) => a.localeCompare(b))

0 commit comments

Comments
 (0)