Skip to content

Commit 7ae5566

Browse files
feat: rename app deploy status live to deployed (#877) (#878)
(cherry picked from commit 47106ca) Co-authored-by: Tanmoy Sarkar <[email protected]>
1 parent fa0b6cd commit 7ae5566

11 files changed

+23
-17
lines changed

swiftwave_service/core/application.operations.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ type ApplicationDeploymentInfo struct {
6464

6565
func FindApplicationsForForceUpdate(_ context.Context, db gorm.DB) ([]*ApplicationDeploymentInfo, error) {
6666
var deployments []*Deployment
67-
err := db.Model(&Deployment{}).Where("status = ?", DeploymentStatusLive).Scan(&deployments).Error
67+
err := db.Model(&Deployment{}).Where("status = ?", DeploymentStatusDeployed).Scan(&deployments).Error
6868
if err != nil {
6969
return nil, err
7070
}
@@ -617,7 +617,7 @@ func (application *Application) Update(ctx context.Context, db gorm.DB, _ contai
617617
isReloadRequired = true
618618
}
619619
// update deployment -- if required
620-
currentDeploymentID, err := FindCurrentLiveDeploymentIDByApplicationId(ctx, db, application.ID)
620+
currentDeploymentID, err := FindCurrentDeployedDeploymentIDByApplicationId(ctx, db, application.ID)
621621
if err != nil {
622622
currentDeploymentID, err = FindLatestDeploymentIDByApplicationId(ctx, db, application.ID)
623623
}
@@ -694,7 +694,7 @@ func (application *Application) RebuildApplication(ctx context.Context, db gorm.
694694
return "", err
695695
}
696696
// create a new deployment from latest deployment
697-
latestDeployment, err := FindCurrentLiveDeploymentByApplicationId(ctx, db, application.ID)
697+
latestDeployment, err := FindCurrentDeployedDeploymentByApplicationId(ctx, db, application.ID)
698698
if err != nil {
699699
latestDeployment, err = FindLatestDeploymentByApplicationId(ctx, db, application.ID)
700700
if err != nil {

swiftwave_service/core/deployment.operations.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ func FindLatestDeploymentByApplicationId(ctx context.Context, db gorm.DB, id str
2424
return deployment, nil
2525
}
2626

27-
func FindCurrentLiveDeploymentByApplicationId(ctx context.Context, db gorm.DB, id string) (*Deployment, error) {
27+
func FindCurrentDeployedDeploymentByApplicationId(ctx context.Context, db gorm.DB, id string) (*Deployment, error) {
2828
var deployment = &Deployment{}
29-
tx := db.Where("application_id = ? AND status = ?", id, DeploymentStatusLive).Order("created_at desc").First(&deployment)
29+
tx := db.Where("application_id = ? AND status = ?", id, DeploymentStatusDeployed).Order("created_at desc").First(&deployment)
3030
if tx.Error != nil {
3131
return nil, tx.Error
3232
}
@@ -42,9 +42,9 @@ func FindLatestDeploymentIDByApplicationId(ctx context.Context, db gorm.DB, id s
4242
return deployment.ID, nil
4343
}
4444

45-
func FindCurrentLiveDeploymentIDByApplicationId(ctx context.Context, db gorm.DB, id string) (string, error) {
45+
func FindCurrentDeployedDeploymentIDByApplicationId(ctx context.Context, db gorm.DB, id string) (string, error) {
4646
var deployment = &Deployment{}
47-
tx := db.Select("id").Where("application_id = ? AND status = ?", id, DeploymentStatusLive).Order("created_at desc").First(&deployment)
47+
tx := db.Select("id").Where("application_id = ? AND status = ?", id, DeploymentStatusDeployed).Order("created_at desc").First(&deployment)
4848
if tx.Error != nil {
4949
return "", tx.Error
5050
}

swiftwave_service/core/types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ type DeploymentStatus string
8282
const (
8383
DeploymentStatusPending DeploymentStatus = "pending"
8484
DeploymentStatusDeployPending DeploymentStatus = "deployPending"
85-
DeploymentStatusLive DeploymentStatus = "live"
85+
DeploymentStatusDeployed DeploymentStatus = "deployed"
8686
DeploymentStatusStopped DeploymentStatus = "stopped"
8787
DeploymentStatusFailed DeploymentStatus = "failed"
8888
DeploymentStalled DeploymentStatus = "stalled"
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
-- reverse: modify "deployments" table
2+
UPDATE "public"."deployments" SET status = 'live' WHERE status = 'deployed';
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
-- modify "deployments" table
2+
UPDATE "public"."deployments" SET status = 'deployed' WHERE status = 'live';

swiftwave_service/db/migrations/atlas.sum

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
h1:MBKMEy89E8d/dJ6qPEDgVvyviAQkEIIZ2wIVMUmbgqg=
1+
h1:b432hkpq37nDG1czxt21T1S/temPuIUoQ3fyuehkN+M=
22
20240413191732_init.down.sql h1:HoitObGwuKF/akF4qg3dol2FfNTLCEuf6wHYDuCez8I=
33
20240413191732_init.up.sql h1:USKdQx/yTz1KJ0+mDwYGhKm3WzX7k+I9+6B6SxImwaE=
44
20240414051823_server_custom_ssh_port_added.down.sql h1:IC1DFQBQceTPTRdZOo5/WqytH+ZbgcKrQuMCkhArF/0=
@@ -39,3 +39,5 @@ h1:MBKMEy89E8d/dJ6qPEDgVvyviAQkEIIZ2wIVMUmbgqg=
3939
20240620100729_add_app_custom_healthcheck.up.sql h1:kgZY1IBSRF3OXwoAdleIKVtcnbj+AT/f6K8AR1s/7yg=
4040
20240624161343_add_commit_msg_to_deployment.down.sql h1:tSOS19XmAJvwaAwpbIppYfi5PvRQ2HWz1Go2JGlWNP8=
4141
20240624161343_add_commit_msg_to_deployment.up.sql h1:JrOb5F2VQkKNAQygCCvy2WEK4u80xsbWWty+bVlNM2w=
42+
20250624161343_rename_app_status_live_to_deployed.down.sql h1:eBRrKO112ul0fqIibuE71ASQFoFQZixRN8qGp9V/RsI=
43+
20250624161343_rename_app_status_live_to_deployed.up.sql h1:4/ngjaqebN9HiQSGmKyy0B5vYtLeyRkdYS0Yu2QUSRM=

swiftwave_service/graphql/application.resolvers.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

swiftwave_service/graphql/model/models_gen.go

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

swiftwave_service/graphql/schema/deployment.graphqls

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ enum DeploymentStatus {
88
pending
99
deployPending
1010
deploying
11-
live
11+
deployed
1212
stopped
1313
failed
1414
stalled

swiftwave_service/rest/webhook.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func (server *Server) redeployApp(c echo.Context) error {
3636
return c.String(401, "Unauthorized")
3737
}
3838
// Fetch latest deployment
39-
deployment, err := core.FindCurrentLiveDeploymentByApplicationId(ctx, server.ServiceManager.DbClient, application.ID)
39+
deployment, err := core.FindCurrentDeployedDeploymentByApplicationId(ctx, server.ServiceManager.DbClient, application.ID)
4040
if err != nil {
4141
_, err = core.FindLatestDeploymentByApplicationId(ctx, server.ServiceManager.DbClient, application.ID)
4242
if errors.Is(err, gorm.ErrRecordNotFound) {

0 commit comments

Comments
 (0)