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: add ReadOnly flag to readonly tx (#4200)
Tianzhou (天舟)025f73f555f8
diff --git a/store/activity.go b/store/activity.goindex b23bc4a4ba..018e8f3b1e 100644--- a/store/activity.go+++ b/store/activity.go@@ -184,7 +184,7 @@ func (s *Store) createActivityRaw(ctx context.Context, create *api.ActivityCreat// findActivityRaw retrieves a list of activities based on the find condition.func (s *Store) findActivityRaw(ctx context.Context, find *api.ActivityFind) ([]*activityRaw, error) {- tx, err := s.db.BeginTx(ctx, nil)+ tx, err := s.db.BeginTx(ctx, &sql.TxOptions{ReadOnly: true})if err != nil {return nil, FormatError(err)}@@ -202,7 +202,7 @@ func (s *Store) findActivityRaw(ctx context.Context, find *api.ActivityFind) ([]// Returns ECONFLICT if finding more than 1 matching records.func (s *Store) getActivityRawByID(ctx context.Context, id int) (*activityRaw, error) {find := &api.ActivityFind{ID: &id}- tx, err := s.db.BeginTx(ctx, nil)+ tx, err := s.db.BeginTx(ctx, &sql.TxOptions{ReadOnly: true})if err != nil {return nil, FormatError(err)}diff --git a/store/anomaly.go b/store/anomaly.goindex c3f2024c4d..b47d8334ff 100644--- a/store/anomaly.go+++ b/store/anomaly.go@@ -178,7 +178,7 @@ func (s *Store) upsertActiveAnomalyRaw(ctx context.Context, upsert *api.AnomalyU// findAnomalyRaw retrieves a list of anomalies based on the find condition.func (s *Store) findAnomalyRaw(ctx context.Context, find *api.AnomalyFind) ([]*anomalyRaw, error) {- tx, err := s.db.BeginTx(ctx, nil)+ tx, err := s.db.BeginTx(ctx, &sql.TxOptions{ReadOnly: true})if err != nil {return nil, FormatError(err)}diff --git a/store/backup.go b/store/backup.goindex 23f3a95418..66c47f1466 100644--- a/store/backup.go+++ b/store/backup.go@@ -345,7 +345,7 @@ func (s *Store) createBackupRaw(ctx context.Context, create *api.BackupCreate) (// Returns ECONFLICT if finding more than 1 matching records.func (s *Store) getBackupRawByID(ctx context.Context, id int) (*backupRaw, error) {find := &api.BackupFind{ID: &id}- tx, err := s.db.BeginTx(ctx, nil)+ tx, err := s.db.BeginTx(ctx, &sql.TxOptions{ReadOnly: true})if err != nil {return nil, FormatError(err)}@@ -366,7 +366,7 @@ func (s *Store) getBackupRawByID(ctx context.Context, id int) (*backupRaw, error// findBackupRaw retrieves a list of backups based on find.func (s *Store) findBackupRaw(ctx context.Context, find *api.BackupFind) ([]*backupRaw, error) {- tx, err := s.db.BeginTx(ctx, nil)+ tx, err := s.db.BeginTx(ctx, &sql.TxOptions{ReadOnly: true})if err != nil {return nil, FormatError(err)}diff --git a/store/bookmark.go b/store/bookmark.goindex ac959348b9..e421055663 100644--- a/store/bookmark.go+++ b/store/bookmark.go@@ -137,7 +137,7 @@ func (s *Store) createBookmarkRaw(ctx context.Context, create *api.BookmarkCreat// findBookmarkRaw retrieves a list of bookmarks based on find.func (s *Store) findBookmarkRaw(ctx context.Context, find *api.BookmarkFind) ([]*bookmarkRaw, error) {- tx, err := s.db.BeginTx(ctx, nil)+ tx, err := s.db.BeginTx(ctx, &sql.TxOptions{ReadOnly: true})if err != nil {return nil, FormatError(err)}@@ -154,7 +154,7 @@ func (s *Store) findBookmarkRaw(ctx context.Context, find *api.BookmarkFind) ([]// getBookmarkRaw retrieves a single bookmark based on find.// Returns ECONFLICT if finding more than 1 matching records.func (s *Store) getBookmarkRaw(ctx context.Context, find *api.BookmarkFind) (*bookmarkRaw, error) {- tx, err := s.db.BeginTx(ctx, nil)+ tx, err := s.db.BeginTx(ctx, &sql.TxOptions{ReadOnly: true})if err != nil {return nil, FormatError(err)}diff --git a/store/data_source.go b/store/data_source.goindex 55bf2b22fd..5560985202 100644--- a/store/data_source.go+++ b/store/data_source.go@@ -228,7 +228,7 @@ func (s *Store) findDataSourceRaw(ctx context.Context, find *api.DataSourceFind)return cacheList, nil}- tx, err := s.db.BeginTx(ctx, nil)+ tx, err := s.db.BeginTx(ctx, &sql.TxOptions{ReadOnly: true})if err != nil {return nil, FormatError(err)}@@ -249,7 +249,7 @@ func (s *Store) findDataSourceRaw(ctx context.Context, find *api.DataSourceFind)// getDataSourceRaw retrieves a single dataSource based on find.// Returns ECONFLICT if finding more than 1 matching records.func (s *Store) getDataSourceRaw(ctx context.Context, find *api.DataSourceFind) (*dataSourceRaw, error) {- tx, err := s.db.BeginTx(ctx, nil)+ tx, err := s.db.BeginTx(ctx, &sql.TxOptions{ReadOnly: true})if err != nil {return nil, FormatError(err)}diff --git a/store/database.go b/store/database.goindex 38b984dbf7..799d9e858b 100644--- a/store/database.go+++ b/store/database.go@@ -296,7 +296,7 @@ func (s *Store) GetDatabaseV2(ctx context.Context, find *FindDatabaseMessage) (*}}- tx, err := s.db.BeginTx(ctx, nil)+ tx, err := s.db.BeginTx(ctx, &sql.TxOptions{ReadOnly: true})if err != nil {return nil, FormatError(err)}@@ -325,7 +325,7 @@ func (s *Store) GetDatabaseV2(ctx context.Context, find *FindDatabaseMessage) (*// ListDatabases lists all databases.func (s *Store) ListDatabases(ctx context.Context, find *FindDatabaseMessage) ([]*DatabaseMessage, error) {- tx, err := s.db.BeginTx(ctx, nil)+ tx, err := s.db.BeginTx(ctx, &sql.TxOptions{ReadOnly: true})if err != nil {return nil, FormatError(err)}diff --git a/store/db_schema.go b/store/db_schema.goindex 750f3d3345..b04e568db9 100644--- a/store/db_schema.go+++ b/store/db_schema.go@@ -27,7 +27,7 @@ func (s *Store) GetDBSchema(ctx context.Context, databaseID int) (*DBSchema, errwhere, args := []string{"1 = 1"}, []interface{}{}where, args = append(where, fmt.Sprintf("database_id = $%d", len(args)+1)), append(args, databaseID)- tx, err := s.db.BeginTx(ctx, nil)+ tx, err := s.db.BeginTx(ctx, &sql.TxOptions{ReadOnly: true})if err != nil {return nil, FormatError(err)}diff --git a/store/deploy.go b/store/deploy.goindex efeb674bf1..873dff7ca7 100644--- a/store/deploy.go+++ b/store/deploy.go@@ -173,7 +173,7 @@ func (s *Store) upsertDeploymentConfigRaw(ctx context.Context, upsert *api.Deplo// getDeploymentConfigImpl finds the deployment configuration in a project.func (s *Store) getDeploymentConfigImpl(ctx context.Context, find *api.DeploymentConfigFind) (*deploymentConfigRaw, error) {- tx, err := s.db.BeginTx(ctx, nil)+ tx, err := s.db.BeginTx(ctx, &sql.TxOptions{ReadOnly: true})if err != nil {return nil, FormatError(err)}diff --git a/store/environment.go b/store/environment.goindex 50e5ba8142..436d820aa8 100644--- a/store/environment.go+++ b/store/environment.go@@ -215,7 +215,7 @@ func (s *Store) GetEnvironmentV2(ctx context.Context, find *FindEnvironmentMessa// We will always return the resource regardless of its deleted state.find.ShowDeleted = true- tx, err := s.db.BeginTx(ctx, nil)+ tx, err := s.db.BeginTx(ctx, &sql.TxOptions{ReadOnly: true})if err != nil {return nil, FormatError(err)}@@ -240,7 +240,7 @@ func (s *Store) GetEnvironmentV2(ctx context.Context, find *FindEnvironmentMessa// ListEnvironmentV2 lists all environment.func (s *Store) ListEnvironmentV2(ctx context.Context, find *FindEnvironmentMessage) ([]*EnvironmentMessage, error) {- tx, err := s.db.BeginTx(ctx, nil)+ tx, err := s.db.BeginTx(ctx, &sql.TxOptions{ReadOnly: true})if err != nil {return nil, FormatError(err)}diff --git a/store/external_approval.go b/store/external_approval.goindex 34aae03739..f35a3ac2a8 100644--- a/store/external_approval.go+++ b/store/external_approval.go@@ -2,6 +2,7 @@ package storeimport ("context"+ "database/sql""fmt""strings"@@ -150,7 +151,7 @@ func (s *Store) createExternalApprovalRaw(ctx context.Context, create *api.Exter}func (s *Store) findExternalApprovalRaw(ctx context.Context, find *api.ExternalApprovalFind) ([]*externalApprovalRaw, error) {- tx, err := s.db.BeginTx(ctx, nil)+ tx, err := s.db.BeginTx(ctx, &sql.TxOptions{ReadOnly: true})if err != nil {return nil, err}diff --git a/store/inbox.go b/store/inbox.goindex 3fa3c51ca5..1516893f68 100644--- a/store/inbox.go+++ b/store/inbox.go@@ -96,7 +96,7 @@ func (s *Store) PatchInbox(ctx context.Context, patch *api.InboxPatch) (*api.Inb// FindInboxSummary returns the inbox summary for a particular principal.func (s *Store) FindInboxSummary(ctx context.Context, principalID int) (*api.InboxSummary, error) {- tx, err := s.db.BeginTx(ctx, nil)+ tx, err := s.db.BeginTx(ctx, &sql.TxOptions{ReadOnly: true})if err != nil {return nil, FormatError(err)}@@ -165,7 +165,7 @@ func (s *Store) createInboxRaw(ctx context.Context, create *api.InboxCreate) (*i// findInboxRaw retrieves a list of inboxes based on find.func (s *Store) findInboxRaw(ctx context.Context, find *api.InboxFind) ([]*inboxRaw, error) {- tx, err := s.db.BeginTx(ctx, nil)+ tx, err := s.db.BeginTx(ctx, &sql.TxOptions{ReadOnly: true})if err != nil {return nil, FormatError(err)}@@ -182,7 +182,7 @@ func (s *Store) findInboxRaw(ctx context.Context, find *api.InboxFind) ([]*inbox// getInboxRawByID retrieves a single inbox based on find.// Returns ECONFLICT if finding more than 1 matching records.func (s *Store) getInboxRawByID(ctx context.Context, find *api.InboxFind) (*inboxRaw, error) {- tx, err := s.db.BeginTx(ctx, nil)+ tx, err := s.db.BeginTx(ctx, &sql.TxOptions{ReadOnly: true})if err != nil {return nil, FormatError(err)}diff --git a/store/instance.go b/store/instance.goindex 5ff5a9395c..9dd7c2f0d0 100644--- a/store/instance.go+++ b/store/instance.go@@ -413,7 +413,7 @@ func (s *Store) createInstanceRaw(ctx context.Context, create *InstanceCreate) (// findInstanceRaw retrieves a list of instances based on find.func (s *Store) findInstanceRaw(ctx context.Context, find *api.InstanceFind) ([]*instanceRaw, error) {- tx, err := s.db.BeginTx(ctx, nil)+ tx, err := s.db.BeginTx(ctx, &sql.TxOptions{ReadOnly: true})if err != nil {return nil, FormatError(err)}@@ -441,7 +441,7 @@ func (s *Store) getInstanceRaw(ctx context.Context, find *api.InstanceFind) (*in}}- tx, err := s.db.BeginTx(ctx, nil)+ tx, err := s.db.BeginTx(ctx, &sql.TxOptions{ReadOnly: true})if err != nil {return nil, FormatError(err)}diff --git a/store/instance_user.go b/store/instance_user.goindex f1e263bc78..1f61ff05dd 100644--- a/store/instance_user.go+++ b/store/instance_user.go@@ -34,7 +34,7 @@ func (s *Store) UpsertInstanceUser(ctx context.Context, upsert *api.InstanceUser// GetInstanceUser gets an instance of IntanceUser.func (s *Store) GetInstanceUser(ctx context.Context, find *api.InstanceUserFind) (*api.InstanceUser, error) {- tx, err := s.db.BeginTx(ctx, nil)+ tx, err := s.db.BeginTx(ctx, &sql.TxOptions{ReadOnly: true})if err != nil {return nil, FormatError(err)}@@ -59,7 +59,7 @@ func (s *Store) FindInstanceUserByInstanceID(ctx context.Context, id int) ([]*apInstanceID: &id,}- tx, err := s.db.BeginTx(ctx, nil)+ tx, err := s.db.BeginTx(ctx, &sql.TxOptions{ReadOnly: true})if err != nil {return nil, FormatError(err)}diff --git a/store/issue.go b/store/issue.goindex a8e5461244..7cc89d7571 100644--- a/store/issue.go+++ b/store/issue.go@@ -536,7 +536,7 @@ func (s *Store) createIssueRaw(ctx context.Context, create *api.IssueCreate) (*i// findIssueRaw retrieves a list of issues based on find.func (s *Store) findIssueRaw(ctx context.Context, find *api.IssueFind) ([]*issueRaw, error) {- tx, err := s.db.BeginTx(ctx, nil)+ tx, err := s.db.BeginTx(ctx, &sql.TxOptions{ReadOnly: true})if err != nil {return nil, FormatError(err)}@@ -561,7 +561,7 @@ func (s *Store) findIssueRaw(ctx context.Context, find *api.IssueFind) ([]*issue// getIssueRaw retrieves a single issue based on find.// Returns ECONFLICT if finding more than 1 matching records.func (s *Store) getIssueRaw(ctx context.Context, find *api.IssueFind) (*issueRaw, error) {- tx, err := s.db.BeginTx(ctx, nil)+ tx, err := s.db.BeginTx(ctx, &sql.TxOptions{ReadOnly: true})if err != nil {return nil, FormatError(err)}diff --git a/store/issue_subscriber.go b/store/issue_subscriber.goindex 85a0fa3028..9cfc16f2d0 100644--- a/store/issue_subscriber.go+++ b/store/issue_subscriber.go@@ -115,7 +115,7 @@ func (s *Store) createIssueSubscriberRaw(ctx context.Context, create *api.IssueS// findIssueSubscriberRaw retrieves a list of issueSubscribers based on find.func (s *Store) findIssueSubscriberRaw(ctx context.Context, find *api.IssueSubscriberFind) ([]*issueSubscriberRaw, error) {- tx, err := s.db.BeginTx(ctx, nil)+ tx, err := s.db.BeginTx(ctx, &sql.TxOptions{ReadOnly: true})if err != nil {return nil, FormatError(err)}diff --git a/store/member.go b/store/member.goindex 6f69360f4f..9352c7ee13 100644--- a/store/member.go+++ b/store/member.go@@ -191,7 +191,7 @@ func (s *Store) createMemberRaw(ctx context.Context, create *api.MemberCreate) (// findMemberRaw retrieves a list of memberRaw instances.func (s *Store) findMemberRaw(ctx context.Context, find *api.MemberFind) ([]*memberRaw, error) {- tx, err := s.db.BeginTx(ctx, nil)+ tx, err := s.db.BeginTx(ctx, &sql.TxOptions{ReadOnly: true})if err != nil {return nil, FormatError(err)}@@ -225,7 +225,7 @@ func (s *Store) getMemberRaw(ctx context.Context, find *api.MemberFind) (*member}}- tx, err := s.db.BeginTx(ctx, nil)+ tx, err := s.db.BeginTx(ctx, &sql.TxOptions{ReadOnly: true})if err != nil {return nil, FormatError(err)}diff --git a/store/pipeline.go b/store/pipeline.goindex 0325b52be0..c452902240 100644--- a/store/pipeline.go+++ b/store/pipeline.go@@ -170,7 +170,7 @@ func (s *Store) createPipelineRaw(ctx context.Context, create *api.PipelineCreat// findPipelineRaw retrieves a list of pipelines based on find.func (s *Store) findPipelineRaw(ctx context.Context, find *api.PipelineFind) ([]*pipelineRaw, error) {- tx, err := s.db.BeginTx(ctx, nil)+ tx, err := s.db.BeginTx(ctx, &sql.TxOptions{ReadOnly: true})if err != nil {return nil, FormatError(err)}@@ -206,7 +206,7 @@ func (s *Store) getPipelineRaw(ctx context.Context, find *api.PipelineFind) (*pi}}- tx, err := s.db.BeginTx(ctx, nil)+ tx, err := s.db.BeginTx(ctx, &sql.TxOptions{ReadOnly: true})if err != nil {return nil, FormatError(err)}diff --git a/store/policy.go b/store/policy.goindex b0a07d28c4..23b9e4b0ac 100644--- a/store/policy.go+++ b/store/policy.go@@ -308,7 +308,7 @@ func (s *Store) composePolicy(ctx context.Context, raw *policyRaw) (*api.Policy,// getPolicyRaw finds the policy for an environment.// Returns ECONFLICT if finding more than 1 matching records.func (s *Store) getPolicyRaw(ctx context.Context, find *api.PolicyFind) (*policyRaw, error) {- tx, err := s.db.BeginTx(ctx, nil)+ tx, err := s.db.BeginTx(ctx, &sql.TxOptions{ReadOnly: true})if err != nil {return nil, FormatError(err)}diff --git a/store/principal.go b/store/principal.goindex 63ff865540..73d6318604 100644--- a/store/principal.go+++ b/store/principal.go@@ -164,7 +164,7 @@ func (s *Store) createPrincipalRaw(ctx context.Context, create *api.PrincipalCre// findPrincipalRawList retrieves a list of principalRaw instances.func (s *Store) findPrincipalRawList(ctx context.Context) ([]*principalRaw, error) {- tx, err := s.db.BeginTx(ctx, nil)+ tx, err := s.db.BeginTx(ctx, &sql.TxOptions{ReadOnly: true})if err != nil {return nil, FormatError(err)}@@ -198,7 +198,7 @@ func (s *Store) getPrincipalRaw(ctx context.Context, find *api.PrincipalFind) (*}}- tx, err := s.db.BeginTx(ctx, nil)+ tx, err := s.db.BeginTx(ctx, &sql.TxOptions{ReadOnly: true})if err != nil {return nil, FormatError(err)}diff --git a/store/project.go b/store/project.goindex 68ac334773..62c13ac8c3 100644--- a/store/project.go+++ b/store/project.go@@ -243,7 +243,7 @@ func (s *Store) GetProjectV2(ctx context.Context, find *FindProjectMessage) (*Pr// We will always return the resource regardless of its deleted state.find.ShowDeleted = true- tx, err := s.db.BeginTx(ctx, nil)+ tx, err := s.db.BeginTx(ctx, &sql.TxOptions{ReadOnly: true})if err != nil {return nil, FormatError(err)}@@ -272,7 +272,7 @@ func (s *Store) GetProjectV2(ctx context.Context, find *FindProjectMessage) (*Pr// ListProjectV2 lists all projects.func (s *Store) ListProjectV2(ctx context.Context, find *FindProjectMessage) ([]*ProjectMessage, error) {- tx, err := s.db.BeginTx(ctx, nil)+ tx, err := s.db.BeginTx(ctx, &sql.TxOptions{ReadOnly: true})if err != nil {return nil, FormatError(err)}diff --git a/store/project_member.go b/store/project_member.goindex efcd49099f..31eecbcb23 100644--- a/store/project_member.go+++ b/store/project_member.go@@ -246,7 +246,7 @@ func (s *Store) createProjectMemberRaw(ctx context.Context, create *api.ProjectM// findProjectMemberRaw retrieves a list of projectMembers based on find.func (s *Store) findProjectMemberRaw(ctx context.Context, find *api.ProjectMemberFind) ([]*projectMemberRaw, error) {- tx, err := s.db.BeginTx(ctx, nil)+ tx, err := s.db.BeginTx(ctx, &sql.TxOptions{ReadOnly: true})if err != nil {return nil, FormatError(err)}@@ -262,7 +262,7 @@ func (s *Store) findProjectMemberRaw(ctx context.Context, find *api.ProjectMembe// getProjectMemberRaw finds project members.func (s *Store) getProjectMemberRaw(ctx context.Context, find *api.ProjectMemberFind) (*projectMemberRaw, error) {- tx, err := s.db.BeginTx(ctx, nil)+ tx, err := s.db.BeginTx(ctx, &sql.TxOptions{ReadOnly: true})if err != nil {return nil, FormatError(err)}diff --git a/store/project_webhook.go b/store/project_webhook.goindex 114bb6bbd2..3ca3ad1793 100644--- a/store/project_webhook.go+++ b/store/project_webhook.go@@ -181,7 +181,7 @@ func (s *Store) createProjectWebhookRaw(ctx context.Context, create *api.Project// findProjectWebhookRaw retrieves a list of projectWebhooks based on find.func (s *Store) findProjectWebhookRaw(ctx context.Context, find *api.ProjectWebhookFind) ([]*projectWebhookRaw, error) {- tx, err := s.db.BeginTx(ctx, nil)+ tx, err := s.db.BeginTx(ctx, &sql.TxOptions{ReadOnly: true})if err != nil {return nil, FormatError(err)}@@ -198,7 +198,7 @@ func (s *Store) findProjectWebhookRaw(ctx context.Context, find *api.ProjectWebh// getProjectWebhookRaw retrieves a single projectWebhook based on find.// Returns ECONFLICT if finding more than 1 matching records.func (s *Store) getProjectWebhookRaw(ctx context.Context, find *api.ProjectWebhookFind) (*projectWebhookRaw, error) {- tx, err := s.db.BeginTx(ctx, nil)+ tx, err := s.db.BeginTx(ctx, &sql.TxOptions{ReadOnly: true})if err != nil {return nil, FormatError(err)}diff --git a/store/repository.go b/store/repository.goindex a93c71a88b..f6b600c468 100644--- a/store/repository.go+++ b/store/repository.go@@ -219,7 +219,7 @@ func (s *Store) createRepositoryRaw(ctx context.Context, create *api.RepositoryC// findRepositoryRaw retrieves a list of repositories based on find.func (s *Store) findRepositoryRaw(ctx context.Context, find *api.RepositoryFind) ([]*repositoryRaw, error) {- tx, err := s.db.BeginTx(ctx, nil)+ tx, err := s.db.BeginTx(ctx, &sql.TxOptions{ReadOnly: true})if err != nil {return nil, FormatError(err)}@@ -236,7 +236,7 @@ func (s *Store) findRepositoryRaw(ctx context.Context, find *api.RepositoryFind)// getRepositoryRaw retrieves a single repository based on find.// Returns ECONFLICT if finding more than 1 matching records.func (s *Store) getRepositoryRaw(ctx context.Context, find *api.RepositoryFind) (*repositoryRaw, error) {- tx, err := s.db.BeginTx(ctx, nil)+ tx, err := s.db.BeginTx(ctx, &sql.TxOptions{ReadOnly: true})if err != nil {return nil, FormatError(err)}diff --git a/store/setting.go b/store/setting.goindex 416f39e147..5e68e71064 100644--- a/store/setting.go+++ b/store/setting.go@@ -164,7 +164,7 @@ func (s *Store) createSettingRawIfNotExist(ctx context.Context, create *api.Sett// findSettingRaw retrieves a list of settings based on find.func (s *Store) findSettingRaw(ctx context.Context, find *api.SettingFind) ([]*settingRaw, error) {- tx, err := s.db.BeginTx(ctx, nil)+ tx, err := s.db.BeginTx(ctx, &sql.TxOptions{ReadOnly: true})if err != nil {return nil, FormatError(err)}@@ -180,7 +180,7 @@ func (s *Store) findSettingRaw(ctx context.Context, find *api.SettingFind) ([]*s// getSettingRaw retrieves a single setting based on find.// Returns ECONFLICT if finding more than 1 matching records.func (s *Store) getSettingRaw(ctx context.Context, find *api.SettingFind) (*settingRaw, error) {- tx, err := s.db.BeginTx(ctx, nil)+ tx, err := s.db.BeginTx(ctx, &sql.TxOptions{ReadOnly: true})if err != nil {return nil, FormatError(err)}diff --git a/store/sheet.go b/store/sheet.goindex 48d3ac28ae..c5989203b6 100644--- a/store/sheet.go+++ b/store/sheet.go@@ -280,7 +280,7 @@ func (s *Store) patchSheetRaw(ctx context.Context, patch *api.SheetPatch) (*shee// findSheetRaw retrieves a list of sheet based on find.func (s *Store) findSheetRaw(ctx context.Context, find *api.SheetFind) ([]*sheetRaw, error) {- tx, err := s.db.BeginTx(ctx, nil)+ tx, err := s.db.BeginTx(ctx, &sql.TxOptions{ReadOnly: true})if err != nil {return nil, FormatError(err)}@@ -297,7 +297,7 @@ func (s *Store) findSheetRaw(ctx context.Context, find *api.SheetFind) ([]*sheet// getSheetRaw retrieves a single sheet based on find.// Returns ECONFLICT if finding more than 1 matching records.func (s *Store) getSheetRaw(ctx context.Context, find *api.SheetFind) (*sheetRaw, error) {- tx, err := s.db.BeginTx(ctx, nil)+ tx, err := s.db.BeginTx(ctx, &sql.TxOptions{ReadOnly: true})if err != nil {return nil, FormatError(err)}diff --git a/store/sheet_organizer.go b/store/sheet_organizer.goindex d11961c6e1..f0e138b4db 100644--- a/store/sheet_organizer.go+++ b/store/sheet_organizer.go@@ -58,7 +58,7 @@ func (s *Store) UpsertSheetOrganizer(ctx context.Context, upsert *api.SheetOrgan// FindSheetOrganizer retrieves a SheetOrganizer.func (s *Store) FindSheetOrganizer(ctx context.Context, find *api.SheetOrganizerFind) (*api.SheetOrganizer, error) {- tx, err := s.db.BeginTx(ctx, nil)+ tx, err := s.db.BeginTx(ctx, &sql.TxOptions{ReadOnly: true})if err != nil {return nil, FormatError(err)}diff --git a/store/stage.go b/store/stage.goindex 0df53e4143..12f4a147ea 100644--- a/store/stage.go+++ b/store/stage.go@@ -2,6 +2,7 @@ package storeimport ("context"+ "database/sql""fmt""strings"@@ -145,7 +146,7 @@ func (s *Store) createStageRaw(ctx context.Context, creates []*api.StageCreate)// findStageRaw retrieves a list of stages based on find.func (s *Store) findStageRaw(ctx context.Context, find *api.StageFind) ([]*stageRaw, error) {- tx, err := s.db.BeginTx(ctx, nil)+ tx, err := s.db.BeginTx(ctx, &sql.TxOptions{ReadOnly: true})if err != nil {return nil, FormatError(err)}diff --git a/store/task.go b/store/task.goindex 627f4ef0ef..771829f262 100644--- a/store/task.go+++ b/store/task.go@@ -375,7 +375,7 @@ func (s *Store) createTaskRaw(ctx context.Context, create *api.TaskCreate) (*tas// findTaskRaw retrieves a list of tasks based on find.func (s *Store) findTaskRaw(ctx context.Context, find *api.TaskFind) ([]*taskRaw, error) {- tx, err := s.db.BeginTx(ctx, nil)+ tx, err := s.db.BeginTx(ctx, &sql.TxOptions{ReadOnly: true})if err != nil {return nil, FormatError(err)}@@ -392,7 +392,7 @@ func (s *Store) findTaskRaw(ctx context.Context, find *api.TaskFind) ([]*taskRaw// getTaskRaw retrieves a single task based on find.// Returns ECONFLICT if finding more than 1 matching records.func (s *Store) getTaskRaw(ctx context.Context, find *api.TaskFind) (*taskRaw, error) {- tx, err := s.db.BeginTx(ctx, nil)+ tx, err := s.db.BeginTx(ctx, &sql.TxOptions{ReadOnly: true})if err != nil {return nil, FormatError(err)}diff --git a/store/task_check_run.go b/store/task_check_run.goindex 7a51f478f7..47aa48bf8b 100644--- a/store/task_check_run.go+++ b/store/task_check_run.go@@ -286,7 +286,7 @@ func (*Store) createTaskCheckRunImpl(ctx context.Context, tx *Tx, creates ...*ap// findTaskCheckRunRaw retrieves a list of taskCheckRuns based on find.func (s *Store) findTaskCheckRunRaw(ctx context.Context, find *api.TaskCheckRunFind) ([]*taskCheckRunRaw, error) {- tx, err := s.db.BeginTx(ctx, nil)+ tx, err := s.db.BeginTx(ctx, &sql.TxOptions{ReadOnly: true})if err != nil {return nil, FormatError(err)}@@ -378,7 +378,7 @@ func (*Store) patchTaskCheckRunStatusImpl(ctx context.Context, tx *Tx, patch *ap}func (s *Store) listTaskCheckRun(ctx context.Context, find *api.TaskCheckRunFind) ([]*taskCheckRunRaw, error) {- tx, err := s.db.BeginTx(ctx, nil)+ tx, err := s.db.BeginTx(ctx, &sql.TxOptions{ReadOnly: true})if err != nil {return nil, FormatError(err)}diff --git a/store/task_dag.go b/store/task_dag.goindex 5da9f06c18..3ed062041b 100644--- a/store/task_dag.go+++ b/store/task_dag.go@@ -89,7 +89,7 @@ func (s *Store) createTaskDAGRaw(ctx context.Context, create *api.TaskDAGCreate)}func (s *Store) findTaskDAGRawList(ctx context.Context, find *api.TaskDAGFind) ([]*taskDAGRaw, error) {- tx, err := s.db.BeginTx(ctx, nil)+ tx, err := s.db.BeginTx(ctx, &sql.TxOptions{ReadOnly: true})if err != nil {return nil, FormatError(err)}diff --git a/store/task_run.go b/store/task_run.goindex 4a31c9db34..a0c34c4062 100644--- a/store/task_run.go+++ b/store/task_run.go@@ -186,7 +186,7 @@ func (*Store) patchTaskRunStatusImpl(ctx context.Context, tx *Tx, patch *api.Tas}func (s *Store) listTaskRun(ctx context.Context, find *api.TaskRunFind) ([]*taskRunRaw, error) {- tx, err := s.db.BeginTx(ctx, nil)+ tx, err := s.db.BeginTx(ctx, &sql.TxOptions{ReadOnly: true})if err != nil {return nil, FormatError(err)}diff --git a/store/vcs.go b/store/vcs.goindex 48877bd89b..e786b71d08 100644--- a/store/vcs.go+++ b/store/vcs.go@@ -165,7 +165,7 @@ func (s *Store) createVCSRaw(ctx context.Context, create *api.VCSCreate) (*vcsRa// findVCSRaw retrieves a list of VCSs based on find conditions.func (s *Store) findVCSRaw(ctx context.Context, find *api.VCSFind) ([]*vcsRaw, error) {- tx, err := s.db.BeginTx(ctx, nil)+ tx, err := s.db.BeginTx(ctx, &sql.TxOptions{ReadOnly: true})if err != nil {return nil, FormatError(err)}@@ -182,7 +182,7 @@ func (s *Store) findVCSRaw(ctx context.Context, find *api.VCSFind) ([]*vcsRaw, e// getVCSRaw retrieves a single vcs based on find.// Returns ECONFLICT if finding more than 1 matching records.func (s *Store) getVCSRaw(ctx context.Context, id int) (*vcsRaw, error) {- tx, err := s.db.BeginTx(ctx, nil)+ tx, err := s.db.BeginTx(ctx, &sql.TxOptions{ReadOnly: true})if err != nil {return nil, FormatError(err)}