Skip to content

Commit

Permalink
fix init table
Browse files Browse the repository at this point in the history
  • Loading branch information
bxy4543 committed Oct 8, 2024
1 parent 8a26d3f commit 2b6fb9e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion controllers/pkg/database/cockroach/accountv2.go
Original file line number Diff line number Diff line change
Expand Up @@ -1183,7 +1183,8 @@ func (c *Cockroach) InitTables() error {
// return fmt.Errorf("failed to add column activityType: %v", err)
//}
fmt.Println("add column activityType")
err := c.DB.Exec("ALTER TABLE " + "\"" + types.Payment{}.TableName() + "\"" + " ADD COLUMN \"activityType\" TEXT;").Error
tableName := types.Payment{}.TableName()
err := c.DB.Exec(`ALTER TABLE ? ADD COLUMN "activityType" TEXT;`, gorm.Expr(tableName)).Error
if err != nil {
return fmt.Errorf("failed to add column activityType: %v", err)
}
Expand Down

0 comments on commit 2b6fb9e

Please sign in to comment.