Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore: add row status definition (#6844)

boojack55753369510f
diff --git a/backend/store/common.go b/backend/store/common.go
new file mode 100644
index 0000000000..6ca4c3eb8c
--- /dev/null
+++ b/backend/store/common.go
@@ -0,0 +1,11 @@
+package store
+
+// RowStatus is the status for a row.
+type RowStatus string
+
+const (
+ // Normal is the status for a normal row.
+ Normal RowStatus = "NORMAL"
+ // Archived is the status for an archived row.
+ Archived RowStatus = "ARCHIVED"
+)
diff --git a/backend/store/idp.go b/backend/store/idp.go
index 4b072bfbc6..1222c4463c 100644
--- a/backend/store/idp.go
+++ b/backend/store/idp.go
@@ -10,7 +10,6 @@ import (
"google.golang.org/protobuf/encoding/protojson"
"github.com/bytebase/bytebase/backend/common"
- api "github.com/bytebase/bytebase/backend/legacyapi"
storepb "github.com/bytebase/bytebase/proto/generated-go/store"
)
@@ -202,11 +201,11 @@ func (*Store) updateIdentityProviderImpl(ctx context.Context, tx *Tx, patch *Upd
set, args = append(set, fmt.Sprintf("config = $%d", len(args)+1)), append(args, string(configBytes))
}
if v := patch.Delete; v != nil {
- rowStatus := api.Normal
+ rowStatus := Normal
if *patch.Delete {
- rowStatus = api.Archived
+ rowStatus = Archived
}
- set, args = append(set, fmt.Sprintf(`"row_status" = $%d`, len(args)+1)), append(args, rowStatus)
+ set, args = append(set, fmt.Sprintf("row_status = $%d", len(args)+1)), append(args, rowStatus)
}
args = append(args, patch.ResourceID)
@@ -258,7 +257,7 @@ func (*Store) listIdentityProvidersImpl(ctx context.Context, tx *Tx, find *FindI
where, args = append(where, fmt.Sprintf("id = $%d", len(args)+1)), append(args, *v)
}
if !find.ShowDeleted {
- where, args = append(where, fmt.Sprintf("row_status = $%d", len(args)+1)), append(args, api.Normal)
+ where, args = append(where, fmt.Sprintf("row_status = $%d", len(args)+1)), append(args, Normal)
}
rows, err := tx.QueryContext(ctx, `