@prairielearn/migrations 3.0.24 → 3.0.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @prairielearn/migrations
2
2
 
3
+ ## 3.0.25
4
+
5
+ ### Patch Changes
6
+
7
+ - d6f506e: Update README for migrations to use modern function calls
8
+ - Updated dependencies [c6f661c]
9
+ - @prairielearn/postgres@4.2.0
10
+
3
11
  ## 3.0.24
4
12
 
5
13
  ### Patch Changes
package/README.md CHANGED
@@ -60,19 +60,24 @@ A `makeBatchedMigration()` function is available to help ensure you're writing a
60
60
  ```ts
61
61
  // batched-migrations/20230411002409_example_migration.ts
62
62
  import { makeBatchedMigration } from '@prairielearn/migrations';
63
- import { queryOneRowAsync, queryAsync } from '@prairielearn/postgres';
63
+ import { queryRow, execute } from '@prairielearn/postgres';
64
64
 
65
65
  export default makeBatchedMigration({
66
66
  async getParameters() {
67
- const result = await queryOneRowAsync('SELECT MAX(id) as max from examples;', {});
67
+ const max = await queryRow(
68
+ 'SELECT MAX(id) as max from examples;',
69
+ z.bigint({ coerce: true }).nullable(),
70
+ );
71
+
68
72
  return {
69
- max: result.rows[0].max,
73
+ min: 1n,
74
+ max,
70
75
  batchSize: 1000,
71
76
  };
72
77
  },
73
78
 
74
79
  async execute(min: bigint, max: bigint) {
75
- await queryAsync('UPDATE examples SET text = TRIM(text) WHERE id >= $min AND id <= $max', {
80
+ await execute('UPDATE examples SET text = TRIM(text) WHERE id >= $min AND id <= $max', {
76
81
  min,
77
82
  max,
78
83
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prairielearn/migrations",
3
- "version": "3.0.24",
3
+ "version": "3.0.25",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
@@ -17,7 +17,7 @@
17
17
  "@prairielearn/error": "^2.0.19",
18
18
  "@prairielearn/logger": "^2.0.20",
19
19
  "@prairielearn/named-locks": "^3.0.23",
20
- "@prairielearn/postgres": "^4.1.1",
20
+ "@prairielearn/postgres": "^4.2.0",
21
21
  "fs-extra": "^11.3.1",
22
22
  "serialize-error": "^12.0.0",
23
23
  "zod": "^3.25.76"