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
214 changes: 152 additions & 62 deletions src/ci.rs

Large diffs are not rendered by default.

35 changes: 35 additions & 0 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,18 @@ pub struct Cli {
/// Show explanation for each migration statement
#[arg(long)]
pub explain: bool,

/// Disable transaction wrapping (BEGIN/COMMIT) around migration SQL
#[arg(long)]
pub no_transaction: bool,

/// Use CREATE INDEX CONCURRENTLY for non-blocking index creation (PostgreSQL only, implies --no-transaction)
#[arg(long)]
pub concurrently: bool,

/// Detect column/table renames instead of DROP+ADD (experimental)
#[arg(long)]
pub detect_renames: bool,
}

/// Color output mode.
Expand Down Expand Up @@ -202,6 +214,18 @@ pub struct DiffArgs {
/// Show explanation for each migration statement
#[arg(long)]
pub explain: bool,

/// Disable transaction wrapping (BEGIN/COMMIT) around migration SQL
#[arg(long)]
pub no_transaction: bool,

/// Use CREATE INDEX CONCURRENTLY for non-blocking index creation (PostgreSQL only, implies --no-transaction)
#[arg(long)]
pub concurrently: bool,

/// Detect column/table renames instead of DROP+ADD (experimental)
#[arg(long)]
pub detect_renames: bool,
}

/// Migration direction for output.
Expand Down Expand Up @@ -279,6 +303,9 @@ pub struct DiffParams {
pub color: ColorMode,
pub explain: bool,
pub fail_on_blocking: bool,
pub transaction: bool,
pub concurrently: bool,
pub detect_renames: bool,
}

impl Cli {
Expand Down Expand Up @@ -307,6 +334,7 @@ impl Cli {
} else {
false
};
let transaction = !self.no_transaction && !self.concurrently;
ResolvedCommand::Diff(DiffParams {
source,
target_source,
Expand All @@ -321,6 +349,9 @@ impl Cli {
color: self.color,
explain: self.explain,
fail_on_blocking: self.fail_on_blocking,
transaction,
concurrently: self.concurrently,
detect_renames: self.detect_renames,
})
}
}
Expand Down Expand Up @@ -348,6 +379,7 @@ impl DiffArgs {
false
};

let transaction = !self.no_transaction && !self.concurrently;
DiffParams {
source: self.source,
target_source,
Expand All @@ -362,6 +394,9 @@ impl DiffArgs {
color: self.color,
explain: self.explain,
fail_on_blocking: self.fail_on_blocking,
transaction,
concurrently: self.concurrently,
detect_renames: self.detect_renames,
}
}
}
Expand Down
Loading