Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
chore: cleanup license code (#16494)
Danny Xu3cb58333531b
diff --git a/backend/api/v1/subscription_service.go b/backend/api/v1/subscription_service.goindex 693f08711a..0fd10dd7ef 100644--- a/backend/api/v1/subscription_service.go+++ b/backend/api/v1/subscription_service.go@@ -2,11 +2,9 @@ package v1import ("context"- "time""google.golang.org/grpc/codes""google.golang.org/grpc/status"- "google.golang.org/protobuf/types/known/timestamppb""github.com/bytebase/bytebase/backend/common""github.com/bytebase/bytebase/backend/component/config"@@ -41,43 +39,17 @@ func NewSubscriptionService(// GetSubscription gets the subscription.func (s *SubscriptionService) GetSubscription(ctx context.Context, _ *v1pb.GetSubscriptionRequest) (*v1pb.Subscription, error) {- return s.loadSubscription(ctx)+ return s.licenseService.LoadSubscription(ctx), nil}// UpdateSubscription updates the subscription license.func (s *SubscriptionService) UpdateSubscription(ctx context.Context, request *v1pb.UpdateSubscriptionRequest) (*v1pb.Subscription, error) {- principalID, ok := ctx.Value(common.PrincipalIDContextKey).(int)- if !ok {- return nil, status.Errorf(codes.Internal, "principal ID not found")- }- if err := s.licenseService.StoreLicense(ctx, &enterprise.SubscriptionPatch{- UpdaterID: principalID,- License: request.Patch.License,- }); err != nil {+ if err := s.licenseService.StoreLicense(ctx, request.Patch.License); err != nil {if common.ErrorCode(err) == common.Invalid {return nil, status.Error(codes.InvalidArgument, err.Error())}return nil, status.Errorf(codes.Internal, "failed to store license: %v", err.Error())}- return s.loadSubscription(ctx)-}--func (s *SubscriptionService) loadSubscription(ctx context.Context) (*v1pb.Subscription, error) {- sub := s.licenseService.LoadSubscription(ctx)-- subscription := &v1pb.Subscription{- SeatCount: int32(sub.Seat),- InstanceCount: int32(sub.InstanceCount),- Plan: sub.Plan,- Trialing: sub.Trialing,- OrgId: sub.OrgID,- OrgName: sub.OrgName,- }- if sub.Plan != v1pb.PlanType_FREE {- subscription.ExpiresTime = timestamppb.New(time.Unix(sub.ExpiresTS, 0))- subscription.StartedTime = timestamppb.New(time.Unix(sub.StartedTS, 0))- }-- return subscription, nil+ return s.licenseService.LoadSubscription(ctx), nil}diff --git a/backend/enterprise/README.md b/backend/enterprise/README.mddeleted file mode 100644index 1f34e96c4f..0000000000--- a/backend/enterprise/README.md+++ /dev/null@@ -1,3 +0,0 @@-# Bytebase enterprise--This directory contains Bytebase Enterprise code.diff --git a/backend/enterprise/api/license.go b/backend/enterprise/api/license.goindex 4cd575e0fc..bb70150c23 100644--- a/backend/enterprise/api/license.go+++ b/backend/enterprise/api/license.go@@ -3,67 +3,17 @@ package apiimport ("context"- "strings"- "time"-- "github.com/pkg/errors""github.com/bytebase/bytebase/backend/store"v1pb "github.com/bytebase/bytebase/proto/generated-go/v1")-// validPlans is a string array of valid plan types.-var validPlans = []v1pb.PlanType{- v1pb.PlanType_TEAM,- v1pb.PlanType_ENTERPRISE,-}--// License is the API message for enterprise license.-type License struct {- Subject string- InstanceCount int- Seat int- ExpiresTS int64- IssuedTS int64- Plan v1pb.PlanType- Trialing bool- OrgName string-}--// Valid will check if license expired or has correct plan type.-func (l *License) Valid() error {- if expireTime := time.Unix(l.ExpiresTS, 0); expireTime.Before(time.Now()) {- return errors.Errorf("license has expired at %v", expireTime)- }-- return l.validPlanType()-}--func (l *License) validPlanType() error {- for _, plan := range validPlans {- if plan == l.Plan {- return nil- }- }-- return errors.Errorf("plan %q is not valid, expect %s or %s",- l.Plan.String(),- v1pb.PlanType_TEAM.String(),- v1pb.PlanType_ENTERPRISE.String(),- )-}--// OrgID extract the organization id from license subject.-func (l *License) OrgID() string {- return strings.Split(l.Subject, ".")[0]-}-// LicenseService is the service for enterprise license.type LicenseService interface {// StoreLicense will store license into file.- StoreLicense(ctx context.Context, patch *SubscriptionPatch) error+ StoreLicense(ctx context.Context, license string) error// LoadSubscription will load subscription.- LoadSubscription(ctx context.Context) *Subscription+ LoadSubscription(ctx context.Context) *v1pb.Subscription// IsFeatureEnabled returns whether a feature is enabled.IsFeatureEnabled(feature v1pb.PlanFeature) error// IsFeatureEnabledForInstance returns whether a feature is enabled for the instance.diff --git a/backend/enterprise/api/subscription.go b/backend/enterprise/api/subscription.godeleted file mode 100644index 13feb9a137..0000000000--- a/backend/enterprise/api/subscription.go+++ /dev/null@@ -1,33 +0,0 @@-package api--import (- "time"-- v1pb "github.com/bytebase/bytebase/proto/generated-go/v1"-)--// SubscriptionPatch is the API message for update the subscription.-type SubscriptionPatch struct {- UpdaterID int- License string-}--// Subscription is the API message for subscription.-type Subscription struct {- InstanceCount int- Seat int- ExpiresTS int64- StartedTS int64- Plan v1pb.PlanType- Trialing bool- OrgID string- OrgName string-}--// IsExpired returns if the subscription is expired.-func (s *Subscription) IsExpired() bool {- if s.Plan == v1pb.PlanType_FREE || s.ExpiresTS < 0 {- return false- }- return time.Unix(s.ExpiresTS, 0).Before(time.Now())-}diff --git a/backend/enterprise/plugin/aws/aws.go b/backend/enterprise/plugin/aws/aws.goindex ac00bc90ac..3b12d00a50 100644--- a/backend/enterprise/plugin/aws/aws.go+++ b/backend/enterprise/plugin/aws/aws.go@@ -7,9 +7,9 @@ import ("time""github.com/pkg/errors"+ "google.golang.org/protobuf/types/known/timestamppb""github.com/bytebase/bytebase/backend/common/log"- enterprise "github.com/bytebase/bytebase/backend/enterprise/api""github.com/bytebase/bytebase/backend/enterprise/plugin"v1pb "github.com/bytebase/bytebase/proto/generated-go/v1"@@ -60,18 +60,17 @@ func NewProvider(_ *plugin.ProviderConfig) (plugin.LicenseProvider, error) {}// StoreLicense will store the aws license.-func (*Provider) StoreLicense(_ context.Context, _ *enterprise.SubscriptionPatch) error {+func (*Provider) StoreLicense(_ context.Context, _ string) error {return nil}// LoadSubscription will load the aws subscription.-func (p *Provider) LoadSubscription(ctx context.Context) *enterprise.Subscription {- subscription := &enterprise.Subscription{+func (p *Provider) LoadSubscription(ctx context.Context) *v1pb.Subscription {+ subscription := &v1pb.Subscription{InstanceCount: 0,- Seat: 0,+ SeatCount: 0,Plan: v1pb.PlanType_FREE,- OrgID: aws.ToString(p.identity.Account),- OrgName: aws.ToString(p.identity.Arn),+ OrgName: aws.ToString(p.identity.Account),}license, err := p.checkoutLicense(ctx)@@ -89,16 +88,6 @@ func (p *Provider) LoadSubscription(ctx context.Context) *enterprise.Subscriptiosubscription.Plan = v1pb.PlanType_ENTERPRISEif v := license.Validity; v != nil {- begin, err := time.Parse(time.RFC3339, aws.ToString(v.Begin))- if err != nil {- slog.Error("failed to parse subscription begin time",- slog.String("begin", *v.Begin),- log.BBError(err),- )- } else {- subscription.StartedTS = begin.UTC().Unix()- }-end, err := time.Parse(time.RFC3339, aws.ToString(v.End))if err != nil {slog.Error("failed to parse subscription end time",@@ -106,7 +95,7 @@ func (p *Provider) LoadSubscription(ctx context.Context) *enterprise.Subscriptiolog.BBError(err),)} else {- subscription.ExpiresTS = end.UTC().Unix()+ subscription.ExpiresTime = timestamppb.New(end.UTC())}}@@ -117,9 +106,9 @@ func (p *Provider) LoadSubscription(ctx context.Context) *enterprise.Subscriptio}switch *name {case "instance":- subscription.InstanceCount = int(aws.ToInt64(entitlement.MaxCount))+ subscription.InstanceCount = int32(aws.ToInt64(entitlement.MaxCount))case "seat":- subscription.Seat = int(aws.ToInt64(entitlement.MaxCount))+ subscription.SeatCount = int32(aws.ToInt64(entitlement.MaxCount))}}diff --git a/backend/enterprise/plugin/hub/hub.go b/backend/enterprise/plugin/hub/hub.goindex c01af9d436..d03ac850a6 100644--- a/backend/enterprise/plugin/hub/hub.go+++ b/backend/enterprise/plugin/hub/hub.go@@ -8,10 +8,10 @@ import ("github.com/golang-jwt/jwt/v5""github.com/pkg/errors"+ "google.golang.org/protobuf/types/known/timestamppb""github.com/bytebase/bytebase/backend/common""github.com/bytebase/bytebase/backend/common/log"- enterprise "github.com/bytebase/bytebase/backend/enterprise/api""github.com/bytebase/bytebase/backend/enterprise/config""github.com/bytebase/bytebase/backend/enterprise/plugin""github.com/bytebase/bytebase/backend/store"@@ -40,6 +40,26 @@ type claims struct {jwt.RegisteredClaims}+var validPlans = map[v1pb.PlanType]bool{+ v1pb.PlanType_TEAM: true,+ v1pb.PlanType_ENTERPRISE: true,+}++// validateSubscription validates if the subscription is expired or has correct plan type.+func validateSubscription(s *v1pb.Subscription) error {+ if !validPlans[s.Plan] {+ return errors.Errorf("plan %q is not valid, expect %s or %s",+ s.Plan.String(),+ v1pb.PlanType_TEAM.String(),+ v1pb.PlanType_ENTERPRISE.String(),+ )+ }+ if s.ExpiresTime != nil && s.ExpiresTime.AsTime().Before(time.Now()) {+ return errors.Errorf("license has expired at %v", s.ExpiresTime.AsTime())+ }+ return nil+}+// NewProvider will create a new hub license provider.func NewProvider(providerConfig *plugin.ProviderConfig) (plugin.LicenseProvider, error) {config, err := config.NewConfig(providerConfig.Mode)@@ -55,15 +75,15 @@ func NewProvider(providerConfig *plugin.ProviderConfig) (plugin.LicenseProvider,}// StoreLicense will store the hub license.-func (p *Provider) StoreLicense(ctx context.Context, patch *enterprise.SubscriptionPatch) error {- if patch.License != "" {- if _, err := p.parseLicense(ctx, patch.License); err != nil {+func (p *Provider) StoreLicense(ctx context.Context, license string) error {+ if license != "" {+ if _, err := p.parseLicense(ctx, license); err != nil {return err}}if _, err := p.store.UpsertSettingV2(ctx, &store.SetSettingMessage{Name: storepb.SettingName_ENTERPRISE_LICENSE,- Value: patch.License,+ Value: license,}); err != nil {return err}@@ -72,32 +92,23 @@ func (p *Provider) StoreLicense(ctx context.Context, patch *enterprise.Subscript}// LoadSubscription will load the hub subscription.-func (p *Provider) LoadSubscription(ctx context.Context) *enterprise.Subscription {+func (p *Provider) LoadSubscription(ctx context.Context) *v1pb.Subscription {license := p.loadLicense(ctx)if license == nil {- return &enterprise.Subscription{+ return &v1pb.Subscription{Plan: v1pb.PlanType_FREE,- // -1 means not expire, just for free plan- ExpiresTS: -1,+ // nil ExpiresTime means not expire, just for free plan+ ExpiresTime: nil,// Instance license count.InstanceCount: 0,- Seat: 0,+ SeatCount: 0,}}- return &enterprise.Subscription{- Plan: license.Plan,- ExpiresTS: license.ExpiresTS,- StartedTS: license.IssuedTS,- InstanceCount: license.InstanceCount,- Seat: license.Seat,- Trialing: license.Trialing,- OrgID: license.OrgID(),- OrgName: license.OrgName,- }+ return license}-func (p *Provider) fetchLicense(ctx context.Context) (*enterprise.License, error) {+func (p *Provider) fetchLicense(ctx context.Context) (*v1pb.Subscription, error) {license, err := p.remoteProvider.FetchLicense(ctx)if err != nil {return nil, err@@ -121,7 +132,7 @@ func (p *Provider) fetchLicense(ctx context.Context) (*enterprise.License, error}// loadLicense will load license and validate it.-func (p *Provider) loadLicense(ctx context.Context) *enterprise.License {+func (p *Provider) loadLicense(ctx context.Context) *v1pb.Subscription {license, err := p.findEnterpriseLicense(ctx)if err != nil {slog.Debug("failed to load enterprise license", log.BBError(err))@@ -136,7 +147,8 @@ func (p *Provider) loadLicense(ctx context.Context) *enterprise.License {if license == nil {return nil}- if err := license.Valid(); err != nil {++ if err := validateSubscription(license); err != nil {slog.Debug("license is invalid", log.BBError(err))return nil}@@ -144,7 +156,7 @@ func (p *Provider) loadLicense(ctx context.Context) *enterprise.License {return license}-func (p *Provider) parseLicense(ctx context.Context, license string) (*enterprise.License, error) {+func (p *Provider) parseLicense(ctx context.Context, license string) (*v1pb.Subscription, error) {claim := &claims{}if err := parseJWTToken(license, p.config.Version, p.config.PublicKey, claim); err != nil {return nil, common.Wrap(err, common.Invalid)@@ -153,7 +165,7 @@ func (p *Provider) parseLicense(ctx context.Context, license string) (*enterprisreturn p.parseClaims(ctx, claim)}-func (p *Provider) findEnterpriseLicense(ctx context.Context) (*enterprise.License, error) {+func (p *Provider) findEnterpriseLicense(ctx context.Context) (*v1pb.Subscription, error) {// Find enterprise license.setting, err := p.store.GetSettingV2(ctx, storepb.SettingName_ENTERPRISE_LICENSE)if err != nil {@@ -168,8 +180,8 @@ func (p *Provider) findEnterpriseLicense(ctx context.Context) (*enterprise.Licenslog.Debug("Load valid license",slog.String("plan", license.Plan.String()),- slog.Time("expiresAt", time.Unix(license.ExpiresTS, 0)),- slog.Int("instanceCount", license.InstanceCount),+ slog.Time("expiresAt", license.ExpiresTime.AsTime()),+ slog.Int("instanceCount", int(license.InstanceCount)),)return license, nil}@@ -179,7 +191,7 @@ func (p *Provider) findEnterpriseLicense(ctx context.Context) (*enterprise.Licen}// parseClaims will valid and parse JWT claims to license instance.-func (p *Provider) parseClaims(ctx context.Context, claim *claims) (*enterprise.License, error) {+func (p *Provider) parseClaims(ctx context.Context, claim *claims) (*v1pb.Subscription, error) {if p.config.Issuer != claim.Issuer {return nil, common.Errorf(common.Invalid, "iss is not valid, expect %s but found '%v'", p.config.Issuer, claim.Issuer)}@@ -187,10 +199,11 @@ func (p *Provider) parseClaims(ctx context.Context, claim *claims) (*enterprise.return nil, common.Errorf(common.Invalid, "aud is not valid, expect %s but found '%v'", p.config.Audience, claim.Audience)}- planType, err := convertPlanType(claim.Plan)- if err != nil {- return nil, common.Errorf(common.Invalid, "plan type %q is not valid", planType)+ v, ok := v1pb.PlanType_value[claim.Plan]+ if !ok {+ return nil, common.Errorf(common.Invalid, "plan type %q is not valid", claim.Plan)}+ planType := v1pb.PlanType(v)if claim.WorkspaceID != "" && planType == v1pb.PlanType_ENTERPRISE && !claim.Trialing {workspaceID, err := p.store.GetWorkspaceID(ctx)@@ -202,29 +215,19 @@ func (p *Provider) parseClaims(ctx context.Context, claim *claims) (*enterprise.}}- license := &enterprise.License{- InstanceCount: claim.InstanceCount,- Seat: claim.Seat,- ExpiresTS: claim.ExpiresAt.Unix(),- IssuedTS: claim.IssuedAt.Unix(),+ var expiresTime *timestamppb.Timestamp+ if claim.ExpiresAt != nil && !claim.ExpiresAt.IsZero() {+ expiresTime = timestamppb.New(claim.ExpiresAt.Time)+ }++ license := &v1pb.Subscription{+ InstanceCount: int32(claim.InstanceCount),+ SeatCount: int32(claim.Seat),+ ExpiresTime: expiresTime,Plan: planType,- Subject: claim.Subject,Trialing: claim.Trialing,OrgName: claim.OrgName,}return license, nil}--func convertPlanType(candidate string) (v1pb.PlanType, error) {- switch candidate {- case "TEAM":- return v1pb.PlanType_TEAM, nil- case "ENTERPRISE":- return v1pb.PlanType_ENTERPRISE, nil- case "FREE":- return v1pb.PlanType_FREE, nil- default:- return v1pb.PlanType_FREE, errors.Errorf("cannot convert plan type %q", candidate)- }-}diff --git a/backend/enterprise/plugin/license.go b/backend/enterprise/plugin/license.goindex 61098eec00..9e5a9cb15b 100644--- a/backend/enterprise/plugin/license.go+++ b/backend/enterprise/plugin/license.go@@ -4,16 +4,16 @@ import ("context""github.com/bytebase/bytebase/backend/common"- enterprise "github.com/bytebase/bytebase/backend/enterprise/api""github.com/bytebase/bytebase/backend/store"+ v1pb "github.com/bytebase/bytebase/proto/generated-go/v1")// LicenseProvider is the license provider.type LicenseProvider interface {// StoreLicense will store the license.- StoreLicense(ctx context.Context, patch *enterprise.SubscriptionPatch) error+ StoreLicense(ctx context.Context, license string) error// LoadSubscription will load the subscription.- LoadSubscription(ctx context.Context) *enterprise.Subscription+ LoadSubscription(ctx context.Context) *v1pb.Subscription}// ProviderConfig is the provider configuration.diff --git a/backend/enterprise/service/license.go b/backend/enterprise/service/license.goindex 15045030d8..5b754e52a5 100644--- a/backend/enterprise/service/license.go+++ b/backend/enterprise/service/license.go@@ -22,7 +22,7 @@ var _ enterprise.LicenseService = (*LicenseService)(nil)// LicenseService is the service for enterprise license.type LicenseService struct {store *store.Store- cachedSubscription *enterprise.Subscription+ cachedSubscription *v1pb.Subscriptionmu sync.RWMutexprovider plugin.LicenseProvider@@ -45,8 +45,8 @@ func NewLicenseService(mode common.ReleaseMode, store *store.Store) (*LicenseSer}// StoreLicense will store license into file.-func (s *LicenseService) StoreLicense(ctx context.Context, patch *enterprise.SubscriptionPatch) error {- if err := s.provider.StoreLicense(ctx, patch); err != nil {+func (s *LicenseService) StoreLicense(ctx context.Context, license string) error {+ if err := s.provider.StoreLicense(ctx, license); err != nil {return err}@@ -55,13 +55,13 @@ func (s *LicenseService) StoreLicense(ctx context.Context, patch *enterprise.Sub}// LoadSubscription will load subscription.-func (s *LicenseService) LoadSubscription(ctx context.Context) *enterprise.Subscription {+func (s *LicenseService) LoadSubscription(ctx context.Context) *v1pb.Subscription {s.mu.RLock()cached := s.cachedSubscriptions.mu.RUnlock()if cached != nil {- if cached.Plan == v1pb.PlanType_FREE || cached.IsExpired() {+ if cached.Plan == v1pb.PlanType_FREE || isSubscriptionExpired(cached) {// refresh expired subscriptions.mu.Lock()s.cachedSubscription = nil@@ -77,13 +77,21 @@ func (s *LicenseService) LoadSubscription(ctx context.Context) *enterprise.Subscs.mu.Lock()defer s.mu.Unlock()// Double-check after acquiring write lock- if s.cachedSubscription != nil && s.cachedSubscription.Plan != v1pb.PlanType_FREE && !s.cachedSubscription.IsExpired() {+ if s.cachedSubscription != nil && s.cachedSubscription.Plan != v1pb.PlanType_FREE && !isSubscriptionExpired(s.cachedSubscription) {return s.cachedSubscription}s.cachedSubscription = s.provider.LoadSubscription(ctx)return s.cachedSubscription}+// isSubscriptionExpired returns if the subscription is expired.+func isSubscriptionExpired(s *v1pb.Subscription) bool {+ if s.Plan == v1pb.PlanType_FREE || s.ExpiresTime == nil {+ return false+ }+ return s.ExpiresTime.AsTime().Before(time.Now())+}+// IsFeatureEnabled returns whether a feature is enabled.func (s *LicenseService) IsFeatureEnabled(f v1pb.PlanFeature) error {plan := s.GetEffectivePlan()@@ -97,7 +105,7 @@ func (s *LicenseService) IsFeatureEnabled(f v1pb.PlanFeature) error {// IsFeatureEnabledForInstance returns whether a feature is enabled for the instance.func (s *LicenseService) IsFeatureEnabledForInstance(f v1pb.PlanFeature, instance *store.InstanceMessage) error {plan := s.GetEffectivePlan()- // DONOT check instance license fo FREE plan.+ // DO NOT check instance license fo FREE plan.if plan == v1pb.PlanType_FREE {return s.IsFeatureEnabled(f)}@@ -120,14 +128,14 @@ func (s *LicenseService) GetInstanceLicenseCount(ctx context.Context) int {if instanceCount < 0 {return math.MaxInt}- return instanceCount+ return int(instanceCount)}// GetEffectivePlan gets the effective plan.func (s *LicenseService) GetEffectivePlan() v1pb.PlanType {ctx := context.Background()subscription := s.LoadSubscription(ctx)- if expireTime := time.Unix(subscription.ExpiresTS, 0); expireTime.Before(time.Now()) {+ if subscription.ExpiresTime != nil && subscription.ExpiresTime.AsTime().Before(time.Now()) {return v1pb.PlanType_FREE}return subscription.Plan@@ -153,14 +161,14 @@ func (s *LicenseService) GetPlanLimitValue(ctx context.Context, name enterprise.case enterprise.PlanLimitMaximumInstance:return limitcase enterprise.PlanLimitMaximumUser:- if subscription.Seat == 0 {+ if subscription.SeatCount == 0 {// to compatible with old license.return limit}- if subscription.Seat < 0 {+ if subscription.SeatCount < 0 {return math.MaxInt}- return subscription.Seat+ return int(subscription.SeatCount)}}diff --git a/backend/runner/metricreport/reporter.go b/backend/runner/metricreport/reporter.goindex b9f22b472e..8de5d48f61 100644--- a/backend/runner/metricreport/reporter.go+++ b/backend/runner/metricreport/reporter.go@@ -155,8 +155,8 @@ func (m *Reporter) identify(ctx context.Context) (string, error) {}subscription := m.licenseService.LoadSubscription(ctx)plan := subscription.Plan.String()- orgID := subscription.OrgID- orgName := subscription.OrgName+ orgID := ""+ orgName := ""trial := "N"if subscription.Trialing {@@ -165,9 +165,8 @@ func (m *Reporter) identify(ctx context.Context) (string, error) {subscriptionStartDate := ""subscriptionEndDate := ""- if subscription.Plan != v1pb.PlanType_FREE {- subscriptionStartDate = time.Unix(subscription.StartedTS, 0).Format(time.RFC3339)- subscriptionEndDate = time.Unix(subscription.ExpiresTS, 0).Format(time.RFC3339)+ if subscription.Plan != v1pb.PlanType_FREE && subscription.ExpiresTime != nil {+ subscriptionEndDate = subscription.ExpiresTime.AsTime().Format(time.RFC3339)}user, err := m.store.GetUserByID(ctx, common.PrincipalIDForFirstUser)diff --git a/frontend/src/store/modules/v1/subscription.ts b/frontend/src/store/modules/v1/subscription.tsindex b0ffc44668..6fd98aefd9 100644--- a/frontend/src/store/modules/v1/subscription.ts+++ b/frontend/src/store/modules/v1/subscription.ts@@ -128,27 +128,6 @@ export const useSubscriptionV1Store = defineStore("subscription_v1", {);return Math.max(expiresTime.diff(new Date(), "day"), 0);},- isNearExpireTime(state): boolean {- if (- !state.subscription ||- !state.subscription?.trialing ||- this.isFreePlan- ) {- return false;- }-- const daysBeforeExpire = this.daysBeforeExpire;- if (daysBeforeExpire <= 0) return false;-- const trialEndTime = dayjs(- getDateForPbTimestamp(state.subscription.expiresTime)- );- const total = trialEndTime.diff(- getDateForPbTimestamp(state.subscription.startedTime),- "day"- );- return daysBeforeExpire / total < 0.5;- },showTrial(state): boolean {if (!this.isSelfHostLicense) {return false;diff --git a/frontend/src/types/proto-es/v1/subscription_service_pb.d.ts b/frontend/src/types/proto-es/v1/subscription_service_pb.d.tsindex 8860255143..1d4c747ca0 100644--- a/frontend/src/types/proto-es/v1/subscription_service_pb.d.ts+++ b/frontend/src/types/proto-es/v1/subscription_service_pb.d.ts@@ -75,27 +75,17 @@ export declare type Subscription = Message<"bytebase.v1.Subscription"> & {expiresTime?: Timestamp;/**- * @generated from field: google.protobuf.Timestamp started_time = 4;- */- startedTime?: Timestamp;-- /**- * @generated from field: bytebase.v1.PlanType plan = 5;+ * @generated from field: bytebase.v1.PlanType plan = 4;*/plan: PlanType;/**- * @generated from field: bool trialing = 6;+ * @generated from field: bool trialing = 5;*/trialing: boolean;/**- * @generated from field: string org_id = 7;- */- orgId: string;-- /**- * @generated from field: string org_name = 8;+ * @generated from field: string org_name = 6;*/orgName: string;};diff --git a/frontend/src/types/proto-es/v1/subscription_service_pb.js b/frontend/src/types/proto-es/v1/subscription_service_pb.jsindex 6d2e9fa03e..a0587e030d 100644--- a/frontend/src/types/proto-es/v1/subscription_service_pb.js+++ b/frontend/src/types/proto-es/v1/subscription_service_pb.js@@ -13,7 +13,7 @@ import { file_v1_annotation } from "./annotation_pb";* Describes the file v1/subscription_service.proto.*/export const file_v1_subscription_service = /*@__PURE__*/- fileDesc("Ch12MS9zdWJzY3JpcHRpb25fc2VydmljZS5wcm90bxILYnl0ZWJhc2UudjEiGAoWR2V0U3Vic2NyaXB0aW9uUmVxdWVzdCJKChlVcGRhdGVTdWJzY3JpcHRpb25SZXF1ZXN0Ei0KBXBhdGNoGAEgASgLMh4uYnl0ZWJhc2UudjEuUGF0Y2hTdWJzY3JpcHRpb24iJAoRUGF0Y2hTdWJzY3JpcHRpb24SDwoHbGljZW5zZRgBIAEoCSKnAgoMU3Vic2NyaXB0aW9uEhgKCnNlYXRfY291bnQYASABKAVCBOJBAQMSHAoOaW5zdGFuY2VfY291bnQYAiABKAVCBOJBAQMSNgoMZXhwaXJlc190aW1lGAMgASgLMhouZ29vZ2xlLnByb3RvYnVmLlRpbWVzdGFtcEIE4kEBAxI2CgxzdGFydGVkX3RpbWUYBCABKAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wQgTiQQEDEikKBHBsYW4YBSABKA4yFS5ieXRlYmFzZS52MS5QbGFuVHlwZUIE4kEBAxIWCgh0cmlhbGluZxgGIAEoCEIE4kEBAxIUCgZvcmdfaWQYByABKAlCBOJBAQMSFgoIb3JnX25hbWUYCCABKAlCBOJBAQMibgoKUGxhbkNvbmZpZxIrCgVwbGFucxgBIAMoCzIcLmJ5dGViYXNlLnYxLlBsYW5MaW1pdENvbmZpZxIzChFpbnN0YW5jZV9mZWF0dXJlcxgCIAMoDjIYLmJ5dGViYXNlLnYxLlBsYW5GZWF0dXJlIp4BCg9QbGFuTGltaXRDb25maWcSIwoEdHlwZRgBIAEoDjIVLmJ5dGViYXNlLnYxLlBsYW5UeXBlEh4KFm1heGltdW1faW5zdGFuY2VfY291bnQYAiABKAUSGgoSbWF4aW11bV9zZWF0X2NvdW50GAMgASgFEioKCGZlYXR1cmVzGAQgAygOMhguYnl0ZWJhc2UudjEuUGxhbkZlYXR1cmUqSQoIUGxhblR5cGUSGQoVUExBTl9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SFQoRRkVBVFVSRV9XQVRFUk1BUksQRBIiCh5GRUFUVVJFX1JPQURNQVBfUFJJT1JJVElaQVRJT04QRRIWChJGRUFUVVJFX0NVU1RPTV9NU0EQRhIdChlGRUFUVVJFX0NPTU1VTklUWV9TVVBQT1JUEEcSGQoVRkVBVFVSRV9FTUFJTF9TVVBQT1JUEEgSJgoiRkVBVFVSRV9ERURJQ0FURURfU1VQUE9SVF9XSVRIX1NMQRBJMqMCChNTdWJzY3JpcHRpb25TZXJ2aWNlEnIKD0dldFN1YnNjcmlwdGlvbhIjLmJ5dGViYXNlLnYxLkdldFN1YnNjcmlwdGlvblJlcXVlc3QaGS5ieXRlYmFzZS52MS5TdWJzY3JpcHRpb24iH9pBAIDqMAGC0+STAhISEC92MS9zdWJzY3JpcHRpb24SlwEKElVwZGF0ZVN1YnNjcmlwdGlvbhImLmJ5dGViYXNlLnYxLlVwZGF0ZVN1YnNjcmlwdGlvblJlcXVlc3QaGS5ieXRlYmFzZS52MS5TdWJzY3JpcHRpb24iPtpBBXBhdGNoiuowD2JiLnNldHRpbmdzLnNldJDqMAGC0+STAhk6BXBhdGNoMhAvdjEvc3Vic2NyaXB0aW9uQjRaMmdpdGh1Yi5jb20vYnl0ZWJhc2UvYnl0ZWJhc2UvcHJvdG8vZ2VuZXJhdGVkLWdvL3YxYgZwcm90bzM", [file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_protobuf_timestamp, file_v1_annotation]);+ fileDesc("Ch12MS9zdWJzY3JpcHRpb25fc2VydmljZS5wcm90bxILYnl0ZWJhc2UudjEiGAoWR2V0U3Vic2NyaXB0aW9uUmVxdWVzdCJKChlVcGRhdGVTdWJzY3JpcHRpb25SZXF1ZXN0Ei0KBXBhdGNoGAEgASgLMh4uYnl0ZWJhc2UudjEuUGF0Y2hTdWJzY3JpcHRpb24iJAoRUGF0Y2hTdWJzY3JpcHRpb24SDwoHbGljZW5zZRgBIAEoCSLZAQoMU3Vic2NyaXB0aW9uEhgKCnN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Rpb24SlwEKElVwZGF0ZVN1YnNjcmlwdGlvbhImLmJ5dGViYXNlLnYxLlVwZGF0ZVN1YnNjcmlwdGlvblJlcXVlc3QaGS5ieXRlYmFzZS52MS5TdWJzY3JpcHRpb24iPtpBBXBhdGNoiuowD2JiLnNldHRpbmdzLnNldJDqMAGC0+STAhk6BXBhdGNoMhAvdjEvc3Vic2NyaXB0aW9uQjRaMmdpdGh1Yi5jb20vYnl0ZWJhc2UvYnl0ZWJhc2UvcHJvdG8vZ2VuZXJhdGVkLWdvL3YxYgZwcm90bzM", [file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_protobuf_timestamp, file_v1_annotation]);/*** Describes the message bytebase.v1.GetSubscriptionRequest.diff --git a/frontend/src/types/proto/v1/subscription_service.ts b/frontend/src/types/proto/v1/subscription_service.tsindex 09d26d154a..51b38cfbeb 100644--- a/frontend/src/types/proto/v1/subscription_service.ts+++ b/frontend/src/types/proto/v1/subscription_service.ts@@ -713,10 +713,8 @@ export interface Subscription {seatCount: number;instanceCount: number;expiresTime: Timestamp | undefined;- startedTime: Timestamp | undefined;plan: PlanType;trialing: boolean;- orgId: string;orgName: string;}@@ -900,10 +898,8 @@ function createBaseSubscription(): Subscription {seatCount: 0,instanceCount: 0,expiresTime: undefined,- startedTime: undefined,plan: PlanType.PLAN_TYPE_UNSPECIFIED,trialing: false,- orgId: "",orgName: "",};}@@ -919,20 +915,14 @@ export const Subscription: MessageFns<Subscription> = {if (message.expiresTime !== undefined) {Timestamp.encode(message.expiresTime, writer.uint32(26).fork()).join();}- if (message.startedTime !== undefined) {- Timestamp.encode(message.startedTime, writer.uint32(34).fork()).join();- }if (message.plan !== PlanType.PLAN_TYPE_UNSPECIFIED) {- writer.uint32(40).int32(planTypeToNumber(message.plan));+ writer.uint32(32).int32(planTypeToNumber(message.plan));}if (message.trialing !== false) {- writer.uint32(48).bool(message.trialing);- }- if (message.orgId !== "") {- writer.uint32(58).string(message.orgId);+ writer.uint32(40).bool(message.trialing);}if (message.orgName !== "") {- writer.uint32(66).string(message.orgName);+ writer.uint32(50).string(message.orgName);}return writer;},@@ -969,11 +959,11 @@ export const Subscription: MessageFns<Subscription> = {continue;}case 4: {- if (tag !== 34) {+ if (tag !== 32) {break;}- message.startedTime = Timestamp.decode(reader, reader.uint32());+ message.plan = planTypeFromJSON(reader.int32());continue;}case 5: {@@ -981,27 +971,11 @@ export const Subscription: MessageFns<Subscription> = {break;}- message.plan = planTypeFromJSON(reader.int32());- continue;- }- case 6: {- if (tag !== 48) {- break;- }-message.trialing = reader.bool();continue;}- case 7: {- if (tag !== 58) {- break;- }-- message.orgId = reader.string();- continue;- }- case 8: {- if (tag !== 66) {+ case 6: {+ if (tag !== 50) {break;}@@ -1022,10 +996,8 @@ export const Subscription: MessageFns<Subscription> = {seatCount: isSet(object.seatCount) ? globalThis.Number(object.seatCount) : 0,instanceCount: isSet(object.instanceCount) ? globalThis.Number(object.instanceCount) : 0,expiresTime: isSet(object.expiresTime) ? fromJsonTimestamp(object.expiresTime) : undefined,- startedTime: isSet(object.startedTime) ? fromJsonTimestamp(object.startedTime) : undefined,plan: isSet(object.plan) ? planTypeFromJSON(object.plan) : PlanType.PLAN_TYPE_UNSPECIFIED,trialing: isSet(object.trialing) ? globalThis.Boolean(object.trialing) : false,- orgId: isSet(object.orgId) ? globalThis.String(object.orgId) : "",orgName: isSet(object.orgName) ? globalThis.String(object.orgName) : "",};},@@ -1041,18 +1013,12 @@ export const Subscription: MessageFns<Subscription> = {if (message.expiresTime !== undefined) {obj.expiresTime = fromTimestamp(message.expiresTime).toISOString();}- if (message.startedTime !== undefined) {- obj.startedTime = fromTimestamp(message.startedTime).toISOString();- }if (message.plan !== PlanType.PLAN_TYPE_UNSPECIFIED) {obj.plan = planTypeToJSON(message.plan);}if (message.trialing !== false) {obj.trialing = message.trialing;}- if (message.orgId !== "") {- obj.orgId = message.orgId;- }if (message.orgName !== "") {obj.orgName = message.orgName;}@@ -1069,12 +1035,8 @@ export const Subscription: MessageFns<Subscription> = {message.expiresTime = (object.expiresTime !== undefined && object.expiresTime !== null)? Timestamp.fromPartial(object.expiresTime): undefined;- message.startedTime = (object.startedTime !== undefined && object.startedTime !== null)- ? Timestamp.fromPartial(object.startedTime)- : undefined;message.plan = object.plan ?? PlanType.PLAN_TYPE_UNSPECIFIED;message.trialing = object.trialing ?? false;- message.orgId = object.orgId ?? "";message.orgName = object.orgName ?? "";return message;},diff --git a/proto/gen/grpc-doc/openapi.yaml b/proto/gen/grpc-doc/openapi.yamlindex 1a805bb3fe..b58d7bbcac 100644--- a/proto/gen/grpc-doc/openapi.yaml+++ b/proto/gen/grpc-doc/openapi.yaml@@ -13197,10 +13197,6 @@ components:readOnly: truetype: stringformat: date-time- startedTime:- readOnly: true- type: string- format: date-timeplan:readOnly: trueenum:@@ -13213,9 +13209,6 @@ components:trialing:readOnly: truetype: boolean- orgId:- readOnly: true- type: stringorgName:readOnly: truetype: stringdiff --git a/proto/gen/grpc-doc/v1/README.md b/proto/gen/grpc-doc/v1/README.mdindex 8f05768501..94fb7a6078 100644--- a/proto/gen/grpc-doc/v1/README.md+++ b/proto/gen/grpc-doc/v1/README.md@@ -3990,10 +3990,8 @@ PlanLimitConfig represents a single plan's configuration| seat_count | [int32](#int32) | | || instance_count | [int32](#int32) | | || expires_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | |-| started_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | || plan | [PlanType](#bytebase-v1-PlanType) | | || trialing | [bool](#bool) | | |-| org_id | [string](#string) | | || org_name | [string](#string) | | |diff --git a/proto/gen/grpc-doc/v1/index.html b/proto/gen/grpc-doc/v1/index.htmlindex 6cbefee500..f185437370 100644--- a/proto/gen/grpc-doc/v1/index.html+++ b/proto/gen/grpc-doc/v1/index.html@@ -11942,13 +11942,6 @@ The access is based on approval flow.</p></td><td><p> </p></td></tr>- <tr>- <td>started_time</td>- <td><a href="#google.protobuf.Timestamp">google.protobuf.Timestamp</a></td>- <td></td>- <td><p> </p></td>- </tr>-<tr><td>plan</td><td><a href="#bytebase.v1.PlanType">PlanType</a></td>@@ -11963,13 +11956,6 @@ The access is based on approval flow.</p></td><td><p> </p></td></tr>- <tr>- <td>org_id</td>- <td><a href="#string">string</a></td>- <td></td>- <td><p> </p></td>- </tr>-<tr><td>org_name</td><td><a href="#string">string</a></td>diff --git a/proto/generated-go/v1/subscription_service.pb.go b/proto/generated-go/v1/subscription_service.pb.goindex dfa2720759..f858612ce4 100644--- a/proto/generated-go/v1/subscription_service.pb.go+++ b/proto/generated-go/v1/subscription_service.pb.go@@ -471,11 +471,9 @@ type Subscription struct {SeatCount int32 `protobuf:"varint,1,opt,name=seat_count,json=seatCount,proto3" json:"seat_count,omitempty"`InstanceCount int32 `protobuf:"varint,2,opt,name=instance_count,json=instanceCount,proto3" json:"instance_count,omitempty"`ExpiresTime *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=expires_time,json=expiresTime,proto3" json:"expires_time,omitempty"`- StartedTime *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=started_time,json=startedTime,proto3" json:"started_time,omitempty"`- Plan PlanType `protobuf:"varint,5,opt,name=plan,proto3,enum=bytebase.v1.PlanType" json:"plan,omitempty"`- Trialing bool `protobuf:"varint,6,opt,name=trialing,proto3" json:"trialing,omitempty"`- OrgId string `protobuf:"bytes,7,opt,name=org_id,json=orgId,proto3" json:"org_id,omitempty"`- OrgName string `protobuf:"bytes,8,opt,name=org_name,json=orgName,proto3" json:"org_name,omitempty"`+ Plan PlanType `protobuf:"varint,4,opt,name=plan,proto3,enum=bytebase.v1.PlanType" json:"plan,omitempty"`+ Trialing bool `protobuf:"varint,5,opt,name=trialing,proto3" json:"trialing,omitempty"`+ OrgName string `protobuf:"bytes,6,opt,name=org_name,json=orgName,proto3" json:"org_name,omitempty"`unknownFields protoimpl.UnknownFieldssizeCache protoimpl.SizeCache}@@ -531,13 +529,6 @@ func (x *Subscription) GetExpiresTime() *timestamppb.Timestamp {return nil}-func (x *Subscription) GetStartedTime() *timestamppb.Timestamp {- if x != nil {- return x.StartedTime- }- return nil-}-func (x *Subscription) GetPlan() PlanType {if x != nil {return x.Plan@@ -552,13 +543,6 @@ func (x *Subscription) GetTrialing() bool {return false}-func (x *Subscription) GetOrgId() string {- if x != nil {- return x.OrgId- }- return ""-}-func (x *Subscription) GetOrgName() string {if x != nil {return x.OrgName@@ -697,17 +681,15 @@ const file_v1_subscription_service_proto_rawDesc = "" +"\x19UpdateSubscriptionRequest\x124\n" +"\x05patch\x18\x01 \x01(\v2\x1e.bytebase.v1.PatchSubscriptionR\x05patch\"-\n" +"\x11PatchSubscription\x12\x18\n" +- "\alicense\x18\x01 \x01(\tR\alicense\"\xfb\x02\n" ++ "\alicense\x18\x01 \x01(\tR\alicense\"\x99\x02\n" +"\fSubscription\x12#\n" +"\n" +"seat_count\x18\x01 \x01(\x05B\x04\xe2A\x01\x03R\tseatCount\x12+\n" +"\x0einstance_count\x18\x02 \x01(\x05B\x04\xe2A\x01\x03R\rinstanceCount\x12C\n" +- "\fexpires_time\x18\x03 \x01(\v2\x1a.google.protobuf.TimestampB\x04\xe2A\x01\x03R\vexpiresTime\x12C\n" +- "\fstarted_time\x18\x04 \x01(\v2\x1a.google.protobuf.TimestampB\x04\xe2A\x01\x03R\vstartedTime\x12/\n" +- "\x04plan\x18\x05 \x01(\x0e2\x15.bytebase.v1.PlanTypeB\x04\xe2A\x01\x03R\x04plan\x12 \n" +- "\btrialing\x18\x06 \x01(\bB\x04\xe2A\x01\x03R\btrialing\x12\x1b\n" +- "\x06org_id\x18\a \x01(\tB\x04\xe2A\x01\x03R\x05orgId\x12\x1f\n" +- "\borg_name\x18\b \x01(\tB\x04\xe2A\x01\x03R\aorgName\"\x87\x01\n" ++ "\fexpires_time\x18\x03 \x01(\v2\x1a.google.protobuf.TimestampB\x04\xe2A\x01\x03R\vexpiresTime\x12/\n" ++ "\x04plan\x18\x04 \x01(\x0e2\x15.bytebase.v1.PlanTypeB\x04\xe2A\x01\x03R\x04plan\x12 \n" ++ "\btrialing\x18\x05 \x01(\bB\x04\xe2A\x01\x03R\btrialing\x12\x1f\n" ++ "\borg_name\x18\x06 \x01(\tB\x04\xe2A\x01\x03R\aorgName\"\x87\x01\n" +"\n" +"PlanConfig\x122\n" +"\x05plans\x18\x01 \x03(\v2\x1c.bytebase.v1.PlanLimitConfigR\x05plans\x12E\n" +@@ -829,23 +811,22 @@ var file_v1_subscription_service_proto_goTypes = []any{(*timestamppb.Timestamp)(nil), // 8: google.protobuf.Timestamp}var file_v1_subscription_service_proto_depIdxs = []int32{- 4, // 0: bytebase.v1.UpdateSubscriptionRequest.patch:type_name -> bytebase.v1.PatchSubscription- 8, // 1: bytebase.v1.Subscription.expires_time:type_name -> google.protobuf.Timestamp- 8, // 2: bytebase.v1.Subscription.started_time:type_name -> google.protobuf.Timestamp- 0, // 3: bytebase.v1.Subscription.plan:type_name -> bytebase.v1.PlanType- 7, // 4: bytebase.v1.PlanConfig.plans:type_name -> bytebase.v1.PlanLimitConfig- 1, // 5: bytebase.v1.PlanConfig.instance_features:type_name -> bytebase.v1.PlanFeature- 0, // 6: bytebase.v1.PlanLimitConfig.type:type_name -> bytebase.v1.PlanType- 1, // 7: bytebase.v1.PlanLimitConfig.features:type_name -> bytebase.v1.PlanFeature- 2, // 8: bytebase.v1.SubscriptionService.GetSubscription:input_type -> bytebase.v1.GetSubscriptionRequest- 3, // 9: bytebase.v1.SubscriptionService.UpdateSubscription:input_type -> bytebase.v1.UpdateSubscriptionRequest- 5, // 10: bytebase.v1.SubscriptionService.GetSubscription:output_type -> bytebase.v1.Subscription- 5, // 11: bytebase.v1.SubscriptionService.UpdateSubscription:output_type -> bytebase.v1.Subscription- 10, // [10:12] is the sub-list for method output_type- 8, // [8:10] is the sub-list for method input_type- 8, // [8:8] is the sub-list for extension type_name- 8, // [8:8] is the sub-list for extension extendee- 0, // [0:8] is the sub-list for field type_name+ 4, // 0: bytebase.v1.UpdateSubscriptionRequest.patch:type_name -> bytebase.v1.PatchSubscription+ 8, // 1: bytebase.v1.Subscription.expires_time:type_name -> google.protobuf.Timestamp+ 0, // 2: bytebase.v1.Subscription.plan:type_name -> bytebase.v1.PlanType+ 7, // 3: bytebase.v1.PlanConfig.plans:type_name -> bytebase.v1.PlanLimitConfig+ 1, // 4: bytebase.v1.PlanConfig.instance_features:type_name -> bytebase.v1.PlanFeature+ 0, // 5: bytebase.v1.PlanLimitConfig.type:type_name -> bytebase.v1.PlanType+ 1, // 6: bytebase.v1.PlanLimitConfig.features:type_name -> bytebase.v1.PlanFeature+ 2, // 7: bytebase.v1.SubscriptionService.GetSubscription:input_type -> bytebase.v1.GetSubscriptionRequest+ 3, // 8: bytebase.v1.SubscriptionService.UpdateSubscription:input_type -> bytebase.v1.UpdateSubscriptionRequest+ 5, // 9: bytebase.v1.SubscriptionService.GetSubscription:output_type -> bytebase.v1.Subscription+ 5, // 10: bytebase.v1.SubscriptionService.UpdateSubscription:output_type -> bytebase.v1.Subscription+ 9, // [9:11] is the sub-list for method output_type+ 7, // [7:9] is the sub-list for method input_type+ 7, // [7:7] is the sub-list for extension type_name+ 7, // [7:7] is the sub-list for extension extendee+ 0, // [0:7] is the sub-list for field type_name}func init() { file_v1_subscription_service_proto_init() }diff --git a/proto/v1/v1/subscription_service.proto b/proto/v1/v1/subscription_service.protoindex e2629cc37e..194caea2b1 100644--- a/proto/v1/v1/subscription_service.proto+++ b/proto/v1/v1/subscription_service.proto@@ -55,15 +55,11 @@ message Subscription {google.protobuf.Timestamp expires_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY];- google.protobuf.Timestamp started_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY];+ PlanType plan = 4 [(google.api.field_behavior) = OUTPUT_ONLY];- PlanType plan = 5 [(google.api.field_behavior) = OUTPUT_ONLY];+ bool trialing = 5 [(google.api.field_behavior) = OUTPUT_ONLY];- bool trialing = 6 [(google.api.field_behavior) = OUTPUT_ONLY];-- string org_id = 7 [(google.api.field_behavior) = OUTPUT_ONLY];-- string org_name = 8 [(google.api.field_behavior) = OUTPUT_ONLY];+ string org_name = 6 [(google.api.field_behavior) = OUTPUT_ONLY];}// PlanFeature represents the available features in Bytebase