Skip to content

Commit a27cd58

Browse files
Copilotdanielsiegl
andauthored
Fix schema-output flag to only output data to stdout (#112)
* Initial plan * Fix schema-output flag to only output data to stdout Co-authored-by: danielsiegl <41949368+danielsiegl@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: danielsiegl <41949368+danielsiegl@users.noreply.github.com>
1 parent bd1a0e4 commit a27cd58

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

internal/filters/clean.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,9 @@ func Clean(ctx context.Context, eng *sqlite.Engine, in io.Reader, out io.Writer,
6868

6969
// Use the new selective dumping method that excludes sqlite_sequence natively
7070
// This now uses the logical filtering function from the filters package
71-
if err := DumpTables(dumpCtx, eng, tmp.Name(), out, floatPrecision, dataOnly); err != nil {
71+
// When schema is saved to a separate file, only output data to stdout
72+
outputDataOnly := dataOnly || (schemaOutput != "")
73+
if err := DumpTables(dumpCtx, eng, tmp.Name(), out, floatPrecision, outputDataOnly); err != nil {
7274
slog.Error("SQLite selective dump failed", "error", err)
7375
return err
7476
}

internal/filters/diff.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ func Diff(ctx context.Context, eng *sqlite.Engine, dbFile string, out io.Writer,
3535
}
3636

3737
// For data output, use DumpTables with filtering
38-
if err := DumpTables(ctx, eng, dbFile, out, 9, dataOnly); err != nil {
38+
// When schema is saved to a separate file, only output data to stdout
39+
outputDataOnly := dataOnly || (schemaOutput != "")
40+
if err := DumpTables(ctx, eng, dbFile, out, 9, outputDataOnly); err != nil {
3941
slog.Error("Diff dump failed", "error", err)
4042
return err
4143
}

0 commit comments

Comments
 (0)