1
0
mirror of https://github.com/pocketbase/pocketbase.git synced 2024-11-21 13:35:49 +02:00

fixed migrate down not returning the correct migrations order when the stored applied time is in seconds

This commit is contained in:
Gani Georgiev 2023-06-27 00:33:31 +03:00
parent af77554250
commit b8bb5e8d72

View File

@ -246,7 +246,9 @@ func (r *Runner) lastAppliedMigrations(limit int) ([]string, error) {
err := r.db.Select("file").
From(r.tableName).
Where(dbx.Not(dbx.HashExp{"applied": nil})).
OrderBy("applied DESC", "file DESC").
// unify microseconds and seconds applied time for backward compatibility
OrderBy("substr(applied||'0000000000000000', 0, 17) DESC").
AndOrderBy("file DESC").
Limit(int64(limit)).
Column(&files)