fix: revert migration V1.13 (#1466)

* fix: revert migration V1.13

* fix: set project changes correctly in application view model (#1469)

* fix: import user, hide login name suffix (#1474)

* fix: import user, and label policy command side

* feat: Import user and hide loginname suffix (#1464)

* fix: import user

* fix: label policy

* fix: label policy

* fix: label policy

* fix: migrations

* fix: migrations

* fix: migrations

* fix: label policy

* loginSuffix in login ui

* suffix

* fix cursor on disabled user selection

Co-authored-by: Livio Amstutz <livio.a@gmail.com>

(cherry picked from commit 03ddb8fc38)

* feat: Import user and hide loginname suffix (#1464)

* fix: import user

* fix: label policy

* fix: label policy

* fix: label policy

* fix: migrations

* fix: migrations

* fix: migrations

* fix: label policy

* loginSuffix in login ui

* suffix

* fix cursor on disabled user selection

Co-authored-by: Livio Amstutz <livio.a@gmail.com>

(cherry picked from commit 03ddb8fc38)

* feat: Import user and hide loginname suffix (#1464)

* fix: import user

* fix: label policy

* fix: label policy

* fix: label policy

* fix: migrations

* fix: migrations

* fix: migrations

* fix: label policy

* loginSuffix in login ui

* suffix

* fix cursor on disabled user selection

Co-authored-by: Livio Amstutz <livio.a@gmail.com>

(cherry picked from commit 03ddb8fc38)

* fix: label policy events

* loginname placeholder

* fix: tests

* fix: tests

* Update internal/command/iam_policy_label_model.go

Co-authored-by: Livio Amstutz <livio.a@gmail.com>

Co-authored-by: Livio Amstutz <livio.a@gmail.com>

* fix: console eventstore (#1476)

* fix org switch

* user grants

* fix project grants, user grant update

* fix idp removal, prettier buttons, attribute names

* fix: operator reconciling (#1478)

* fix(operator): align backup and restore commands (#1465)

* fix: crd mode broke backup and restore commands

* fix: remove obscure gitops-per-operator flags

(cherry picked from commit 041cacc4af)

* fix: gitops backup and restore need a kubernetes client too (#1475)

(cherry picked from commit 50bc317d27)

Co-authored-by: Elio Bischof <eliobischof@gmail.com>

* feat: features (#1427)

* features

* features

* features

* fix json tags

* add features handler to auth

* mocks for tests

* add setup step

* fixes

* add featurelist to auth api

* grandfather state and typos

* typo

* merge new-eventstore

* fix login policy tests

* label policy in features

* audit log retention

* fix: new es bug fixes (#1477)

* fix: displayname on members

* fix: user grant update

* fix: user grant id

* console grantid

Co-authored-by: Max Peintner <max@caos.ch>

* fix: backend (#1481)

* fix: check ids in proto

* fix sign out

* improve displayed login name after user selection

* fix init user in login

* fix init password in login

Co-authored-by: fabi <fabienne.gerschwiler@gmail.com>

* feat: console feature api (#1480)

* fix: changes (#1482)

* fix: changes

* change listquery to changequery

* fix: changes in auth

Co-authored-by: Max Peintner <max@caos.ch>

* test without transaction

* test without transaction

Co-authored-by: Livio Amstutz <livio.a@gmail.com>
Co-authored-by: Fabi <38692350+fgerschwiler@users.noreply.github.com>
Co-authored-by: Max Peintner <max@caos.ch>
Co-authored-by: fabi <fabienne.gerschwiler@gmail.com>
This commit is contained in:
Elio Bischof 2021-03-29 13:38:04 +02:00 committed by GitHub
parent 48456b84b9
commit 51a76150ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 2 additions and 53 deletions

View File

@ -10,7 +10,6 @@ import (
"strconv" "strconv"
"strings" "strings"
"testing" "testing"
"time"
"github.com/caos/logging" "github.com/caos/logging"
"github.com/cockroachdb/cockroach-go/v2/testserver" "github.com/cockroachdb/cockroach-go/v2/testserver"
@ -62,27 +61,9 @@ func executeMigrations() error {
return err return err
} }
migration := os.ExpandEnv(string(migrationData)) migration := os.ExpandEnv(string(migrationData))
transactionInMigration := strings.Contains(migration, "BEGIN;") if _, err = testCRDBClient.Exec(migration); err != nil {
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 {
return fmt.Errorf("exec file: %v || err: %w", file, err) 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 return nil
} }

View File

@ -10,7 +10,6 @@ import (
"strconv" "strconv"
"strings" "strings"
"testing" "testing"
"time"
"github.com/caos/logging" "github.com/caos/logging"
"github.com/cockroachdb/cockroach-go/v2/testserver" "github.com/cockroachdb/cockroach-go/v2/testserver"
@ -66,27 +65,9 @@ func executeMigrations() error {
return err return err
} }
migration := os.ExpandEnv(string(migrationData)) migration := os.ExpandEnv(string(migrationData))
transactionInMigration := strings.Contains(migration, "BEGIN;") if _, err = testCRDBClient.Exec(migration); err != nil {
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 {
return fmt.Errorf("exec file: %v || err: %w", file, err) 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 return nil
} }

View File

@ -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; ALTER TABLE management.machine_keys DROP COLUMN IF EXISTS public_key;
COMMIT;
BEGIN;
ALTER TABLE management.machine_keys ADD COLUMN public_key BYTES; ALTER TABLE management.machine_keys ADD COLUMN public_key BYTES;
COMMIT;
BEGIN;
ALTER TABLE auth.machine_keys DROP COLUMN IF EXISTS public_key; ALTER TABLE auth.machine_keys DROP COLUMN IF EXISTS public_key;
COMMIT;
BEGIN;
ALTER TABLE auth.machine_keys ADD COLUMN public_key BYTES; ALTER TABLE auth.machine_keys ADD COLUMN public_key BYTES;
COMMIT;