mirror of https://github.com/harness/drone.git
feat: [CDE-358]: Adding has_git_changes field to gitspace instance db and API. (#2768)
* feat: [CDE-358]: Removing redundant field tracked_changes. * feat: [CDE-358]: Adding has_git_changes field to gitspace instance db and API.pull/3571/head
parent
138cebe6d4
commit
1560f5de97
|
@ -47,14 +47,14 @@ const (
|
|||
gits_updated,
|
||||
gits_last_used,
|
||||
gits_total_time_used,
|
||||
gits_tracked_changes,
|
||||
gits_access_type,
|
||||
gits_machine_user,
|
||||
gits_uid,
|
||||
gits_access_key_ref,
|
||||
gits_last_heartbeat,
|
||||
gits_active_time_started,
|
||||
gits_active_time_ended`
|
||||
gits_active_time_ended,
|
||||
gits_has_git_changes`
|
||||
gitspaceInstanceSelectColumns = "gits_id," + gitspaceInstanceInsertColumns
|
||||
gitspaceInstanceTable = `gitspaces`
|
||||
)
|
||||
|
@ -70,7 +70,6 @@ type gitspaceInstance struct {
|
|||
SpaceID int64 `db:"gits_space_id"`
|
||||
LastUsed null.Int `db:"gits_last_used"`
|
||||
TotalTimeUsed int64 `db:"gits_total_time_used"`
|
||||
TrackedChanges null.String `db:"gits_tracked_changes"`
|
||||
AccessType enum.GitspaceAccessType `db:"gits_access_type"`
|
||||
AccessKeyRef null.String `db:"gits_access_key_ref"`
|
||||
MachineUser null.String `db:"gits_machine_user"`
|
||||
|
@ -80,6 +79,7 @@ type gitspaceInstance struct {
|
|||
LastHeartbeat null.Int `db:"gits_last_heartbeat"`
|
||||
ActiveTimeStarted null.Int `db:"gits_active_time_started"`
|
||||
ActiveTimeEnded null.Int `db:"gits_active_time_ended"`
|
||||
HasGitChanges null.Bool `db:"gits_has_git_changes"`
|
||||
}
|
||||
|
||||
// NewGitspaceInstanceStore returns a new GitspaceInstanceStore.
|
||||
|
@ -205,7 +205,6 @@ func (g gitspaceInstanceStore) Create(ctx context.Context, gitspaceInstance *typ
|
|||
gitspaceInstance.Updated,
|
||||
gitspaceInstance.LastUsed,
|
||||
gitspaceInstance.TotalTimeUsed,
|
||||
gitspaceInstance.TrackedChanges,
|
||||
gitspaceInstance.AccessType,
|
||||
gitspaceInstance.MachineUser,
|
||||
gitspaceInstance.Identifier,
|
||||
|
@ -213,6 +212,7 @@ func (g gitspaceInstanceStore) Create(ctx context.Context, gitspaceInstance *typ
|
|||
gitspaceInstance.LastHeartbeat,
|
||||
gitspaceInstance.ActiveTimeStarted,
|
||||
gitspaceInstance.ActiveTimeEnded,
|
||||
gitspaceInstance.HasGitChanges,
|
||||
).
|
||||
Suffix(ReturningClause + "gits_id")
|
||||
sql, args, err := stmt.ToSql()
|
||||
|
@ -241,6 +241,7 @@ func (g gitspaceInstanceStore) Update(
|
|||
Set("gits_active_time_started", gitspaceInstance.ActiveTimeStarted).
|
||||
Set("gits_active_time_ended", gitspaceInstance.ActiveTimeEnded).
|
||||
Set("gits_total_time_used", gitspaceInstance.TotalTimeUsed).
|
||||
Set("gits_has_git_changes", gitspaceInstance.HasGitChanges).
|
||||
Set("gits_updated", gitspaceInstance.Updated).
|
||||
Where("gits_id = ?", gitspaceInstance.ID)
|
||||
sql, args, err := stmt.ToSql()
|
||||
|
@ -376,7 +377,6 @@ func (g gitspaceInstanceStore) mapToGitspaceInstance(
|
|||
ResourceUsage: in.ResourceUsage.Ptr(),
|
||||
LastUsed: in.LastUsed.Ptr(),
|
||||
TotalTimeUsed: in.TotalTimeUsed,
|
||||
TrackedChanges: in.TrackedChanges.Ptr(),
|
||||
AccessType: in.AccessType,
|
||||
AccessKeyRef: in.AccessKeyRef.Ptr(),
|
||||
MachineUser: in.MachineUser.Ptr(),
|
||||
|
@ -386,6 +386,7 @@ func (g gitspaceInstanceStore) mapToGitspaceInstance(
|
|||
LastHeartbeat: in.LastHeartbeat.Ptr(),
|
||||
ActiveTimeEnded: in.ActiveTimeEnded.Ptr(),
|
||||
ActiveTimeStarted: in.ActiveTimeStarted.Ptr(),
|
||||
HasGitChanges: in.HasGitChanges.Ptr(),
|
||||
}
|
||||
return res, nil
|
||||
}
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
ALTER TABLE gitspaces DROP COLUMN gits_has_git_changes;
|
||||
ALTER TABLE gitspaces ADD COLUMN gits_tracked_changes TEXT;
|
|
@ -0,0 +1,2 @@
|
|||
ALTER TABLE gitspaces ADD COLUMN gits_has_git_changes BOOLEAN;
|
||||
ALTER TABLE gitspaces DROP COLUMN gits_tracked_changes;
|
|
@ -0,0 +1,2 @@
|
|||
ALTER TABLE gitspaces DROP COLUMN gits_has_git_changes;
|
||||
ALTER TABLE gitspaces ADD COLUMN gits_tracked_changes TEXT;
|
|
@ -0,0 +1,2 @@
|
|||
ALTER TABLE gitspaces ADD COLUMN gits_has_git_changes BOOLEAN;
|
||||
ALTER TABLE gitspaces DROP COLUMN gits_tracked_changes;
|
|
@ -64,7 +64,6 @@ type GitspaceInstance struct {
|
|||
ResourceUsage *string `json:"resource_usage"`
|
||||
LastUsed *int64 `json:"last_used,omitempty"`
|
||||
TotalTimeUsed int64 `json:"total_time_used"`
|
||||
TrackedChanges *string `json:"tracked_changes"`
|
||||
AccessKey *string `json:"access_key,omitempty"`
|
||||
AccessType enum.GitspaceAccessType `json:"access_type"`
|
||||
AccessKeyRef *string `json:"access_key_ref"`
|
||||
|
@ -76,6 +75,7 @@ type GitspaceInstance struct {
|
|||
LastHeartbeat *int64 `json:"last_heartbeat,omitempty"`
|
||||
ActiveTimeStarted *int64 `json:"active_time_started,omitempty"`
|
||||
ActiveTimeEnded *int64 `json:"active_time_ended,omitempty"`
|
||||
HasGitChanges *bool `json:"has_git_changes,omitempty"`
|
||||
}
|
||||
|
||||
type GitspaceFilter struct {
|
||||
|
|
Loading…
Reference in New Issue