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
68 changes: 68 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Bug 报告
description: 报告可复现的 Flydb 行为错误
title: "[Bug] "
labels:
- bug
body:
- type: markdown
attributes:
value: |
感谢报告。请删除密码、令牌、完整生产连接串和业务数据;安全漏洞请使用仓库 Security 页面的私密报告入口。
- type: input
id: flydb-version
attributes:
label: Flydb 版本
placeholder: 例如 0.2.0
validations:
required: true
- type: input
id: environment
attributes:
label: Java、数据库与驱动版本
placeholder: 例如 Java 17 / MySQL 8.0 / Connector-J 8.2.0
validations:
required: true
- type: dropdown
id: interface
attributes:
label: 使用入口
options:
- CLI
- Java API
- Spring Boot 2 Starter
- Spring Boot 3 Starter
- Agent Skill
- 其他
validations:
required: true
- type: textarea
id: reproduction
attributes:
label: 最小复现步骤
description: 包含脱敏后的配置来源、命令和迁移文件结构。
validations:
required: true
- type: textarea
id: expected
attributes:
label: 预期行为
validations:
required: true
- type: textarea
id: actual
attributes:
label: 实际行为、退出码与脱敏日志
validations:
required: true
- type: textarea
id: verification
attributes:
label: 已尝试的验证
description: 例如 validate、dry-run、定向测试或真实实例验证。
- type: checkboxes
id: safety
attributes:
label: 安全确认
options:
- label: 我已删除密码、令牌、完整生产连接串和业务数据
required: true
8 changes: 8 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
blank_issues_enabled: false
contact_links:
- name: 使用文档
url: https://github.com/zzxCoding/Flydb/blob/main/SUPPORT.md
about: 提问前先查看快速开始、数据库指南、命令、配置和错误码参考。
- name: 私密安全报告
url: https://github.com/zzxCoding/Flydb/security/advisories/new
about: 漏洞或可能暴露凭据的问题请通过私密安全通道报告。
43 changes: 43 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: 功能建议
description: 提议一个有明确使用场景的 Flydb 改进
title: "[Feature] "
labels:
- enhancement
body:
- type: textarea
id: problem
attributes:
label: 要解决的问题
description: 描述用户、环境和当前受阻的工作流,不要只给出实现方案。
validations:
required: true
- type: textarea
id: outcome
attributes:
label: 期望结果
description: 说明成功后的可观察行为和安全边界。
validations:
required: true
- type: textarea
id: alternatives
attributes:
label: 当前替代方案
- type: dropdown
id: scope
attributes:
label: 主要影响范围
options:
- Core API / migration engine
- CLI
- Configuration
- Spring Boot Starter
- Database dialect / JDBC integration
- Documentation / Agent Skill
- Release / installation
validations:
required: true
- type: textarea
id: evidence
attributes:
label: 示例或验证方式
description: 可提供脱敏后的命令、配置、迁移结构或验收标准。
16 changes: 16 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
## 变更说明

说明为什么需要这项变更,以及它对用户或兼容性的影响。

## 验证

列出实际运行的命令、结果及未验证边界。

## 检查清单

- [ ] 变更范围聚焦,不包含无关文件或敏感信息
- [ ] 已补充或更新回归测试
- [ ] 已运行相关定向测试和 `./mvnw -B verify`
- [ ] 公共 API、CLI、配置或错误码变化已同步参考文档
- [ ] 数据库兼容性结论注明真实实例、模拟或契约测试层级
- [ ] Java 8/17 模块边界与 `flydb-core` 零运行时依赖保持不变
32 changes: 32 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Changelog

