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
1 change: 1 addition & 0 deletions .github/workflows/audit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ on:

permissions:
contents: read
checks: write

jobs:
audit:
Expand Down
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/).

## [Unreleased]

## [0.2.2] - 2026-10-24

### Fixed

- Update ctutils to 0.4.4 and Tokio to 1.53.3 for RustSec fixes.
- Honor the configured CI report format and explicit CLI color mode.
- Enable CI exit codes in safe-migrate while preserving plan-only behavior.
- Keep database credentials out of command hints.
- Reject simultaneous TARGET and --schema inputs.
- Create config files atomically without overwriting existing paths or following dangling symlinks.

## [0.2.0] - 2026-04-06

### Added
Expand Down
10 changes: 5 additions & 5 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "dbdiff"
version = "0.2.1"
version = "0.2.2"
edition = "2021"
rust-version = "1.88"
authors = ["rekurt"]
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ jobs:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@stable
- name: Install dbdiff
run: cargo install --git https://github.com/rekurt/dbdiff --tag v0.2.1 --locked
run: cargo install --git https://github.com/rekurt/dbdiff --tag v0.2.2 --locked
- name: Compare schemas
run: dbdiff current.sql desired.sql --ci --format json > drift-report.json
- name: Upload report
Expand Down
2 changes: 1 addition & 1 deletion doc/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ dbdiff current.sql desired.sql --config custom.yml

`dbdiff init` creates `.dbdiff.yml` only if the path does not exist. Existing files and symbolic links, including dangling links, are never overwritten.

By default, dbdiff reads `.dbdiff.yml` in the working directory. A missing file uses defaults. A present but invalid file returns an error. CLI format options override configured output format.
By default, dbdiff reads `.dbdiff.yml` in the working directory. A missing file uses defaults. A present but invalid file returns an error. CLI format options override configured output format, including `output.format: ci`. Explicit `--color always` and `--color never` override the config; `auto` keeps terminal detection and honors `output.color: false`.

```yaml
ignore:
Expand Down
1 change: 1 addition & 0 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,7 @@ impl DiffParams {
"json" => OutputFormat::Json,
"yaml" => OutputFormat::Yaml,
"sql" => OutputFormat::Sql,
"ci" => OutputFormat::Ci,
_ => OutputFormat::Pretty,
}
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/commands/diff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ pub async fn run_diff(params: DiffParams) -> Result<(), ExitCode> {
left.schema.sequences.clear();
}

if let Some(false) = cfg.output.color {
if matches!(params.color, dbdiff::cli::ColorMode::Auto) && cfg.output.color == Some(false) {
colored::control::set_override(false);
}

Expand Down
2 changes: 1 addition & 1 deletion src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ pub struct IgnoreConfig {
#[derive(Debug, Clone, Default, Deserialize)]
#[serde(default)]
pub struct OutputConfig {
/// Output format: `pretty`, `json`, or `sql`.
/// Output format: `pretty`, `json`, `yaml`, `ci`, or `sql`.
pub format: Option<String>,
/// Whether to use colored output.
pub color: Option<bool>,
Expand Down
57 changes: 57 additions & 0 deletions tests/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,60 @@ fn missing_config_file_uses_defaults() {
.success()
.stdout(predicate::str::contains("audit_log"));
}

#[test]
fn config_ci_format_and_cli_override() {
let dir = tempfile::tempdir().unwrap();
let config = dir.path().join("config.yml");
std::fs::write(&config, "output:\n format: ci\n").unwrap();
for override_format in [false, true] {
let mut command = cmd();
command
.args([
"tests/fixtures/schema_a.sql",
"tests/fixtures/schema_b.sql",
"--config",
])
.arg(&config);
if override_format {
command.args(["--format", "json"]);
let output = command.assert().success().get_output().stdout.clone();
assert!(serde_json::from_slice::<serde_json::Value>(&output).is_ok());
} else {
command
.assert()
.success()
.stdout(predicate::str::contains("CI summary:"));
}
}
}

#[test]
fn explicit_color_mode_overrides_config() {
let dir = tempfile::tempdir().unwrap();
let config = dir.path().join("config.yml");
for configured in [false, true] {
std::fs::write(&config, format!("output:\n color: {configured}\n")).unwrap();
for mode in ["always", "never", "auto"] {
let output = cmd()
.args([
"tests/fixtures/schema_a.sql",
"tests/fixtures/schema_b.sql",
"--color",
mode,
"--config",
])
.arg(&config)
.assert()
.success()
.get_output()
.stdout
.clone();
assert_eq!(
String::from_utf8(output).unwrap().contains("\x1b["),
mode == "always",
"config={configured}, mode={mode}"
);
}
}
}
Loading