Skip to content

Commit

Permalink
revert migration code
Browse files Browse the repository at this point in the history
  • Loading branch information
luluz66 authored and vadimberezniker committed Jan 12, 2022
1 parent c6fea62 commit c952acd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
23 changes: 13 additions & 10 deletions server/tables/tables.go
Original file line number Diff line number Diff line change
Expand Up @@ -585,22 +585,25 @@ func PreAutoMigrate(db *gorm.DB) ([]PostAutoMigrateLogic, error) {
}

if m.HasTable("Invocations") && m.HasColumn(&Invocation{}, "invocation_uuid") {
if db.Dialector.Name() == mysqlDialect {
err := backfillInvocationUUIDIfNull(db)
return postMigrate, err
}
// TODO(luluz): Disable migration code for now
// if db.Dialector.Name() == mysqlDialect {
// err := backfillInvocationUUIDIfNull(db)
// return postMigrate, err
//}
}

// Populate invocation_uuid if the column doesn't exist.
if m.HasTable("Invocations") && !m.HasColumn(&Invocation{}, "invocation_uuid") {
if db.Dialector.Name() == sqliteDialect {
postMigrate = append(postMigrate, func() error {
return postMigrateInvocationUUIDForSQLite(db)
})
// TODO(luluz): Disable migration code for now
//postMigrate = append(postMigrate, func() error {
// return postMigrateInvocationUUIDForSQLite(db)
//})
} else if db.Dialector.Name() == mysqlDialect {
postMigrate = append(postMigrate, func() error {
return postMigrateInvocationUUIDForMySQL(db)
})
// TODO(luluz): Disable migration code for now
// postMigrate = append(postMigrate, func() error {
// return postMigrateInvocationUUIDForMySQL(db)
// })
} else {
log.Warningf("Unsupported sql dialect: %q", db.Dialector.Name())
}
Expand Down
2 changes: 1 addition & 1 deletion server/target/target.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func readTargets(ctx context.Context, env environment.Env, req *trpb.GetTargetRe
i.invocation_id, i.commit_sha, i.branch_name, i.repo_url, i.created_at_usec
FROM Targets as t
JOIN TargetStatuses AS ts ON t.target_id = ts.target_id
JOIN Invocations AS i ON ts.invocation_uuid = i.invocation_uuid`)
JOIN Invocations AS i ON ts.invocation_pk = i.invocation_pk`)
q.AddWhereClause("i.group_id = ?", req.GetRequestContext().GetGroupId())
q.AddWhereClause("t.group_id = ?", req.GetRequestContext().GetGroupId())
// Adds user / permissions to targets (t) table.
Expand Down

0 comments on commit c952acd

Please sign in to comment.