Skip to content

Commit

Permalink
Merge pull request #15 from andogq/feat/update-clickhouse
Browse files Browse the repository at this point in the history
Update ClickHouse to 1.4.0
  • Loading branch information
VVVi authored Sep 7, 2024
2 parents a601c5e + 693fe18 commit de87f00
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 23 deletions.
16 changes: 8 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@
"license": "MIT",
"repository": "VVVi/clickhouse-migrations",
"dependencies": {
"@clickhouse/client": "^0.2.9",
"@clickhouse/client": "^1.4.0",
"commander": "^11.1.0"
},
"devDependencies": {
"@types/jest": "^29.5.12",
"@types/node": "^18.15.11",
"@typescript-eslint/parser": "^6.20.0",
"@typescript-eslint/eslint-plugin": "^6.20.0",
"eslint-plugin-prettier": "^5.1.3",
"@typescript-eslint/parser": "^6.20.0",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.3",
"jest": "^29.7.0",
"prettier": "^3.2.4",
"ts-jest": "^29.1.2",
Expand Down
14 changes: 7 additions & 7 deletions src/migrate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ const log = (type: 'info' | 'error' = 'info', message: string, error?: string) =
};

const connect = (
host: string,
url: string,
username: string,
password: string,
db_name?: string,
timeout?: string,
): ClickHouseClient => {
const db_params: NodeClickHouseClientConfigOptions = {
host,
url,
username,
password,
application: 'clickhouse-migrations',
Expand Down Expand Up @@ -62,13 +62,13 @@ const create_db = async (host: string, username: string, password: string, db_na

const init_migration_table = async (client: ClickHouseClient): Promise<void> => {
const q = `CREATE TABLE IF NOT EXISTS _migrations (
uid UUID DEFAULT generateUUIDv4(),
uid UUID DEFAULT generateUUIDv4(),
version UInt32,
checksum String,
migration_name String,
checksum String,
migration_name String,
applied_at DateTime DEFAULT now()
)
ENGINE = MergeTree
)
ENGINE = MergeTree
ORDER BY tuple(applied_at)`;

try {
Expand Down
10 changes: 5 additions & 5 deletions tests/db.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ describe('Migration tests', () => {
});
expect(execSpy).toHaveBeenNthCalledWith(2, {
query: `CREATE TABLE IF NOT EXISTS _migrations (
uid UUID DEFAULT generateUUIDv4(),
uid UUID DEFAULT generateUUIDv4(),
version UInt32,
checksum String,
migration_name String,
checksum String,
migration_name String,
applied_at DateTime DEFAULT now()
)
ENGINE = MergeTree
)
ENGINE = MergeTree
ORDER BY tuple(applied_at)`,
clickhouse_settings: {
wait_end_of_query: 1,
Expand Down

0 comments on commit de87f00

Please sign in to comment.