Skip to content

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

chore: remove vcs api url (#11225)

Danny Xu7bea0aad76e0
diff --git a/backend/api/v1/vcs_provider_service.go b/backend/api/v1/vcs_provider_service.go
index cc39fd5f61..90c5719f42 100644
--- a/backend/api/v1/vcs_provider_service.go
+++ b/backend/api/v1/vcs_provider_service.go
@@ -242,7 +242,6 @@ func convertToVCSProvider(vcsProvider *store.VCSProviderMessage) *v1pb.VCSProvid
Name: fmt.Sprintf("%s%d", common.VCSProviderPrefix, vcsProvider.ID),
Title: vcsProvider.Name,
Type: tp,
- Url: vcsProvider.InstanceURL,
}
}
@@ -270,7 +269,6 @@ func checkAndConvertToStoreVersionControl(vcsProvider *v1pb.VCSProvider) (*store
}
storeVCSProvider.InstanceURL = strings.TrimRight(vcsProvider.Url, "/")
- storeVCSProvider.APIURL = vcs.Get(tp, vcs.ProviderConfig{}).APIURL(vcsProvider.Url)
storeVCSProvider.Type = tp
return storeVCSProvider, nil
}
diff --git a/backend/migrator/migration/prod/2.15/0003##vcs_token.sql b/backend/migrator/migration/prod/2.15/0003##vcs_token.sql
index 8c0b991008..062af6263c 100644
--- a/backend/migrator/migration/prod/2.15/0003##vcs_token.sql
+++ b/backend/migrator/migration/prod/2.15/0003##vcs_token.sql
@@ -1,5 +1,6 @@
ALTER TABLE vcs DROP COLUMN application_id;
ALTER TABLE vcs DROP COLUMN secret;
+ALTER TABLE vcs DROP COLUMN api_url;
ALTER TABLE vcs ADD COLUMN access_token TEXT NOT NULL DEFAULT '';
ALTER TABLE repository DROP COLUMN sheet_path_template;
ALTER TABLE repository DROP COLUMN access_token;
diff --git a/backend/migrator/migration/prod/LATEST.sql b/backend/migrator/migration/prod/LATEST.sql
index a0170d69af..6d596cdd01 100644
--- a/backend/migrator/migration/prod/LATEST.sql
+++ b/backend/migrator/migration/prod/LATEST.sql
@@ -857,7 +857,6 @@ CREATE TABLE vcs (
name TEXT NOT NULL,
type TEXT NOT NULL CHECK (type IN ('GITLAB', 'GITHUB', 'BITBUCKET', 'AZURE_DEVOPS')),
instance_url TEXT NOT NULL CHECK ((instance_url LIKE 'http://%' OR instance_url LIKE 'https://%') AND instance_url = rtrim(instance_url, '/')),
- api_url TEXT NOT NULL CHECK ((api_url LIKE 'http://%' OR api_url LIKE 'https://%') AND api_url = rtrim(api_url, '/')),
access_token TEXT NOT NULL DEFAULT ''
);
diff --git a/backend/store/vcs.go b/backend/store/vcs.go
index 7f89238332..1ccffe3697 100644
--- a/backend/store/vcs.go
+++ b/backend/store/vcs.go
@@ -16,8 +16,6 @@ import (
type VCSProviderMessage struct {
// Type is the type of the external version control.
Type vcs.Type
- // APIURL is the URL for the external version control API.
- APIURL string
// InstanceURL is the URL for the external version control instance.
InstanceURL string
// Name is the name of the external version control.
@@ -111,11 +109,10 @@ func (s *Store) CreateVCSProviderV2(ctx context.Context, principalUID int, creat
name,
type,
instance_url,
- api_url,
access_token
)
- VALUES ($1, $2, $3, $4, $5, $6, $7)
- RETURNING id, name, type, instance_url, api_url, access_token
+ VALUES ($1, $2, $3, $4, $5, $6)
+ RETURNING id, name, type, instance_url, access_token
`
var vcsProvider VCSProviderMessage
if err := tx.QueryRowContext(ctx, query,
@@ -124,14 +121,12 @@ func (s *Store) CreateVCSProviderV2(ctx context.Context, principalUID int, creat
create.Name,
create.Type,
create.InstanceURL,
- create.APIURL,
create.AccessToken,
).Scan(
&vcsProvider.ID,
&vcsProvider.Name,
&vcsProvider.Type,
&vcsProvider.InstanceURL,
- &vcsProvider.APIURL,
&vcsProvider.AccessToken,
); err != nil {
if err == sql.ErrNoRows {
@@ -172,7 +167,7 @@ func (s *Store) UpdateVCSProviderV2(ctx context.Context, principalUID int, vcsPr
UPDATE vcs
SET `+strings.Join(set, ", ")+`
WHERE id = $%d
- RETURNING id, name, type, instance_url, api_url, access_token
+ RETURNING id, name, type, instance_url, access_token
`, len(args)),
args...,
).Scan(
@@ -180,7 +175,6 @@ func (s *Store) UpdateVCSProviderV2(ctx context.Context, principalUID int, vcsPr
&vcsProvider.Name,
&vcsProvider.Type,
&vcsProvider.InstanceURL,
- &vcsProvider.APIURL,
&vcsProvider.AccessToken,
); err != nil {
if err == sql.ErrNoRows {
@@ -229,7 +223,6 @@ func (*Store) findVCSProvidersImplV2(ctx context.Context, tx *Tx, find *findVCSP
name,
type,
instance_url,
- api_url,
access_token
FROM vcs
WHERE `+strings.Join(where, " AND "),
@@ -247,7 +240,6 @@ func (*Store) findVCSProvidersImplV2(ctx context.Context, tx *Tx, find *findVCSP
&vcsProvider.Name,
&vcsProvider.Type,
&vcsProvider.InstanceURL,
- &vcsProvider.APIURL,
&vcsProvider.AccessToken,
); err != nil {
return nil, err