Split migrations in to two statements

This commit is contained in:
Till Faelligen 2022-02-21 16:43:28 +01:00
parent c2b6019c35
commit dac29c1786
2 changed files with 11 additions and 4 deletions

View file

@ -12,11 +12,15 @@ func LoadAddPolicyVersion(m *sqlutil.Migrations) {
}
func UpAddPolicyVersion(tx *sql.Tx) error {
_, err := tx.Exec("ALTER TABLE account_accounts ADD COLUMN IF NOT EXISTS policy_version TEXT;" +
"ALTER TABLE account_accounts ADD COLUMN IF NOT EXISTS policy_version_sent TEXT;")
_, err := tx.Exec("ALTER TABLE account_accounts ADD COLUMN IF NOT EXISTS policy_version TEXT;")
if err != nil {
return fmt.Errorf("failed to execute upgrade: %w", err)
}
_, err = tx.Exec("ALTER TABLE account_accounts ADD COLUMN IF NOT EXISTS policy_version_sent TEXT;")
if err != nil {
return fmt.Errorf("failed to execute upgrade: %w", err)
}
return nil
}

View file

@ -12,8 +12,11 @@ func LoadAddPolicyVersion(m *sqlutil.Migrations) {
}
func UpAddPolicyVersion(tx *sql.Tx) error {
_, err := tx.Exec("ALTER TABLE account_accounts ADD COLUMN policy_version TEXT;" +
"ALTER TABLE account_accounts ADD COLUMN policy_version_sent TEXT;")
_, err := tx.Exec("ALTER TABLE account_accounts ADD COLUMN policy_version TEXT;")
if err != nil {
return fmt.Errorf("failed to execute upgrade: %w", err)
}
_, err = tx.Exec("ALTER TABLE account_accounts ADD COLUMN policy_version_sent TEXT;")
if err != nil {
return fmt.Errorf("failed to execute upgrade: %w", err)
}