Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,23 @@ Flydb 的重要变更记录在本文件中。版本遵循语义化版本;正

## [Unreleased]

## [0.3.8] - 2026-10-21

### 修复

- 修复达梦 DM8 重复执行迁移时因历史表或锁表已存在而报 `FLYDB-2010` 的问题。DM8 8.1.3.62 返回的“对象已存在”错误码为 `-2124`,此前仅识别 Oracle `955`;现在由 `SchemaHistoryDdl.isTableAlreadyExists(SQLException)` 交给方言判定,达梦额外识别该错误码,其他建表错误仍阻断迁移。
- 历史表 DDL 新增 Java 8 默认方法,保留既有 SPI 的错误处理行为;CLI 命令、配置和 JSON 协议不变,不需要修改已有迁移脚本或执行 `repair`。

### 验证与文档

- 在授权本地 DM8 8.1.3.62、大小写不敏感模式完成连接、validate、dry-run、中文数据与 PL/SQL 块迁移、视图查询和重复迁移验证;记录实测边界与旧版本复现,不扩大为厂商认证或并发锁竞争验证。
- 新增达梦历史表/锁表重复初始化回归,覆盖大小写敏感与不敏感的离线分支、其他 SQLState 相同的建表错误不被忽略,以及 Oracle 原有行为;同步达梦指南、设计说明和中英文数据库验证矩阵。

### 发行说明

- 产品、CLI、随包插件与工作台版本同步为 `0.3.8`;MCP Adapter 独立版本仍为 `0.1.0`。
- 纳入上个正式版本以来 main 已合并的依赖更新,包括 Jackson Databind `2.21.7`、MCP SDK `1.31.0` 和 Vite `8.3.5`,以及对应锁文件更新。

## [0.3.7] - 2026-09-08

