bd sync: 2025-12-27 15:56:42

This commit is contained in:
Steve Yegge
2025-12-27 15:56:42 -08:00
parent 87f535a65e
commit c8b912cbe6
179 changed files with 3051 additions and 10283 deletions

View File

@@ -1,34 +0,0 @@
package migrations
import (
"database/sql"
"fmt"
)
// MigrateCreatedByColumn adds the created_by column to the issues table.
// This tracks who created the issue, using the same actor chain as comment authors
// (--actor flag, BD_ACTOR env, or $USER). GH#748.
func MigrateCreatedByColumn(db *sql.DB) error {
// Check if column already exists
var columnExists bool
err := db.QueryRow(`
SELECT COUNT(*) > 0
FROM pragma_table_info('issues')
WHERE name = 'created_by'
`).Scan(&columnExists)
if err != nil {
return fmt.Errorf("failed to check created_by column: %w", err)
}
if columnExists {
return nil
}
// Add the created_by column
_, err = db.Exec(`ALTER TABLE issues ADD COLUMN created_by TEXT DEFAULT ''`)
if err != nil {
return fmt.Errorf("failed to add created_by column: %w", err)
}
return nil
}