Skip to content

Commit

Permalink
Fix MariaDB issue with BigInt #335
Browse files Browse the repository at this point in the history
  • Loading branch information
loicknuchel committed Nov 29, 2024
1 parent 8b6460a commit 421392d
Show file tree
Hide file tree
Showing 7 changed files with 66 additions and 69 deletions.
2 changes: 2 additions & 0 deletions cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ Issues:

View it on [npm](https://www.npmjs.com/package/azimutt).

If any issue, unpublish the package with: `npm unpublish azimutt@0.1.33`

## Dev

If you need to develop on multiple libs at the same time (ex: want to update a connector and try it through the CLI), depend on local libs but publish & revert before commit.
Expand Down
2 changes: 1 addition & 1 deletion cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "azimutt",
"version": "0.1.32",
"version": "0.1.34",
"description": "Export database schema from relational or document databases. Import it to https://azimutt.app",
"keywords": [
"database",
Expand Down
39 changes: 19 additions & 20 deletions gateway/package-lock.json

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

12 changes: 4 additions & 8 deletions gateway/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@azimutt/gateway",
"version": "0.1.19",
"version": "0.1.21",
"description": "A Gateway to proxy database access for Azimutt frontend",
"keywords": [
"database",
Expand Down Expand Up @@ -42,15 +42,15 @@
"dependencies": {
"@azimutt/connector-bigquery": "^0.1.2",
"@azimutt/connector-couchbase": "^0.1.2",
"@azimutt/connector-mariadb": "^0.1.6",
"@azimutt/connector-mariadb": "^0.1.7",
"@azimutt/connector-mongodb": "^0.1.4",
"@azimutt/connector-mysql": "^0.1.5",
"@azimutt/connector-oracle": "^0.1.3",
"@azimutt/connector-postgres": "^0.1.11",
"@azimutt/connector-snowflake": "^0.1.2",
"@azimutt/connector-sqlserver": "^0.1.4",
"@azimutt/models": "^0.1.15",
"@azimutt/utils": "^0.1.6",
"@azimutt/models": "^0.1.16",
"@azimutt/utils": "^0.1.7",
"@fastify/cors": "9.0.1",
"@sinclair/typebox": "0.29.6",
"ajv": "8.17.1",
Expand All @@ -75,9 +75,5 @@
"tsx": "^4.19.2",
"typescript": "^5.6.3",
"vitest": "^2.1.4"
},
"engines": {
"node": "21.6.0",
"npm": "10.3.0"
}
}
2 changes: 1 addition & 1 deletion libs/connector-mariadb/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@azimutt/connector-mariadb",
"version": "0.1.6",
"version": "0.1.7",
"description": "Connect to MariaDB, extract schema, run analysis and queries",
"keywords": [],
"homepage": "https://azimutt.app",
Expand Down
10 changes: 5 additions & 5 deletions libs/connector-mariadb/src/mariadb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ function buildEntity(table: RawTable, columns: RawColumn[], primaryKeyColumns: R
kind: table.table_kind === 'VIEW' || table.table_kind === 'SYSTEM VIEW' ? 'view' as const : undefined,
def: table.definition || undefined,
attrs: columns.slice(0)
.sort((a, b) => (a.column_index || 0) - (b.column_index || 0))
.sort((a, b) => a.column_index > b.column_index ? 1 : a.column_index < b.column_index ? -1 : 0)
.map(c => buildAttribute(c, jsonColumns[c.column_name], polyColumns[c.column_name])),
pk: primaryKeyColumns.length > 0 ? buildPrimaryKey(primaryKeyColumns) : undefined,
indexes: indexes.map(buildIndex),
Expand All @@ -175,7 +175,7 @@ function buildEntity(table: RawTable, columns: RawColumn[], primaryKeyColumns: R
export type RawColumn = {
table_schema: string
table_name: string
column_index: number
column_index: number | bigint
column_name: string
column_type: string
column_nullable: 'YES' | 'NO'
Expand Down Expand Up @@ -232,7 +232,7 @@ export type RawConstraintColumn = {
table_schema: string
table_name: string
column_name: string
column_index: number
column_index: number | bigint
ref_schema: string | null
ref_table: string | null
ref_column: string | null
Expand Down Expand Up @@ -278,7 +278,7 @@ function buildPrimaryKey(columns: RawConstraintColumn[]): PrimaryKey {
return removeUndefined({
name: first.constraint_name === 'PRIMARY' ? undefined : first.constraint_name || undefined,
attrs: columns.slice(0)
.sort((a, b) => (a.column_index || 0) - (b.column_index || 0))
.sort((a, b) => a.column_index > b.column_index ? 1 : a.column_index < b.column_index ? -1 : 0)
.map(c => [c.column_name]),
doc: undefined,
stats: undefined,
Expand All @@ -291,7 +291,7 @@ function buildIndex(columns: RawConstraintColumn[]): Index {
return removeUndefined({
name: first.constraint_name || undefined,
attrs: columns.slice(0)
.sort((a, b) => (a.column_index || 0) - (b.column_index || 0))
.sort((a, b) => a.column_index > b.column_index ? 1 : a.column_index < b.column_index ? -1 : 0)
.map(c => [c.column_name]),
unique: first.constraint_type === 'UNIQUE' ? true : undefined, // false when not specified
partial: undefined,
Expand Down
68 changes: 34 additions & 34 deletions pnpm-lock.yaml

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

0 comments on commit 421392d

Please sign in to comment.