Skip to content

Commit

Permalink
improve: lengthen contest team name
Browse files Browse the repository at this point in the history
  • Loading branch information
Tennessine699 committed Aug 26, 2024
1 parent 33c77a8 commit 2bdbd61
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
19 changes: 18 additions & 1 deletion internal/infrastructure/migration/v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func v2() *gormigrate.Migration {
return &gormigrate.Migration{
ID: "2",
Migrate: func(db *gorm.DB) error {
if err := db.AutoMigrate(&v2Project{}, &v2Contest{}); err != nil {
if err := db.AutoMigrate(&v2Project{}, &v2Contest{}, &v2ContestTeam{}); err != nil {
return err

Check warning on line 20 in internal/infrastructure/migration/v2.go

View check run for this annotation

Codecov / codecov/patch

internal/infrastructure/migration/v2.go#L19-L20

Added lines #L19 - L20 were not covered by tests
}

Expand Down Expand Up @@ -148,3 +148,20 @@ type v2Contest struct {
func (*v2Contest) TableName() string {
return "contests"

Check warning on line 149 in internal/infrastructure/migration/v2.go

View check run for this annotation

Codecov / codecov/patch

internal/infrastructure/migration/v2.go#L148-L149

Added lines #L148 - L149 were not covered by tests
}

type v2ContestTeam struct {
ID uuid.UUID `gorm:"type:char(36);not null;primaryKey"`
ContestID uuid.UUID `gorm:"type:char(36);not null"`
Name string `gorm:"type:varchar(128)"`
Description string `gorm:"type:text"`
Result string `gorm:"type:text"`
Link string `gorm:"type:text"`
CreatedAt time.Time `gorm:"precision:6"`
UpdatedAt time.Time `gorm:"precision:6"`

Contest model.Contest `gorm:"foreignKey:ContestID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"`
}

func (*v2ContestTeam) TableName() string {
return "contest_teams"

Check warning on line 166 in internal/infrastructure/migration/v2.go

View check run for this annotation

Codecov / codecov/patch

internal/infrastructure/migration/v2.go#L165-L166

Added lines #L165 - L166 were not covered by tests
}
2 changes: 1 addition & 1 deletion internal/infrastructure/repository/model/contests.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func (*Contest) TableName() string {
type ContestTeam struct {
ID uuid.UUID `gorm:"type:char(36);not null;primaryKey"`
ContestID uuid.UUID `gorm:"type:char(36);not null"`
Name string `gorm:"type:varchar(32)"`
Name string `gorm:"type:varchar(128)"`
Description string `gorm:"type:text"`
Result string `gorm:"type:text"`
Link string `gorm:"type:text"`
Expand Down

0 comments on commit 2bdbd61

Please sign in to comment.