app_instance.go 1.3 KB

12345678910111213141516171819202122232425262728293031
  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" gorm:"uniqueIndex:idx_name_deployment_target"`
  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:"uniqueIndex:idx_name_deployment_target;type:uuid"`
  24. // PorterYamlPath is the path to the porter.yaml file in the git repo
  25. PorterYamlPath string
  26. }