DB migration: Add require_all column to installers labels tables (#41279)

This commit is contained in:
Martin Angers 2026-03-10 08:22:24 -04:00 committed by GitHub
parent 6527ab7145
commit f8fa379732
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 54 additions and 5 deletions

View file

@ -0,0 +1,33 @@
package tables
import (
"database/sql"
"fmt"
)
func init() {
MigrationClient.AddMigration(Up_20260309182329, Down_20260309182329)
}
func Up_20260309182329(tx *sql.Tx) error {
_, err := tx.Exec(`ALTER TABLE in_house_app_labels ADD COLUMN require_all BOOL NOT NULL DEFAULT false`)
if err != nil {
return fmt.Errorf("failed to add require_all to in_house_app_labels: %w", err)
}
_, err = tx.Exec(`ALTER TABLE software_installer_labels ADD COLUMN require_all BOOL NOT NULL DEFAULT false`)
if err != nil {
return fmt.Errorf("failed to add require_all to software_installer_labels: %w", err)
}
_, err = tx.Exec(`ALTER TABLE vpp_app_team_labels ADD COLUMN require_all BOOL NOT NULL DEFAULT false`)
if err != nil {
return fmt.Errorf("failed to add require_all to vpp_app_team_labels: %w", err)
}
return nil
}
func Down_20260309182329(tx *sql.Tx) error {
return nil
}

View file

@ -0,0 +1,13 @@
package tables
import "testing"
func TestUp_20260309182329(t *testing.T) {
db := applyUpToPrev(t)
// Just a new column, so no logic to test here.
// Leaving it in because it's nice to validate that the migration applies successfully.
// Apply current migration.
applyNext(t, db)
}

File diff suppressed because one or more lines are too long