Prefix table with iam_

Signed-off-by: Bryan Frimin <bryan@getprobo.com>
This commit is contained in:
Bryan Frimin
2025-12-20 14:29:29 +01:00
parent 0f7c755d53
commit c2a5197459
12 changed files with 113 additions and 107 deletions

View File

@@ -38,7 +38,7 @@ func (s *SAMLAssertion) Insert(
conn pg.Conn,
) error {
query := `
INSERT INTO auth_saml_assertions (id, organization_id, used_at, expires_at)
INSERT INTO iam_saml_assertions (id, organization_id, used_at, expires_at)
VALUES (@id, @organization_id, @used_at, @expires_at)
`
@@ -52,7 +52,7 @@ VALUES (@id, @organization_id, @used_at, @expires_at)
_, err := conn.Exec(ctx, query, args)
if err != nil {
var pgErr *pgconn.PgError
if errors.As(err, &pgErr) && pgErr.Code == "23505" && pgErr.ConstraintName == "auth_saml_assertions_pkey" {
if errors.As(err, &pgErr) && pgErr.Code == "23505" && pgErr.ConstraintName == "iam_saml_assertions_pkey" {
return ErrResourceAlreadyExists
}
@@ -64,7 +64,7 @@ VALUES (@id, @organization_id, @used_at, @expires_at)
func DeleteExpiredSAMLAssertions(ctx context.Context, conn pg.Conn, now time.Time) (int64, error) {
query := `
DELETE FROM auth_saml_assertions
DELETE FROM iam_saml_assertions
WHERE expires_at < @now
`