-
-
Notifications
You must be signed in to change notification settings - Fork 229
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🔨 switch almost all remaining typeorm util function holdouts to knex #3359
Conversation
af5f9ca
to
b4aa5dc
Compare
ed42cc5
to
ffac6a7
Compare
b4aa5dc
to
5a640e2
Compare
ffac6a7
to
aa50f14
Compare
5a640e2
to
0366771
Compare
aa50f14
to
4de4a18
Compare
0366771
to
34fca5b
Compare
4de4a18
to
ea68c64
Compare
fe40423
to
e559c80
Compare
f078be0
to
78bb8aa
Compare
94180e6
to
445e098
Compare
78bb8aa
to
29b9ac2
Compare
445e098
to
c968925
Compare
29b9ac2
to
b8f843c
Compare
c968925
to
79b18e1
Compare
b8f843c
to
849b260
Compare
79b18e1
to
73526be
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! Really amazing effort on all of this - just a little bit more to go! 🏳️ 🏎️
@@ -0,0 +1,105 @@ | |||
import { NextFunction, Request, Response, Router } from "express" | |||
import * as db from "../db/db.js" | |||
export function getPlainRouteWithROTransaction<T>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't even aware of the plain/functional router distinction!
Not for the PR of course, but do you think it's worth keeping both around?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I think we could clean that up but it doesn't seem particularly urgent
testPageRouter.get("/embeds", async (req, res) => { | ||
const props = await db.knexReadonlyTransaction((trx) => | ||
propsFromQueryParams(trx, { | ||
getPlainRouteWithROTransaction( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At http://localhost:3030/admin/test , only the explorer test embeds appear to work
Everything else gets:
TypeError: The operator "undefined" is not permitted
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah nice, thanks for catching that. Fixed on the new top stack PR #3391
@@ -431,8 +431,6 @@ export class SiteBaker { | |||
private async removeDeletedPosts(knex: db.KnexReadonlyTransaction) { | |||
if (!this.bakeSteps.has("removeDeletedPosts")) return | |||
|
|||
await db.getConnection() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this change has come from here, but I also checked in the head of this PR chain and it's happening there too so I'll just write it here that:
node itsJustJavascript/baker/buildLocalBake.js --steps specialPages
with
TypeError: Cannot read properties of null (reading 'toLocaleDateString')
at formatDate (grapher/packages/@ourworldindata/utils/dist/Util.js:960:17)
at grapher/itsJustJavascript/db/model/Gdoc/GdocBase.js:674:49
at Array.map (<anonymous>)
at getMinimalGdocPostsByIds (grapher/itsJustJavascript/db/model/Gdoc/GdocBase.js:668:17)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async GdocHomepage.loadLinkedDocuments (grapher/itsJustJavascript/db/model/Gdoc/GdocBase.js:507:33)
at async GdocHomepage.loadState (grapher/itsJustJavascript/db/model/Gdoc/GdocBase.js:626:9)
at async loadGdocFromGdocBase (grapher/itsJustJavascript/db/model/Gdoc/GdocFactory.js:199:5)
at async renderFrontPage (grapher/itsJustJavascript/baker/siteRenderers.js:172:30)
at async SiteBaker.bakeSpecialPages (grapher/itsJustJavascript/baker/SiteBaker.js:353:66)
baker/batchTagWithGpt.ts
Outdated
// export const batchTagWithGpt = async ({ | ||
// debug, | ||
// limit, | ||
// }: BatchTagWithGptArgs = {}) => { | ||
// await db.knexReadonlyTransaction((trx) => | ||
// batchTagChartsWithGpt(trx, { debug, limit }) | ||
// ) | ||
// } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commented out?
@@ -1,18 +1,15 @@ | |||
#! /usr/bin/env jest | |||
import sqlFixtures from "sql-fixtures" | |||
import { dbTestConfig } from "./dbTestConfig.js" | |||
import { dataSource } from "./dataSource.dbtests.js" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! Hadn't remembered we had these - tested and confirmed working 👍
if (!variableMetadata) throw new JsonError("No such variable", 404) | ||
getPlainRouteWithROTransaction( | ||
adminRouter, | ||
"/datapage-preview/:id", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm getting an error when trying to visit this route: http://localhost:3030/admin/datapage-preview/7216 which requires the server to be restarted
error: Error: Transaction query already complete, run with DEBUG=knex:tx for more info
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for catching that, fixed also in the top PR
849b260
to
9c83b2b
Compare
73526be
to
1be5ef4
Compare
9c83b2b
to
9b21d17
Compare
1be5ef4
to
f8026fa
Compare
9b21d17
to
049b0d1
Compare
f8026fa
to
65f7d9d
Compare
049b0d1
to
f754031
Compare
65f7d9d
to
24084b8
Compare
f754031
to
95652fc
Compare
24084b8
to
299207d
Compare
95652fc
to
acbfb58
Compare
The only remaining uses of the typeorm functions are related to the chart revision tool
299207d
to
63d6d63
Compare
This PR cleans up almost all remaining uses of TypeORM utility funcitons. The only remaining holdouts now are the ones in the chart revision tool related functions which will be done in a later PR.