Fix dry run of migration cmd
Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
@@ -143,11 +143,6 @@ func migrateOne(ctx context.Context, conn pg.Conn, idStr string, dryRun bool) er
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if dryRun {
|
|
||||||
fmt.Printf("would migrate %s\n", idStr)
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
doc, err := prosemirror.ParseMarkdown(dv.Content)
|
doc, err := prosemirror.ParseMarkdown(dv.Content)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("cannot parse markdown for %q: %w", idStr, err)
|
return fmt.Errorf("cannot parse markdown for %q: %w", idStr, err)
|
||||||
@@ -158,6 +153,11 @@ func migrateOne(ctx context.Context, conn pg.Conn, idStr string, dryRun bool) er
|
|||||||
return fmt.Errorf("cannot marshal prosemirror for %q: %w", idStr, err)
|
return fmt.Errorf("cannot marshal prosemirror for %q: %w", idStr, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if dryRun {
|
||||||
|
fmt.Printf("would migrate %s successfully\n", idStr)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
dv.Content = string(out)
|
dv.Content = string(out)
|
||||||
dv.UpdatedAt = time.Now()
|
dv.UpdatedAt = time.Now()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user