Fix broken v27 migration - change mirror interval from int to bigint - #1504
Conversation
There was a problem hiding this comment.
This might be better?
if engine.Dialect().DataSourceName() == "mysql" { engine.Exec("ALTER TABLE mirror MODIFY interval BIGINT"); }
But I guess the same fix need to be applied for Postgresql as well.
There was a problem hiding this comment.
why not use sess.Exec since we have in a transaction?
|
LGTM |
|
Doesn't this fix need also change in models/migrations/v27.go ? Since the failed migration will still occur on applying v27 before this migration ? |
|
In fact all this change should be done in v27 since normally failing migration would stop the migration and people would be in blocked in v26 ? |
|
|
|
Yes. I'm wrong. @cez81 You are right. You should change the migration v27 but not add a new one. |
There was a problem hiding this comment.
Are 5 fields being dropped here from the Mirror struct ? Is this intentional ? Would it affect database structure ?
There was a problem hiding this comment.
No, just don't need them during the migration. As I understand it Xorm will notice and warn but fields are still there. Same as repo struct above. It has more fields not listed.
There was a problem hiding this comment.
I dunno if XORM takes care of this @lunny but PostgreSQL quotes for identifiers should be doublequote, not backtick.
There was a problem hiding this comment.
Good catch, I haven't used PostgreSQL.
There was a problem hiding this comment.
Looks like SQL Server also uses doublequotes.
Mirror.interval column type needed to be changed to bigint. Correct interval where the interval set is < MinInterval.
62214aa to
9994626
Compare
|
Rebased to pass Drone build |
|
LGTM |
Fix for #1496. Migration to v27 didn't alter the column type to bigint (#1407). This fix will alter the column type and set all mirror intervals that are < Mirror.MinInterval to Mirror.DefaultInterval.
Sqlite is ok because uses same integer type.