keon94 commented on code in PR #5957:
URL:
https://github.com/apache/incubator-devlake/pull/5957#discussion_r1305915499
##########
backend/server/services/remote/models/migration.go:
##########
@@ -101,6 +101,28 @@ func (o DropTableOperation) Execute(basicRes
context.BasicRes) errors.Error {
var _ Operation = (*DropTableOperation)(nil)
+type RenameColumnOperation struct {
+ Table string `json:"table"`
+ OldName string `json:"old_name"`
+ NewName string `json:"new_name"`
+}
+
+func (o RenameColumnOperation) Execute(basicRes context.BasicRes) errors.Error
{
+ db := basicRes.GetDal()
+ if !db.HasColumn(o.Table, o.OldName) {
+ return nil
+ }
+ if db.HasColumn(o.Table, o.NewName) {
+ err := db.DropColumns(o.Table, o.NewName)
Review Comment:
in this scenario specificially, if the column with the correct (new) name
already exists we should just immediately return nil, no?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]