Flydb 的重要变更记录在本文件中。版本遵循语义化版本;正式发行包与发布说明见
[GitHub Releases](https://github.com/zzxCoding/Flydb/releases)。

## [0.2.0] - 2026-08-14

首个正式公开版本,提供可用于本地开发、CI 和应用启动阶段的 Schema 迁移运行时。

### 新增

- Java 8 零第三方运行时依赖的迁移内核,以及 Java 8 CLI。
- `migrate`、`info`、`validate`、`baseline`、`repair`、`undo`、`clean` 和 `version` 命令。
- MySQL、PostgreSQL、Oracle、达梦 DM8、KingbaseES、openGauss、OceanBase、TiDB 方言或兼容家族。
- Spring Boot 2.7 与 Spring Boot 3 starter。
- 递归迁移发现、精确/范围/版本族选择、目录版本、glob/regex 路径过滤。
- 外置 JDBC 驱动、Maven 私服解析、离线模式及 `DatabaseType` SPI。
- 发行包内置版本匹配的文档、`AGENTS.md` 与 `flydb-cli` Agent Skill。

### 安全与可靠性

- 并发迁移锁、DDL 事务差异、失败记录阻断与恢复。
- checksum 校验、`migrate`/`undo` dry-run、稳定退出码与错误码。
- `clean` 默认禁用并要求双重确认;密码支持环境变量和密码文件。

### 当前边界

- GitHub Release 提供 CLI ZIP;Maven Central 和包管理器分发尚未开放。
- Flydb 不自动把任意厂商 SQL 转换为其他数据库语法。
- 达梦、KingbaseES、openGauss 的公开证据为方言和驱动元数据契约测试,真实环境认证仍待补充。

[0.2.0]: https://github.com/zzxCoding/Flydb/releases/tag/v0.2.0
23 changes: 23 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# 社区行为准则

Flydb 社区希望所有参与者都能进行专业、友善且以事实为基础的协作。

## 我们鼓励

- 尊重不同经验、背景和观点;
- 围绕可复现行为、代码和证据讨论问题;
- 接受建设性反馈,并清楚说明假设与验证边界;
- 在发现错误时帮助修正,而不是攻击个人。

## 不可接受的行为

- 骚扰、歧视、威胁、侮辱或人身攻击;
- 未经允许公开他人的私人信息;
- 故意发布凭据、生产数据、恶意代码或误导性兼容结论;
- 持续扰乱 Issue、PR 或其他社区讨论。

## 执行

维护者可以编辑、隐藏或删除违反本准则的内容,并限制相关参与者继续互动。平台滥用或紧急人身安全问题请同时使用 GitHub 的举报渠道;安全漏洞请按[安全策略](./SECURITY.md)私下报告。

本准则适用于仓库的 Issue、Pull Request、Discussion、代码评审和其他官方协作空间。
49 changes: 49 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# 贡献 Flydb

感谢你帮助改进 Flydb。本指南面向准备提交 Issue 或 Pull Request 的开发者;架构约束以
[设计总览](./docs/design/00-overview.md)及其链接的设计文档为准。

## 开始之前

- 搜索现有 [Issues](https://github.com/zzxCoding/Flydb/issues),避免重复问题。
- Bug 请提供 Flydb、Java、数据库和 JDBC 驱动版本,以及可复现的最小步骤。
- 不要提交密码、带凭据的 JDBC URL、生产数据、厂商 JDBC 驱动或其他受限制品。
- 安全漏洞不要公开建 Issue,请遵循[安全策略](./SECURITY.md)。

## 本地构建

完整 reactor 使用 JDK 17:

```bash
./mvnw -B verify
```

core、CLI、Boot 2 starter 和 Boot 2 示例必须保持 Java 8 字节码。涉及这些模块或发行边界时,额外运行:

```bash
./scripts/check-bytecode.sh 52 \
flydb-core/target/classes flydb-cli/target/classes \
flydb-spring-boot-2-starter/target/classes examples/boot2-demo/target/classes
./scripts/check-bytecode.sh 61 \
flydb-spring-boot-3-starter/target/classes examples/boot3-demo/target/classes
```

集成测试可能启动 Docker 数据库。达梦、KingbaseES、Oracle 等授权数据库只有在你拥有合法驱动和测试实例时才能运行;提交中不得重新分发驱动。

## 修改约束

- 优先在公共边界补回归测试,再修改实现。
- `flydb-core` 不得增加非 `test` 作用域依赖。
- 公共 API、CLI、配置键、错误码、驱动加载或数据库支持范围发生变化时,同步更新测试和 `docs/reference`。
- 设计契约与实现冲突时,在 PR 中说明冲突和处理方式,不要静默偏离。
- 数据库兼容性结论必须写清验证层级;单元测试或兼容家族测试不等于厂商认证。

## 提交 Pull Request

1. 从最新 `main` 创建聚焦单一目标的分支。
2. 提交前运行相关定向测试和完整 `./mvnw -B verify`。
3. 运行 `git diff --check`,确认没有意外文件或凭据。
4. 在 PR 中说明变更原因、行为影响、验证命令和未验证边界。
5. 若改变用户可见行为,同步更新中英文 README 或相应参考文档。

提交贡献即表示你同意按仓库的 [Apache License 2.0](./LICENSE) 提供该贡献。
18 changes: 12 additions & 6 deletions README.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@ English | [中文](./README.md)
# Flydb

[![CI](https://github.com/zzxCoding/Flydb/actions/workflows/ci.yml/badge.svg)](https://github.com/zzxCoding/Flydb/actions/workflows/ci.yml)
[![Release](https://img.shields.io/github/v/release/zzxCoding/Flydb)](https://github.com/zzxCoding/Flydb/releases/latest)
[![License: Apache-2.0](https://img.shields.io/badge/License-Apache--2.0-blue.svg)](./LICENSE)
![Java 8+](https://img.shields.io/badge/Java-8%2B-blue)

Flydb is a versioned schema migration tool for databases with JDBC drivers: built-in dialects for mainstream databases, first-class support for Chinese Xinchuang databases, and extension to niche JDBC databases through the `DatabaseType` SPI.

**Today**, Flydb 0.2 is a reliable migration runtime: commands such as `migrate`, `info`, `validate`, `baseline`, `repair`, `undo`, and `clean`, backed by concurrency locks, transaction semantics, checksum validation, and failure blocking with recovery; eight built-in dialects; and Spring Boot 2/3 starters. **The long-term direction** is a database change capability shared safely by humans and AI agents: agents decide *what* changes; Flydb guarantees *how* it changes safely. See the [roadmap](./ROADMAP.md) (in Chinese) for stage goals and current progress.

> **Scope boundary:** Flydb manages migration versions, execution safety, and database dialect behavior. It does not translate arbitrary vendor SQL into every database syntax. Keep separate migration directories for database families when their dialects differ; see the [multi-environment guide](./docs/getting-started/multi-environment.md#4-脚本仓库按数据库家族分目录).

## Why Flydb

- **Xinchuang databases as first-class citizens**: DM8 (Dameng), KingbaseES, openGauss, OceanBase, and TiDB ship as built-in dialects alongside MySQL, PostgreSQL, and Oracle. The CLI never bundles vendor drivers; it resolves them from `drivers/`, the runtime classpath, or a Maven repository, which fits drivers that cannot be distributed publicly.
Expand All @@ -26,8 +29,9 @@ Flydb is a versioned schema migration tool for databases with JDBC drivers: buil
Prerequisites: Java 8 or newer, an existing target database, and a Java 8-compatible JDBC driver.

```bash
unzip flydb-cli-0.2.0-SNAPSHOT.zip
cd flydb-cli-0.2.0-SNAPSHOT
curl -LO https://github.com/zzxCoding/Flydb/releases/download/v0.2.0/flydb-cli-0.2.0.zip
unzip flydb-cli-0.2.0.zip
cd flydb-cli-0.2.0

# Example: place mysql-connector-j.jar into drivers/
cp /path/to/mysql-connector-j.jar drivers/
Expand Down Expand Up @@ -65,7 +69,7 @@ See the [database getting-started guides](./docs/getting-started/README.md) for

## Roadmap

- [x] **Reliable migration runtime**: engine, 8 built-in dialects, CLI, Spring Boot starters, Agent Skill (current stage; official release remaining)
- [x] **Reliable migration runtime**: engine, 8 built-in dialects, CLI, Spring Boot starters, Agent Skill, and the `v0.2.0` GitHub Release
- [ ] **DX and machine contract**: release and install channels, `--json` machine-readable output, CI recipes
- [ ] **Agent distribution**: MCP adapter on top of a stable CLI contract
- [ ] **Brownfield change intelligence**: impact analysis, application reference scanning, coverage with explicit unknowns
Expand Down Expand Up @@ -108,10 +112,12 @@ Spring Boot applications pick the matching starter; it runs `migrate` during con
<dependency>
<groupId>com.flydb</groupId>
<artifactId>flydb-spring-boot-3-starter</artifactId>
<version>0.2.0-SNAPSHOT</version>
<version>0.2.0</version>
</dependency>
```

> The CLI is distributed through the [GitHub Release](https://github.com/zzxCoding/Flydb/releases/tag/v0.2.0). Maven Central publishing is not available yet; Java API and starter users currently build from source and install artifacts into a local or private Maven repository.

Java 8 applications use `flydb-spring-boot-2-starter` (Boot 2.7.18; [Spring states](https://spring.io/blog/2023/11/23/spring-boot-2-7-18-available-now/) that 2.7.18 is the last open-source release of the Boot 2.x line, so new projects should prefer the Boot 3 starter). The starter reuses the application's primary `DataSource` by default; set `flydb.url/user/password` to migrate with a separate DDL account, and `flydb.enabled=false` to disable auto-configuration entirely. Runnable examples: [Boot 2](./examples/boot2-demo), [Boot 3](./examples/boot3-demo); see the [Spring Boot starter design](./docs/design/07-spring-boot-starter.md).

## Names and configuration
Expand Down Expand Up @@ -150,7 +156,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.2.0-SNAPSHOT.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.2.0.zip`. The core module enforces an 80% JaCoCo line-coverage gate and zero non-test runtime dependencies via Maven Enforcer.

Local integration contracts default to MySQL 8 only; to run a specific CI dialect, set `-Pmysql`/`-Ppostgresql` and `-Dflydb.integration.database=<dialect>`. The full matrix runs in `.github/workflows/ci.yml`.

Expand All @@ -172,7 +178,7 @@ Local integration contracts default to MySQL 8 only; to run a specific CI dialec

## Contributing

Issues and PRs are welcome. Before submitting, run `./mvnw -B verify` so tests and coverage gates pass; changes touching CLI behavior, configuration keys, or error codes must update `docs/reference` accordingly, and the Skill references in `flydb-skills` should be re-checked. Start with the [design overview](./docs/design/00-overview.md) for architecture and design documents.
Issues and PRs are welcome. See the [contributing guide](./CONTRIBUTING.md) for the full workflow, and run `./mvnw -B verify` before submitting. Report vulnerabilities privately through the process in the [security policy](./SECURITY.md), not in a public issue. Start with the [design overview](./docs/design/00-overview.md) for architecture and design documents.

## License

Expand Down
Loading
Loading