app_instance.go 1.3 KB

123456789101112131415161718192021222324252627282930
  1. package models
  2. import (
  3. "time"
  4. "github.com/google/uuid"
  5. "gorm.io/gorm"
  6. )
  7. // AppInstance extends gorm.Model to represent an instance of an app (source information + deployment target)
  8. type AppInstance struct {
  9. gorm.Model
  10. // ID is a unique identifier for a given app instance
  11. ID uuid.UUID `gorm:"type:uuid;primaryKey" json:"id"`
  12. // Name is the name of the app instance. This is unique across a given deployment target
  13. Name string `json:"name"`
  14. // ProjectID is the ID of the project that the app instance belongs to
  15. ProjectID uint `json:"project_id"`
  16. // CreatedAt is the time (UTC) that a given app instance was created. This should not change
  17. CreatedAt time.Time `json:"created_at"`
  18. // UpdatedAt is the time (UTC) that an app instance was last updated.
  19. UpdatedAt time.Time `json:"updated_at"`
  20. // PorterAppID is the ID of the app (source information) that the given app instance relates to
  21. PorterAppID uint `json:"porter_app_id"`
  22. // DeploymentTargetID is the ID of the deployment target that the event relates to
  23. DeploymentTargetID uuid.UUID `json:"deployment_target_id" gorm:"type:uuid"`
  24. // IsRequiredApp indicates whether this instance of an app was listed as a requirement of another app in the deployment target
  25. IsRequiredApp bool `json:"is_required_app" gorm:"default:false"`
  26. }