Skip to content

Commit 919a04b

Browse files
committed
Remove IBM Db2 support from RocketAdmin Agent
- Updated main.ts to remove Db2 from the list of supported database types. - Deleted wait-for-db2.js and wait-for-db2.sh scripts as they are no longer needed. - Removed optional dependency on ibm_db from package.json. - Cleaned up caching constants and removed Db2 related cache options. - Eliminated Db2 related code from caching and data access layers. - Removed DataAccessObjectIbmDb2 and its references throughout the codebase. - Updated connection parameters and enums to exclude Db2.
1 parent 30fefc7 commit 919a04b

56 files changed

Lines changed: 721 additions & 16605 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

AGENTS.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

AGENTS.md

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Project Overview
6+
7+
RocketAdmin is a database administration panel that allows users to manage database connections, tables, and data. It consists of multiple components in a monorepo structure:
8+
9+
- **backend/** - NestJS API server (TypeScript, ES modules)
10+
- **frontend/** - Angular 19 web application (standalone components)
11+
- **rocketadmin-agent/** - NestJS agent for connecting to databases behind firewalls
12+
- **autoadmin-ws-server/** - WebSocket server for agent communication
13+
- **shared-code/** - Shared data access layer and utilities used by backend and agent
14+
15+
## Development Commands
16+
17+
### Backend
18+
19+
```bash
20+
cd backend
21+
pnpm start:dev # Start dev server with hot reload
22+
pnpm build # Build for production
23+
pnpm lint # ESLint with auto-fix
24+
pnpm test # Run non-saas AVA tests (serial)
25+
pnpm test-all # Run all AVA tests (5min timeout, serial)
26+
pnpm test-saas # Run SaaS-specific tests
27+
```
28+
29+
### Frontend
30+
31+
```bash
32+
cd frontend
33+
yarn start # Start Angular dev server
34+
yarn build # Production build
35+
yarn test:ci # Run tests headlessly (CI mode)
36+
yarn test --browsers=ChromeHeadlessCustom --no-watch --no-progress # Headless tests
37+
yarn lint # TSLint (deprecated, needs ESLint migration)
38+
```
39+
40+
### Running Backend Tests with Docker
41+
42+
The project uses `just` for test orchestration:
43+
44+
```bash
45+
just test # Run all backend tests with Docker Compose
46+
just test "path/to/test.ts" # Run specific test file
47+
```
48+
49+
This spins up test databases (MySQL, PostgreSQL, MSSQL, Oracle, MongoDB, DynamoDB) via `docker-compose.tst.yml`.
50+
51+
### Migrations
52+
53+
```bash
54+
cd backend
55+
pnpm build # Must build first
56+
pnpm migration:generate src/migrations/MigrationName # Generate migration
57+
pnpm migration:run # Run pending migrations
58+
pnpm migration:revert # Revert last migration
59+
```
60+
61+
## Architecture
62+
63+
### Monorepo Structure
64+
65+
- Uses pnpm workspaces with packages: `backend`, `rocketadmin-agent`, `shared-code`
66+
- `shared-code` is imported as `@rocketadmin/shared-code` workspace dependency
67+
- Frontend is a separate Angular project (not a workspace member)
68+
69+
### Backend (NestJS)
70+
71+
- **Entities pattern**: Each entity has its own directory under `src/entities/` containing:
72+
- `*.entity.ts` - TypeORM entity
73+
- `*.module.ts` - NestJS module
74+
- `*.controller.ts` - REST endpoints
75+
- `*.service.ts` - Business logic (use cases)
76+
- `dto/` - Request/response DTOs with class-validator decorators
77+
- `*.controller.ee.ts` - Enterprise edition controllers (SaaS features)
78+
- **Guards**: Authentication and authorization in `src/guards/`
79+
- **Data access**: Uses `shared-code` for database operations via Knex
80+
- **Testing**: AVA test framework with tests in `test/ava-tests/`
81+
- `non-saas-tests/` - Core functionality tests
82+
- `saas-tests/` - SaaS-specific feature tests
83+
- `complex-table-tests/` - Complex table operation tests
84+
85+
### Frontend (Angular 19)
86+
87+
See `frontend/CLAUDE.md` for detailed frontend architecture.
88+
89+
Key points:
90+
- Standalone components (no NgModules)
91+
- BehaviorSubject-based state management (no NgRx)
92+
- Multi-environment builds (development, production, saas, saas-production)
93+
- Jasmine/Karma testing with ChromeHeadless
94+
95+
### Shared Code
96+
97+
Located in `shared-code/src/`:
98+
- `data-access-layer/` - Database abstraction supporting MySQL, PostgreSQL, MSSQL, Oracle, MongoDB, DynamoDB, Cassandra, Elasticsearch
99+
- `knex-manager/` - Knex connection management
100+
- `caching/` - LRU cache utilities
101+
- `helpers/` - Shared utilities
102+
103+
### Agent Architecture
104+
105+
The rocketadmin-agent connects to databases in private networks:
106+
1. Agent runs inside customer's network
107+
2. Connects to `autoadmin-ws-server` via WebSocket
108+
3. Backend communicates with agent through WebSocket server
109+
4. Agent executes database queries and returns results
110+
111+
## Database Support
112+
113+
The application supports: MySQL, PostgreSQL, MongoDB, DynamoDB, Cassandra, OracleDB, MSSQL, Elasticsearch, Redis
114+
115+
Database-specific DAOs are in `shared-code/src/data-access-layer/`.
116+
117+
## Testing Database Connections
118+
119+
Test databases are defined in `docker-compose.tst.yml`:
120+
- MySQL: `testMySQL-e2e-testing:3306`
121+
- PostgreSQL: `testPg-e2e-testing:5432`
122+
- MSSQL: `mssql-e2e-testing:1433`
123+
- Oracle: `test-oracle-e2e-testing:1521`
124+
- MongoDB: `test-mongo-e2e-testing:27017`
125+
- DynamoDB: `test-dynamodb-e2e-testing:8000`
126+
127+
## Coding Conventions
128+
129+
### Class Member Ordering
130+
131+
- Private methods must be placed at the end of the class, after all public methods

CLAUDE.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ just test # Run all backend tests with Docker Compose
4646
just test "path/to/test.ts" # Run specific test file
4747
```
4848

49-
This spins up test databases (MySQL, PostgreSQL, MSSQL, Oracle, IBM DB2, MongoDB, DynamoDB) via `docker-compose.tst.yml`.
49+
This spins up test databases (MySQL, PostgreSQL, MSSQL, Oracle, MongoDB, DynamoDB) via `docker-compose.tst.yml`.
5050

5151
### Migrations
5252

@@ -95,7 +95,7 @@ Key points:
9595
### Shared Code
9696

9797
Located in `shared-code/src/`:
98-
- `data-access-layer/` - Database abstraction supporting MySQL, PostgreSQL, MSSQL, Oracle, MongoDB, DynamoDB, IBM DB2, Cassandra, Elasticsearch
98+
- `data-access-layer/` - Database abstraction supporting MySQL, PostgreSQL, MSSQL, Oracle, MongoDB, DynamoDB, Cassandra, Elasticsearch
9999
- `knex-manager/` - Knex connection management
100100
- `caching/` - LRU cache utilities
101101
- `helpers/` - Shared utilities
@@ -110,7 +110,7 @@ The rocketadmin-agent connects to databases in private networks:
110110

111111
## Database Support
112112

113-
The application supports: MySQL, PostgreSQL, MongoDB, DynamoDB, Cassandra, OracleDB, MSSQL, IBM DB2, Elasticsearch, Redis
113+
The application supports: MySQL, PostgreSQL, MongoDB, DynamoDB, Cassandra, OracleDB, MSSQL, Elasticsearch, Redis
114114

115115
Database-specific DAOs are in `shared-code/src/data-access-layer/`.
116116

@@ -121,7 +121,6 @@ Test databases are defined in `docker-compose.tst.yml`:
121121
- PostgreSQL: `testPg-e2e-testing:5432`
122122
- MSSQL: `mssql-e2e-testing:1433`
123123
- Oracle: `test-oracle-e2e-testing:1521`
124-
- IBM DB2: `test-ibm-db2-e2e-testing:50000`
125124
- MongoDB: `test-mongo-e2e-testing:27017`
126125
- DynamoDB: `test-dynamodb-e2e-testing:8000`
127126

backend/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"test-all": "node _run-with-timing.mjs ava --timeout=5m",
2020
"test-all-parallel": "AVA_CONCURRENCY=8 node _run-with-timing.mjs ava --timeout=5m",
2121
"test-saas": "node _run-with-timing.mjs ava test/ava-tests/saas-tests/*",
22-
"test-fast": "AVA_CONCURRENCY=6 node _run-with-timing.mjs ava --timeout=5m 'test/ava-tests/non-saas-tests/!(*oracle*|*ibmdb2*|*cassandra*|*elasticsearch*).test.ts' 'test/ava-tests/saas-tests/!(*oracle*|*ibmdb2*|*cassandra*|*elasticsearch*).test.ts'",
22+
"test-fast": "AVA_CONCURRENCY=6 node _run-with-timing.mjs ava --timeout=5m 'test/ava-tests/non-saas-tests/!(*oracle*|*cassandra*|*elasticsearch*).test.ts' 'test/ava-tests/saas-tests/!(*oracle*|*cassandra*|*elasticsearch*).test.ts'",
2323
"typeorm": "ts-node -r tsconfig-paths/register ../node_modules/.bin/typeorm",
2424
"migration:generate": "pnpm run typeorm migration:generate -d dist/src/shared/config/datasource.config.js",
2525
"migration:create": "pnpm run typeorm migration:create -d dist/src/shared/config/datasource.config.js",
@@ -109,7 +109,6 @@
109109
"@types/body-parser": "^1.19.6",
110110
"@types/cookie-parser": "^1.4.10",
111111
"@types/express": "^5.0.6",
112-
"@types/ibm_db": "^3.2.0",
113112
"@types/json2csv": "^5.0.7",
114113
"@types/node": "^24.10.1",
115114
"@types/supertest": "^7.2.0",

backend/src/ai-core/tools/prompts.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,6 @@ export function convertDbTypeToReadableString(dataType: ConnectionTypesEnum): st
5959
case ConnectionTypesEnum.oracledb:
6060
case ConnectionTypesEnum.agent_oracledb:
6161
return 'Oracle DB';
62-
case ConnectionTypesEnum.ibmdb2:
63-
case ConnectionTypesEnum.agent_ibmdb2:
64-
return 'IBM DB2';
6562
case ConnectionTypesEnum.clickhouse:
6663
case ConnectionTypesEnum.agent_clickhouse:
6764
return 'ClickHouse';

backend/src/ai-core/tools/query-validators.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,6 @@ export function wrapQueryWithLimit(query: string, databaseType: ConnectionTypesE
103103
case ConnectionTypesEnum.mssql:
104104
case ConnectionTypesEnum.agent_mssql:
105105
return `SELECT * FROM (${queryWithoutSemicolon}) AS ai_query LIMIT ${limit}`;
106-
case ConnectionTypesEnum.ibmdb2:
107-
case ConnectionTypesEnum.agent_ibmdb2:
108-
return `SELECT * FROM (${queryWithoutSemicolon}) AS ai_query FETCH FIRST ${limit} ROWS ONLY`;
109106
case ConnectionTypesEnum.oracledb:
110107
case ConnectionTypesEnum.agent_oracledb:
111108
return `SELECT * FROM (${queryWithoutSemicolon}) WHERE ROWNUM <= ${limit}`;

backend/src/entities/agent/repository/custom-agent-repository-extension.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,6 @@ export const customAgentRepositoryExtension: IAgentRepository = {
5252
return 'MYSQL-TEST-AGENT-TOKEN';
5353
case ConnectionTypeTestEnum.agent_postgres:
5454
return 'POSTGRES-TEST-AGENT-TOKEN';
55-
case ConnectionTypeTestEnum.agent_ibmdb2:
56-
return 'IBMDB2-TEST-AGENT-TOKEN';
5755
case ConnectionTypeTestEnum.agent_mongodb:
5856
return 'MONGODB-TEST-AGENT-TOKEN';
5957
case ConnectionTypeTestEnum.agent_redis:

backend/src/entities/connection/utils/is-sql-connection-type.util.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,11 @@ const SQL_CONNECTION_TYPES: ReadonlySet<string> = new Set<string>([
66
ConnectionTypesEnum.mysql2,
77
ConnectionTypesEnum.oracledb,
88
ConnectionTypesEnum.mssql,
9-
ConnectionTypesEnum.ibmdb2,
109
ConnectionTypesEnum.clickhouse,
1110
ConnectionTypesEnum.agent_postgres,
1211
ConnectionTypesEnum.agent_mysql,
1312
ConnectionTypesEnum.agent_oracledb,
1413
ConnectionTypesEnum.agent_mssql,
15-
ConnectionTypesEnum.agent_ibmdb2,
1614
ConnectionTypesEnum.agent_clickhouse,
1715
]);
1816

backend/src/entities/table-schema/ai/schema-change-prompts.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,9 @@ Multi-proposal rules:
4646
- For a single-change request, supply a "proposals" array of length 1 — same content as before.
4747
4848
Rules for the generated SQL:
49-
- Target dialect is ${dialect}. Use the correct identifier quoting (double quotes for PostgreSQL/Oracle/DB2, backticks for MySQL/ClickHouse, square brackets or double quotes for Microsoft SQL Server) and the correct syntax for data types, autoincrement, and constraints.
49+
- Target dialect is ${dialect}. Use the correct identifier quoting (double quotes for PostgreSQL/Oracle, backticks for MySQL/ClickHouse, square brackets or double quotes for Microsoft SQL Server) and the correct syntax for data types, autoincrement, and constraints.
5050
- For Microsoft SQL Server, use IDENTITY for autoincrement, NVARCHAR/VARCHAR for strings, and name primary/foreign keys explicitly (e.g. CONSTRAINT PK_tbl PRIMARY KEY ...) so they are referenceable in rollback DROP CONSTRAINT statements.
5151
- For Oracle DB, use NUMBER/VARCHAR2, and GENERATED BY DEFAULT AS IDENTITY for autoincrement. ALTER TABLE ... MODIFY is the column-change syntax.
52-
- For IBM DB2, use BIGINT GENERATED BY DEFAULT AS IDENTITY and VARCHAR. ALTER TABLE ... ALTER COLUMN ... SET DATA TYPE is the column-change syntax.
5352
- For ClickHouse: every CREATE TABLE MUST include a table engine (prefer \`ENGINE = MergeTree()\`) followed by an \`ORDER BY (<column or tuple>)\` clause — ClickHouse has no conventional PRIMARY KEY; the sort/primary key is the \`ORDER BY\` tuple. Use types like \`UInt32\`, \`UInt64\`, \`Int64\`, \`String\`, \`Float64\`, \`DateTime\`, \`Date\`, \`UUID\`, \`Nullable(T)\` (wrap a type to allow NULL). There is no autoincrement — use a plain numeric type the user populates. Column additions use \`ALTER TABLE t ADD COLUMN c T\`, drops use \`ALTER TABLE t DROP COLUMN c\`, type changes use \`ALTER TABLE t MODIFY COLUMN c T\`. Do NOT emit \`ON CLUSTER\` clauses; the target is a single-node server. There are NO true transactions, so rollback is a best-effort compensating DDL (e.g. add-column forward / drop-column rollback). Do NOT propose foreign keys (ClickHouse does not enforce them). Indexes in ClickHouse are DATA SKIPPING indexes created with \`ALTER TABLE t ADD INDEX idx_name col TYPE minmax GRANULARITY 4\`; rollback is \`ALTER TABLE t DROP INDEX idx_name\`. Avoid \`DROP TABLE IF EXISTS\` unless the user asked.
5453
- For Cassandra (CQL): every CREATE TABLE MUST declare a \`PRIMARY KEY\` inline, either as a column-level \`PRIMARY KEY\` on one column or as a trailing \`PRIMARY KEY ((partition_key_cols), clustering_key_cols)\` clause. Use CQL types: \`UUID\`, \`TIMEUUID\`, \`TEXT\`, \`VARCHAR\`, \`ASCII\`, \`INT\`, \`BIGINT\`, \`SMALLINT\`, \`TINYINT\`, \`FLOAT\`, \`DOUBLE\`, \`DECIMAL\`, \`BOOLEAN\`, \`TIMESTAMP\`, \`DATE\`, \`TIME\`, \`BLOB\`, \`INET\`, \`LIST<T>\`, \`SET<T>\`, \`MAP<K,V>\`. There is NO autoincrement — prefer \`UUID\` partition keys. Do NOT propose foreign keys (Cassandra does not enforce them). Do NOT propose \`ALTER COLUMN\` type-change DDL — CQL only supports renaming primary-key columns and adding/dropping non-primary-key columns. Column additions use \`ALTER TABLE t ADD c T\` (no \`COLUMN\` keyword), drops use \`ALTER TABLE t DROP c\`. Indexes are \`CREATE INDEX idx_name ON t (col)\` with rollback \`DROP INDEX idx_name\`. There are NO transactions; rollback is a best-effort compensating DDL. Do NOT emit \`CREATE KEYSPACE\`, \`DROP KEYSPACE\`, \`USE\`, or materialized-view DDL.
5554
- Both forwardSql and rollbackSql MUST be single DDL statements. No semicolons terminating a chain. No multi-statement scripts.

backend/src/entities/table-schema/utils/assert-dialect-supported.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ const SUPPORTED_DIALECTS: ReadonlySet<ConnectionTypesEnum> = new Set([
77
ConnectionTypesEnum.mysql2,
88
ConnectionTypesEnum.mssql,
99
ConnectionTypesEnum.oracledb,
10-
ConnectionTypesEnum.ibmdb2,
1110
ConnectionTypesEnum.mongodb,
1211
ConnectionTypesEnum.clickhouse,
1312
ConnectionTypesEnum.agent_clickhouse,
@@ -24,7 +23,7 @@ export function isDialectSupported(connectionType: ConnectionTypesEnum): boolean
2423
export function assertDialectSupported(connectionType: ConnectionTypesEnum): void {
2524
if (!isDialectSupported(connectionType)) {
2625
throw new BadRequestException(
27-
`Schema changes via AI are not yet supported for "${connectionType}". Supported: PostgreSQL, MySQL, Microsoft SQL Server, Oracle DB, IBM DB2, MongoDB, ClickHouse, DynamoDB, Cassandra, Elasticsearch.`,
26+
`Schema changes via AI are not yet supported for "${connectionType}". Supported: PostgreSQL, MySQL, Microsoft SQL Server, Oracle DB, MongoDB, ClickHouse, DynamoDB, Cassandra, Elasticsearch.`,
2827
);
2928
}
3029
}
@@ -57,8 +56,6 @@ const SQL_PARSER_DIALECTS: Record<string, string> = {
5756
[ConnectionTypesEnum.agent_mysql]: 'MySQL',
5857
[ConnectionTypesEnum.mssql]: 'TransactSQL',
5958
[ConnectionTypesEnum.agent_mssql]: 'TransactSQL',
60-
[ConnectionTypesEnum.ibmdb2]: 'DB2',
61-
[ConnectionTypesEnum.agent_ibmdb2]: 'DB2',
6259
};
6360

6461
export function connectionTypeToParserDialect(connectionType: ConnectionTypesEnum): string {

0 commit comments

Comments
 (0)