diff --git a/internal/eventstore/local_crdb_test.go b/internal/eventstore/local_crdb_test.go index 15997e52cd..fe8ffedfaa 100644 --- a/internal/eventstore/local_crdb_test.go +++ b/internal/eventstore/local_crdb_test.go @@ -10,7 +10,6 @@ import ( "strconv" "strings" "testing" - "time" "github.com/caos/logging" "github.com/cockroachdb/cockroach-go/v2/testserver" @@ -62,27 +61,9 @@ func executeMigrations() error { return err } migration := os.ExpandEnv(string(migrationData)) - transactionInMigration := strings.Contains(migration, "BEGIN;") - exec := testCRDBClient.Exec - var tx *sql.Tx - if !transactionInMigration { - tx, err = testCRDBClient.Begin() - if err != nil { - return fmt.Errorf("begin file: %v || err: %w", file, err) - } - exec = tx.Exec - } - if _, err = exec(migration); err != nil { + if _, err = testCRDBClient.Exec(migration); err != nil { return fmt.Errorf("exec file: %v || err: %w", file, err) } - duration := 1 * time.Second - if !transactionInMigration { - if err = tx.Commit(); err != nil { - return fmt.Errorf("commit file: %v || err: %w", file, err) - } - duration = 0 - } - time.Sleep(duration) } return nil } diff --git a/internal/eventstore/repository/sql/local_crdb_test.go b/internal/eventstore/repository/sql/local_crdb_test.go index e88e189008..e67c314c4a 100644 --- a/internal/eventstore/repository/sql/local_crdb_test.go +++ b/internal/eventstore/repository/sql/local_crdb_test.go @@ -10,7 +10,6 @@ import ( "strconv" "strings" "testing" - "time" "github.com/caos/logging" "github.com/cockroachdb/cockroach-go/v2/testserver" @@ -66,27 +65,9 @@ func executeMigrations() error { return err } migration := os.ExpandEnv(string(migrationData)) - transactionInMigration := strings.Contains(migration, "BEGIN;") - exec := testCRDBClient.Exec - var tx *sql.Tx - if !transactionInMigration { - tx, err = testCRDBClient.Begin() - if err != nil { - return fmt.Errorf("begin file: %v || err: %w", file, err) - } - exec = tx.Exec - } - if _, err = exec(migration); err != nil { + if _, err = testCRDBClient.Exec(migration); err != nil { return fmt.Errorf("exec file: %v || err: %w", file, err) } - duration := 1 * time.Second - if !transactionInMigration { - if err = tx.Commit(); err != nil { - return fmt.Errorf("commit file: %v || err: %w", file, err) - } - duration = 0 - } - time.Sleep(duration) } return nil } diff --git a/migrations/cockroach/V1.13__machine_keys_public.sql b/migrations/cockroach/V1.13__machine_keys_public.sql index 605ad1723e..45f622bc92 100644 --- a/migrations/cockroach/V1.13__machine_keys_public.sql +++ b/migrations/cockroach/V1.13__machine_keys_public.sql @@ -1,18 +1,5 @@ --- table manipulations need to be in seperate transactions --- (see: https://github.com/cockroachdb/cockroach/issues/13380#issuecomment-306560448) - -BEGIN; ALTER TABLE management.machine_keys DROP COLUMN IF EXISTS public_key; -COMMIT; - -BEGIN; ALTER TABLE management.machine_keys ADD COLUMN public_key BYTES; -COMMIT; -BEGIN; ALTER TABLE auth.machine_keys DROP COLUMN IF EXISTS public_key; -COMMIT; - -BEGIN; ALTER TABLE auth.machine_keys ADD COLUMN public_key BYTES; -COMMIT; \ No newline at end of file