Skip to content

Commit

Permalink
fix(migration): use command instead of exec for migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
djMax committed Mar 25, 2024
1 parent a34905a commit ea46003
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"@semantic-release/exec": "^6.0.3",
"@semantic-release/github": "^10.0.2",
"@types/node": "^20.11.30",
"@types/pg": "^8.11.3",
"@types/pg": "^8.11.4",
"@types/pg-cursor": "^2.7.2",
"@typescript-eslint/eslint-plugin": "^6.21.0",
"@typescript-eslint/parser": "^6.21.0",
Expand All @@ -72,7 +72,7 @@
"pg": "^8.11.3",
"pg-cursor": "^2.10.3",
"ts-node": "^10.9.2",
"typescript": "^5.4.2",
"typescript": "^5.4.3",
"vitest": "^1.4.0"
},
"dependencies": {
Expand Down
6 changes: 3 additions & 3 deletions src/migrations/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { sql_queries, sql_sets } from './sql-queries';
import { NodeClickHouseClientConfigOptions } from '@clickhouse/client/dist/client';

export function createDatabase(clickhouse: ClickHouseClient, database: string, { engine = 'Atomic' }: { engine?: string }) {
return clickhouse.exec({
return clickhouse.command({
query: `CREATE DATABASE IF NOT EXISTS ${database} ENGINE = ${engine}`,
clickhouse_settings: {
wait_end_of_query: 1,
Expand All @@ -24,7 +24,7 @@ export async function initializeMigrationTable(clickhouse: ClickHouseClient) {
ENGINE = MergeTree
ORDER BY tuple(applied_at)`;

return clickhouse.exec({
return clickhouse.command({
query: q,
clickhouse_settings: {
wait_end_of_query: 1,
Expand Down Expand Up @@ -92,7 +92,7 @@ export async function applyMigrations(clickhouse: ClickHouseClient, migrations:

for (const query of queries) {
try {
await clickhouse.exec({
await clickhouse.command({
query: query,
clickhouse_settings: sets,
});
Expand Down
28 changes: 14 additions & 14 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,7 @@ __metadata:
"@semantic-release/exec": ^6.0.3
"@semantic-release/github": ^10.0.2
"@types/node": ^20.11.30
"@types/pg": ^8.11.3
"@types/pg": ^8.11.4
"@types/pg-cursor": ^2.7.2
"@typescript-eslint/eslint-plugin": ^6.21.0
"@typescript-eslint/parser": ^6.21.0
Expand All @@ -689,7 +689,7 @@ __metadata:
pg: ^8.11.3
pg-cursor: ^2.10.3
ts-node: ^10.9.2
typescript: ^5.4.2
typescript: ^5.4.3
vitest: ^1.4.0
dependenciesMeta:
kysely:
Expand Down Expand Up @@ -786,14 +786,14 @@ __metadata:
languageName: node
linkType: hard

"@types/pg@npm:*, @types/pg@npm:^8.11.3":
version: 8.11.3
resolution: "@types/pg@npm:8.11.3"
"@types/pg@npm:*, @types/pg@npm:^8.11.4":
version: 8.11.4
resolution: "@types/pg@npm:8.11.4"
dependencies:
"@types/node": "*"
pg-protocol: "*"
pg-types: ^4.0.1
checksum: 7a2ae739aefcf21db7c2f6e45f4ce887d3f12680ccd06024454230743f767eab2b518cfd2f23984a6b7f245cb0664011ffb1ca7db0761c39df00c3669810312c
checksum: c30713a570a674dbf9b13e8c9cd1ba41ee8d1c2f0bb9ba45410084332a29df3937b57bebf3f5c34b59ea7d5267bf038dac9661780bb6fa276261f82044db0f86
languageName: node
linkType: hard

Expand Down Expand Up @@ -4827,23 +4827,23 @@ __metadata:
languageName: node
linkType: hard

"typescript@npm:^5.4.2":
version: 5.4.2
resolution: "typescript@npm:5.4.2"
"typescript@npm:^5.4.3":
version: 5.4.3
resolution: "typescript@npm:5.4.3"
bin:
tsc: bin/tsc
tsserver: bin/tsserver
checksum: 96d80fde25a09bcb04d399082fb27a808a9e17c2111e43849d2aafbd642d835e4f4ef0de09b0ba795ec2a700be6c4c2c3f62bf4660c05404c948727b5bbfb32a
checksum: d74d731527e35e64d8d2dcf2f897cf8cfbc3428be0ad7c48434218ba4ae41239f53be7c90714089db1068c05cae22436af2ecba71fd36ecc5e7a9118af060198
languageName: node
linkType: hard

"typescript@patch:typescript@^5.4.2#~builtin<compat/typescript>":
version: 5.4.2
resolution: "typescript@patch:typescript@npm%3A5.4.2#~builtin<compat/typescript>::version=5.4.2&hash=5da071"
"typescript@patch:typescript@^5.4.3#~builtin<compat/typescript>":
version: 5.4.3
resolution: "typescript@patch:typescript@npm%3A5.4.3#~builtin<compat/typescript>::version=5.4.3&hash=5da071"
bin:
tsc: bin/tsc
tsserver: bin/tsserver
checksum: c1b669146bca5529873aae60870e243fa8140c85f57ca32c42f898f586d73ce4a6b4f6bb02ae312729e214d7f5859a0c70da3e527a116fdf5ad00c9fc733ecc6
checksum: 3a62fe90aa79d68c9ce38ea5edb2957e62801c733b99f0e5a2b8b50922761f68f7d9a40d28c544b449866e81185cddb93cba2496d0ff3fa52ef5b1f8bcace38c
languageName: node
linkType: hard

Expand Down

0 comments on commit ea46003

Please sign in to comment.