formatAlterTable formats ALTER TABLE statements
(stmt *ast.AlterTableStatement)
| 438 | |
| 439 | // formatAlterTable formats ALTER TABLE statements |
| 440 | func (f *SQLFormatter) formatAlterTable(stmt *ast.AlterTableStatement) error { //nolint:staticcheck // AlterTableStatement kept for backward compatibility |
| 441 | f.writeKeyword("ALTER TABLE") |
| 442 | f.builder.WriteString(" " + stmt.Table) |
| 443 | |
| 444 | for i, action := range stmt.Actions { |
| 445 | action := action // G601: Create local copy to avoid memory aliasing |
| 446 | if i > 0 { |
| 447 | f.builder.WriteString(",") |
| 448 | } |
| 449 | f.writeNewline() |
| 450 | f.increaseIndent() |
| 451 | f.builder.WriteString(f.currentIndent()) |
| 452 | f.formatAlterTableAction(&action) |
| 453 | f.decreaseIndent() |
| 454 | } |
| 455 | |
| 456 | return nil |
| 457 | } |
| 458 | |
| 459 | // formatAlterStatement formats the generic ALTER statement (from alter.go) |
| 460 | func (f *SQLFormatter) formatAlterStatement(stmt *ast.AlterStatement) error { |
no test coverage detected