本次重点完善本机工作台的日常使用:大变更预览更流畅,多配置更易整理,问题上下文可直接交给 Agent;修复大记录读取与迁移状态显示问题。
Expand Down
12 changes: 6 additions & 6 deletions README.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ MySQL, PostgreSQL, Oracle and Chinese databases including OceanBase, TiDB, DM8,
Download the ZIP from [Releases](https://github.com/zzxCoding/Flydb/releases/latest), extract it and run:

```bash
cd flydb-cli-0.3.7
cd flydb-cli-0.3.8
bin/flydb web
```

Expand Down Expand Up @@ -87,7 +87,7 @@ Flydb manages migration workflow and database dialect behavior. It does not tran
| MySQL | Yes | Automated contract tests; CLI distribution end-to-end verification |
| PostgreSQL | Yes | Automated contract tests |
| Oracle | Yes | Automated contract tests; end-to-end validation (validate / clean / migrate) completed on a licensed real instance |
| DM8 (Dameng) | Yes | Dialect and driver-metadata contract tests; real-environment certification pending |
| DM8 (Dameng) | Yes | End-to-end verified on an authorized DM8 8.1.3.62 instance in case-insensitive mode; 0.3.8 fixes repeated migrations ([test record](./docs/verification/dm8-20261021.md)) |
| KingbaseES | Yes | Dialect and driver-metadata contract tests; real-environment certification pending |
| openGauss | Yes | Dialect and driver-metadata contract tests; real-environment certification pending |
| OceanBase | Oracle/MySQL family reuse | Oracle tenant end-to-end validated on a licensed real instance; MySQL tenant under lightweight compatibility tests |
Expand Down Expand Up @@ -143,7 +143,7 @@ Plain Java applications depend on `flydb-core`:
<dependency>
<groupId>io.github.zzxcoding</groupId>
<artifactId>flydb-core</artifactId>
<version>0.3.7</version>
<version>0.3.8</version>
</dependency>
```

Expand All @@ -154,13 +154,13 @@ Spring Boot applications pick the matching starter; it runs `migrate` during con
<dependency>
<groupId>io.github.zzxcoding</groupId>
<artifactId>flydb-spring-boot-3-starter</artifactId>
<version>0.3.7</version>
<version>0.3.8</version>
</dependency>
<!-- Spring Boot 2.7 / Java 8 -->
<dependency>
<groupId>io.github.zzxcoding</groupId>
<artifactId>flydb-spring-boot-2-starter</artifactId>
<version>0.3.7</version>
<version>0.3.8</version>
</dependency>
```

Expand Down Expand Up @@ -204,7 +204,7 @@ The full reactor, including the Boot 3 modules, is built with Java 17; the Boot
./mvnw verify
```

The CLI distribution is generated at `flydb-cli/target/flydb-cli-0.3.7.zip`. The core module enforces an 80% JaCoCo line-coverage gate and zero non-test runtime dependencies via Maven Enforcer.
The CLI distribution is generated at `flydb-cli/target/flydb-cli-0.3.8.zip`. The core module enforces an 80% JaCoCo line-coverage gate and zero non-test runtime dependencies via Maven Enforcer.

Database integration contracts are skipped by default. Set `-Pmysql`/`-Ppostgresql` and `-Dflydb.integration.database=<dialect>` explicitly to start temporary databases and run the selected tests. The full matrix runs in `.github/workflows/ci.yml`.

Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Flydb 是给开发、运维和实施人员使用的数据库版本迁移工具
从 [Releases](https://github.com/zzxCoding/Flydb/releases/latest) 下载 ZIP,解压后运行:

```bash
cd flydb-cli-0.3.7
cd flydb-cli-0.3.8
bin/flydb web
```

Expand Down Expand Up @@ -87,7 +87,7 @@ Flydb 管理迁移流程与数据库方言行为,不会把任意厂商 SQL 自
| MySQL | 是 | 自动化兼容测试;CLI 发行包端到端验证 |
| PostgreSQL | 是 | 自动化兼容测试 |
| Oracle | 是 | 自动化契约测试;已在授权真实实例完成 validate、clean、migrate 端到端验证 |
| 达梦 DM8 | 是 | 方言与驱动元数据契约测试;真实环境认证待补 |
| 达梦 DM8 | 是 | DM8 8.1.3.62 授权实例端到端验证(大小写不敏感);0.3.8 修复重复迁移,见[实测记录](./docs/verification/dm8-20261021.md) |
| 人大金仓 KingbaseES | 是 | 方言与驱动元数据契约测试;真实环境认证待补 |
| openGauss | 是 | 方言与驱动元数据契约测试;真实环境认证待补 |
| OceanBase | 复用 Oracle/MySQL 家族 | Oracle 租户已在授权真实实例完成端到端验证;MySQL 租户为轻量兼容测试 |
Expand Down Expand Up @@ -143,7 +143,7 @@ flydb.migrate();
<dependency>
<groupId>io.github.zzxcoding</groupId>
<artifactId>flydb-core</artifactId>
<version>0.3.7</version>
<version>0.3.8</version>
</dependency>
```

Expand All @@ -154,13 +154,13 @@ Spring Boot 应用选择对应 starter,容器初始化期间执行 `migrate`
<dependency>
<groupId>io.github.zzxcoding</groupId>
<artifactId>flydb-spring-boot-3-starter</artifactId>
<version>0.3.7</version>
<version>0.3.8</version>
</dependency>
<!-- Spring Boot 2.7 / Java 8 -->
<dependency>
<groupId>io.github.zzxcoding</groupId>
<artifactId>flydb-spring-boot-2-starter</artifactId>
<version>0.3.7</version>
<version>0.3.8</version>
</dependency>
```

Expand Down Expand Up @@ -204,7 +204,7 @@ bin/flydb clean --clean-disabled=false --force # clean 默认禁用;非交
./mvnw verify
```

CLI 构建产物位于 `flydb-cli/target/flydb-cli-0.3.7.zip`。core 的 JaCoCo 行覆盖率门禁为 80%,并由 Maven Enforcer 保证零非测试运行时依赖。
CLI 构建产物位于 `flydb-cli/target/flydb-cli-0.3.8.zip`。core 的 JaCoCo 行覆盖率门禁为 80%,并由 Maven Enforcer 保证零非测试运行时依赖。

数据库集成契约默认跳过;显式设置 `-Pmysql`/`-Ppostgresql` 与 `-Dflydb.integration.database=<dialect>` 后,才会启动临时数据库执行对应测试。完整矩阵由 `.github/workflows/ci.yml` 执行。

Expand Down
6 changes: 4 additions & 2 deletions docs/design/03-dialects.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public interface Database extends AutoCloseable {
| 标识符引用 | 双引号(引用即大小写敏感) |
| 语句切分 | 识别 PL/SQL 块(`CREATE [OR REPLACE] [EDITIONABLE\|NONEDITIONABLE] PROCEDURE/FUNCTION/TRIGGER/PACKAGE/TYPE`、裸 `DECLARE`/`BEGIN`),块终止符为独占一行的 `/`;`EDITIONABLE VIEW/SYNONYM` 仍是普通单语句 |
| 锁 | 通用锁表方案(家族默认);专用锁连接使用包含当前 schema 的全限定锁表名 |
| 历史表 DDL | 无 `IF NOT EXISTS` → "先查系统目录后建 + 建表异常兜底"的幂等策略;`success` 用 `NUMBER(1)`;`installed_on TIMESTAMP DEFAULT SYSTIMESTAMP NOT NULL`——Oracle 列定义要求 `DEFAULT` 在 `NOT NULL` 之前,反序报 `ORA-00907` |
| 历史表 DDL | 无 `IF NOT EXISTS` → 尝试建表,仅忽略方言确认的“对象已存在”错误,以兼容重复调用与并发初始化;`success` 用 `NUMBER(1)`;`installed_on TIMESTAMP DEFAULT SYSTIMESTAMP NOT NULL`——Oracle 列定义要求 `DEFAULT` 在 `NOT NULL` 之前,反序报 `ORA-00907` |
| clean | 专用 `OracleCleanStrategy`:序列按待清理 schema 查 `all_sequences`(跳过 `ISEQ$$_`/`BIN$`)——JDBC `getTables` 不返回序列且无 `information_schema`;`DROP TABLE ... PURGE` 并收尾 `PURGE RECYCLEBIN`(失败降级警告),避免回收站残留的表/LOB 段/索引占名导致 `CREATE` 撞名;OceanBase 直接返回 `-4007`,或以 vendor code `600` 的 `ORA-00600 arguments` 包装 `-4007` 时,等待 `all_tab_columns` 列数稳定后有限重试,并跳过 `_...hidden...` DDL 中间表;记账表排除忽略大小写(非引用名大写存储) |
| currentSchema | 查询会话当前 schema(达梦:`SELECT SYS_CONTEXT('USERENV','CURRENT_SCHEMA') FROM dual`,实施时确认) |

Expand All @@ -119,9 +119,11 @@ public interface Database extends AutoCloseable {
`SchemaHistoryDdl` 返回两组 DDL(历史表 + 锁表,见 [04 §2.2](04-parser-lock-tx.md)),由 `SchemaHistory.ensureExists()` 调用:

1. PG 系/MySQL 系:直接 `CREATE TABLE IF NOT EXISTS`(幂等)。
2. Oracle 系:先查系统目录判断存在性;不存在则建表,并捕获"表已存在"错误码兜底(两个进程同时初始化的竞态窗口)。
2. Oracle 系:尝试建表,由 `SchemaHistoryDdl.isTableAlreadyExists(SQLException)` 判定异常是否可以忽略。默认保留 Oracle `955`;达梦方言额外识别 DM8 8.1.3.62 实测的 `-2124`。不能按通用 SQLState(例如 DM 的 `22000`)忽略语法或权限错误。厂商差异留在方言,历史仓储不维护产品错误码列表。
3. 建表动作发生在获取锁**之前**(锁表本身需要先存在),因此建表必须自身幂等且容忍竞态——这是流程顺序上的硬约束(见 [05 §1](05-commands.md) 时序第 4~5 步)。

2026-10-21 实例验证确认:原实现直接尝试建表,仅识别 Oracle `955`,与旧文档的“先查系统目录”描述不符,达梦重复迁移因此失败。这里明确采用现有的建表加方言异常判定策略;目录预查不能替代并发场景中的异常兜底。

## 6. 扩展新方言的成本模型(二期验收标准)

新增一个 PG 系国产库(如瀚高)的预期工作量,用于验证本设计的扩展性:
Expand Down
4 changes: 2 additions & 2 deletions docs/getting-started/ci-integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ jobs:
migrate:
runs-on: ubuntu-latest
env:
FLYDB_HOME: ${{ runner.temp }}/flydb-cli-0.3.7 # ZIP 内的版本化根目录
FLYDB_HOME: ${{ runner.temp }}/flydb-cli-0.3.8 # ZIP 内的版本化根目录
CONF: deploy/flydb.mysql.uat.conf
steps:
- uses: actions/checkout@v4

- name: 安装 Flydb CLI(版本随仓库锁定)
run: |
curl -fsSL -o flydb.zip \
"https://github.com/zzxCoding/Flydb/releases/download/v0.3.7/flydb-cli-0.3.7.zip"
"https://github.com/zzxCoding/Flydb/releases/download/v0.3.8/flydb-cli-0.3.8.zip"
unzip -q flydb.zip -d "$RUNNER_TEMP"
"$FLYDB_HOME/bin/flydb" version

Expand Down
20 changes: 17 additions & 3 deletions docs/getting-started/dm8.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,32 @@

## 支持边界

达梦 DM8 使用 Oracle 家族的 SQL 切分、历史表和锁表语义。当前已完成方言、元数据和驱动契约设计;真实实例验证需要授权环境和厂商驱动,公共 CI 不捆绑 DM 驱动。
达梦 DM8 使用 Oracle 家族的 SQL 切分、历史表和锁表语义。已在授权本地 DM8 8.1.3.62 实例、大小写不敏感模式完成 CLI 连接、`validate`、`--dry-run migrate`、首次迁移和重复迁移验证。公共 CI 不捆绑 DM 驱动;该结果不代表厂商认证或其他版本、大小写模式已验证。完整环境、命令与结果见 [2026-10-21 实测记录](../verification/dm8-20261021.md)。

0.3.8 修复了历史表重复初始化缺陷:DM8 返回“对象已存在”错误码 `-2124`,原 CLI 0.3.7 仅识别 Oracle `955`,导致第二次 `migrate` 报 `FLYDB-2010`。首次复验使用本地源码修复包 `0.3.7-local.dm8.20261021`,详细记录保留了该验证包的身份;正式版本获取状态以 [GitHub Releases](https://github.com/zzxCoding/Flydb/releases) 为准。

## 驱动与连接

从达梦安装介质或企业制品库获取 JDBC 驱动,使用 `jdbc:dm://` URL,并显式指定 `dm`:

```bash
bin/flydb init --url 'jdbc:dm://127.0.0.1:5236/demo' \
bin/flydb init --url 'jdbc:dm://127.0.0.1:5236' \
--user SYSDBA --database-type dm --yes
```

驱动放在 CLI 的 `drivers/` 目录;应用依赖由调用方按厂商许可管理。真实契约环境变量为 `FLYDB_TEST_DM_URL`、`FLYDB_TEST_DM_USER`、`FLYDB_TEST_DM_PASSWORD`。
驱动放在 CLI 的 `drivers/` 目录;应用依赖由调用方按厂商许可管理。本次复用本地已有的 `DmJdbcDriver18` 8.1.3.62,未联网下载或分发驱动。达梦驱动没有内置固定 Maven 坐标,只有本地 Maven 缓存时仍需显式配置完整 `flydb.driver-coordinate`,或将现有 JAR 放入 `drivers/`。

真实只读契约环境变量为 `FLYDB_TEST_DM_URL`、`FLYDB_TEST_DM_USER`、`FLYDB_TEST_DM_PASSWORD`;将驱动加入测试运行时 classpath 后可执行:

```bash
# 密码预先从受控环境注入;JDK 17 构建,不会自动执行迁移。
./mvnw -B -pl flydb-integration-tests -am \
-Dtest=LicensedDatabaseContractTest#dmRealInstanceContract \
-Dsurefire.failIfNoSpecifiedTests=false \
-Dmaven.test.additionalClasspath=/path/to/DmJdbcDriver18.jar test
```

必须核对该用例实际执行且 `Skipped: 0`;只看到 `BUILD SUCCESS` 不等于已连接真库。需要写库验证时,仍应先完成 `validate`、dry-run 和目标范围授权。

## 已知限制

Expand Down
2 changes: 1 addition & 1 deletion docs/getting-started/mcp-adapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ npx flydb-mcp # 一次性启动(发布后可用;registry 名称以发
"command": "npx",
"args": ["flydb-mcp"],
"env": {
"FLYDB_CLI": "/opt/flydb-cli-0.3.7/bin/flydb",
"FLYDB_CLI": "/opt/flydb-cli-0.3.8/bin/flydb",
"FLYDB_PASSWORD": "由宿主 secret 注入"
}
}
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/compatibility.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Maven 坐标 groupId 统一为 `io.github.zzxcoding`(Central Portal 经 GitHub
| MySQL | `mysql` | `com.mysql:mysql-connector-j` | `com.mysql.cj.jdbc.Driver` | 官方声明支持 JRE 8+ | 自动化兼容测试;CLI 发行包端到端验证 |
| PostgreSQL | `postgresql` | `org.postgresql:postgresql` 42.x | `org.postgresql.Driver` | 官方声明支持 JRE 8+ | 自动化兼容测试 |
| Oracle | `oracle` | Oracle 制品库 `ojdbc` | `oracle.jdbc.OracleDriver` | 见厂商文档 | 自动化契约测试;已在授权真实实例完成 validate、clean、migrate 端到端验证 |
| 达梦 DM8 | `dm` | 达梦安装介质或企业制品库 | `dm.jdbc.driver.DmDriver` | 见厂商文档 | 方言与驱动元数据契约测试;真实环境认证待补 |
| 达梦 DM8 | `dm` | 达梦安装介质或企业制品库 | `dm.jdbc.driver.DmDriver` | 见厂商文档 | DM8 8.1.3.62 授权实例端到端验证(大小写不敏感);0.3.8 修复重复迁移,见[实测记录](../verification/dm8-20261021.md) |
| 人大金仓 KingbaseES | `kingbasees` | 人大金仓交付介质(`cn.com.kingbase:kingbase8`,选不带 `.jre` 后缀的 JDK8+ 版本) | `com.kingbase8.Driver` | 见厂商文档 | 方言与驱动元数据契约测试;真实环境认证待补 |
| openGauss | `opengauss` | `org.opengauss:opengauss-jdbc` | `org.opengauss.Driver` | 见厂商文档 | 方言与驱动元数据契约测试;真实环境认证待补 |
| OceanBase | `oceanbase` | `com.oceanbase:oceanbase-client` | `com.oceanbase.jdbc.Driver` | 官方声明基于 Java 8 开发 | Oracle 租户已在授权真实实例完成端到端验证;MySQL 租户为轻量兼容测试 |
Expand Down
Loading
Loading