Skip to content

Commit

Permalink
Update column names in insert statements
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeh committed Sep 26, 2023
1 parent 73bafe4 commit 68f7e6b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class TypeormProjectCostSurface
CostSurfacePuDataEntity,
rows.map((row) => ({
cost: row.cost,
puid: row.projectsPuId,
projectsPuId: row.projectsPuId,
costSurfaceId: row.costSurfaceId,
})),
);
Expand Down Expand Up @@ -70,7 +70,7 @@ export class TypeormProjectCostSurface
*/
await this.geoprocessingEntityManager.query(
`
INSERT INTO cost_surface_pu_data (puid, cost, cost_surface_id)
INSERT INTO cost_surface_pu_data (projects_pu_id, cost, cost_surface_id)
SELECT ppu.id, round(pug.area / 1000000) as area, $2
FROM projects_pu ppu
INNER JOIN planning_units_geom pug ON pug.id = ppu.geom_id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export class PlanningUnitsGridProcessor {
// TODO: Maybe add a custom method in the repo, share it in libs to be used in both sides
const projectPuIds = projectPus.map((p) => p.id);
await manager.query(
`INSERT INTO cost_surface_pu_data (puid, cost, cost_surface_id)
`INSERT INTO cost_surface_pu_data (projects_pu_id, cost, cost_surface_id)
SELECT ppu.id, round(pug.area / 1000000) as area, ppu.id
FROM projects_pu ppu
INNER JOIN planning_units_geom pug ON pug.id = ppu.geom_id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ grid.geom
ids.map((geometryId: string) => {
return em.query(
`
INSERT INTO cost_surface_pu_data (puid, cost, cost_surface_id)
INSERT INTO cost_surface_pu_data (projects_pu_id, cost, cost_surface_id)
SELECT ppu.id, round(pug.area / 1000000) as area, $1
FROM projects_pu ppu
INNER JOIN planning_units_geom pug ON pug.id = ppu.geom_id
Expand Down

0 comments on commit 68f7e6b

Please sign in to comment.