Skip to content

Commit

Permalink
Fix BigInt in MariaDB connector #335
Browse files Browse the repository at this point in the history
  • Loading branch information
loicknuchel committed Dec 3, 2024
1 parent 90f964a commit fef9df9
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 17 deletions.
2 changes: 1 addition & 1 deletion cli/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "azimutt",
"description": "Export database schema from relational or document databases. Import it to https://azimutt.app",
"version": "0.1.35",
"version": "0.1.36",
"license": "MIT",
"homepage": "https://azimutt.app",
"keywords": [
Expand Down
2 changes: 1 addition & 1 deletion cli/src/version.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const version = '0.1.35' // FIXME: `process.env.npm_package_version` is not available :/
export const version = '0.1.36' // FIXME: `process.env.npm_package_version` is not available :/
12 changes: 6 additions & 6 deletions gateway/package-lock.json

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

4 changes: 2 additions & 2 deletions gateway/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@azimutt/gateway",
"description": "A Gateway to proxy database access for Azimutt frontend",
"version": "0.1.22",
"version": "0.1.23",
"license": "MIT",
"homepage": "https://azimutt.app",
"keywords": [
Expand Down Expand Up @@ -29,7 +29,7 @@
"dependencies": {
"@azimutt/connector-bigquery": "^0.1.2",
"@azimutt/connector-couchbase": "^0.1.2",
"@azimutt/connector-mariadb": "^0.1.8",
"@azimutt/connector-mariadb": "^0.1.9",
"@azimutt/connector-mongodb": "^0.1.4",
"@azimutt/connector-mysql": "^0.1.5",
"@azimutt/connector-oracle": "^0.1.3",
Expand Down
2 changes: 1 addition & 1 deletion libs/connector-mariadb/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@azimutt/connector-mariadb",
"description": "Connect to MariaDB, extract schema, run analysis and queries",
"version": "0.1.8",
"version": "0.1.9",
"license": "MIT",
"homepage": "https://azimutt.app",
"keywords": [],
Expand Down
14 changes: 8 additions & 6 deletions libs/connector-mariadb/src/mariadb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ export type RawTable = {
table_kind: 'BASE TABLE' | 'VIEW' | 'SYSTEM VIEW'
table_engine: 'MEMORY' | 'MyISAM' | 'InnoDB' | null
table_comment: string // default: '' and 'VIEW'
table_rows: number | null // null for views
table_size: number | null // null for views
index_size: number | null // null for views
table_rows: number | bigint | null // null for views
table_size: number | bigint | null // null for views
index_size: number | bigint | null // null for views
row_size: number | null // null for views
auto_increment_next: number | null
table_options: string | null // ex: 'max_rows=2802'
Expand Down Expand Up @@ -156,9 +156,9 @@ function buildEntity(table: RawTable, columns: RawColumn[], primaryKeyColumns: R
checks: checks.map(buildCheck).filter(isNotUndefined),
doc: table.table_comment === 'VIEW' ? undefined : table.table_comment || undefined,
stats: removeUndefined({
rows: table.table_rows || undefined,
size: table.table_size || undefined,
sizeIdx: table.index_size || undefined,
rows: asNumber(table.table_rows),
size: asNumber(table.table_size),
sizeIdx: asNumber(table.index_size),
sizeToast: undefined,
sizeToastIdx: undefined,
scanSeq: undefined,
Expand All @@ -172,6 +172,8 @@ function buildEntity(table: RawTable, columns: RawColumn[], primaryKeyColumns: R
})
}

const asNumber = (i: bigint | number | null): number | undefined => i !== null ? (typeof i === 'bigint' ? Number(i) : i) : undefined

export type RawColumn = {
table_schema: string
table_name: string
Expand Down

0 comments on commit fef9df9

Please sign in to comment.