Skip to content
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

🔨 migrate charts from typeorm to knex #3293

Merged
merged 1 commit into from
Mar 26, 2024
Merged

🔨 migrate charts from typeorm to knex #3293

merged 1 commit into from
Mar 26, 2024

Conversation

danyx23
Copy link
Contributor

@danyx23 danyx23 commented Mar 5, 2024

Migrates database access to the charts table and the chart_revisions table to knex

@danyx23 danyx23 marked this pull request as ready for review March 5, 2024 13:31
@danyx23 danyx23 requested a review from marcelgerber March 6, 2024 11:56
@danyx23 danyx23 force-pushed the db-cleanup-posts-access branch from a017102 to 3b3f0eb Compare March 6, 2024 12:42
@danyx23 danyx23 force-pushed the db-migrate-charts branch from 238800a to 2e741fe Compare March 6, 2024 12:42
@@ -104,6 +104,7 @@
"program": "${workspaceFolder}/itsJustJavascript/adminSiteServer/app.js",
"request": "launch",
"type": "node",
"runtimeExecutable": "/mnt/wslg/runtime-dir/fnm_multishells/5693_1709636182174/bin/node"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't think this should go here.

Copy link
Member

@marcelgerber marcelgerber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(partial review only, I didn't look at the heavy hitters yet)

@@ -156,6 +156,12 @@ export const knexRawFirst = async <TRow = unknown>(
return results[0]
}

export const knexRawInsert = async (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we rather enforce a KnexReadWriteTransaction to be safe?

(Likewise for the above knexRawFirst)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah good idea, in this case we can.

I'll make knexRawFirst take a RO transaction as this function is really for reading a single item I'd say

await trx
.table(ChartsTableName)
.where({ id: 1 })
.update({ isExplorable: 0 })
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ugh, sophia is removing this one in #3323 currently, maybe use a different column :)

@@ -17,7 +17,7 @@ const computeScore = (record: Omit<ChartRecord, "score">): number => {
const getChartsRecords = async (
knex: db.KnexReadonlyTransaction
): Promise<ChartRecord[]> => {
const chartsToIndex = await db.queryMysql(`
const chartsToIndex = await db.queryMysql(`-- sql
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one you can easily convert to trx-style.

Copy link
Contributor Author

danyx23 commented Mar 26, 2024

Merge activity

  • Mar 26, 10:04 AM EDT: @danyx23 started a stack merge that includes this pull request via Graphite.
  • Mar 26, 10:12 AM EDT: Graphite rebased this pull request as part of a merge.
  • Mar 26, 10:13 AM EDT: @danyx23 merged this pull request with Graphite.

@danyx23 danyx23 force-pushed the db-cleanup-posts-access branch from b1db3a1 to 338caee Compare March 26, 2024 14:09
Base automatically changed from db-cleanup-posts-access to master March 26, 2024 14:11
@danyx23 danyx23 force-pushed the db-migrate-charts branch from e9db6b4 to 710c3d5 Compare March 26, 2024 14:11
@danyx23 danyx23 merged commit 6772159 into master Mar 26, 2024
16 of 20 checks passed
@danyx23 danyx23 deleted the db-migrate-charts branch March 26, 2024 14:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants