diff --git a/pkg/coredata/access_entry.go b/pkg/coredata/access_entry.go index df888911f..8f5315953 100644 --- a/pkg/coredata/access_entry.go +++ b/pkg/coredata/access_entry.go @@ -228,7 +228,7 @@ VALUES ( @mfa_status, @auth_method, @account_type, - @active, + COALESCE(@active, TRUE), @last_login, @account_created_at, @external_id, @@ -665,7 +665,7 @@ INSERT INTO access_entries ( @mfa_status, @auth_method, @account_type, - @active, + COALESCE(@active, TRUE), @last_login, @account_created_at, @external_id, diff --git a/pkg/coredata/access_entry_upsert_test.go b/pkg/coredata/access_entry_upsert_test.go index 788e4b5fe..5d7ed2c77 100644 --- a/pkg/coredata/access_entry_upsert_test.go +++ b/pkg/coredata/access_entry_upsert_test.go @@ -441,6 +441,7 @@ func TestAccessEntry_Upsert_InsertsActiveAccount(t *testing.T) { tenantID := fx.scope.GetTenantID() t0 := time.Now().UTC().Truncate(time.Microsecond) + activeTrue := true entryID := gid.New(tenantID, coredata.AccessEntryEntityType) entry := &coredata.AccessEntry{ ID: entryID, @@ -453,7 +454,7 @@ func TestAccessEntry_Upsert_InsertsActiveAccount(t *testing.T) { MFAStatus: coredata.MFAStatusUnknown, AuthMethod: coredata.AccessEntryAuthMethodUnknown, AccountType: coredata.AccessEntryAccountTypeUser, - Active: new(true), + Active: &activeTrue, ExternalID: "ext-active", AccountKey: fx.accountKey, IncrementalTag: coredata.AccessEntryIncrementalTagNew, diff --git a/pkg/coredata/migrations/20260611T000000Z.sql b/pkg/coredata/migrations/20260611T000000Z.sql index 9352941c6..bbb52985a 100644 --- a/pkg/coredata/migrations/20260611T000000Z.sql +++ b/pkg/coredata/migrations/20260611T000000Z.sql @@ -13,4 +13,4 @@ -- PERFORMANCE OF THIS SOFTWARE. ALTER TABLE access_entries - ADD COLUMN active BOOLEAN; + ADD COLUMN active BOOLEAN NOT NULL DEFAULT TRUE;