8000 fix: reversed migration order by gfyrag · Pull Request #963 · formancehq/ledger · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix: reversed migration order #963

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 13, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions internal/storage/system/migrations.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,22 +228,22 @@ func GetMigrator(db bun.IDB, options ...migrations.Option) *migrations.Migrator
},
},
migrations.Migration{
Name: "set default metadata on ledgers",
Name: "Add json_compact function",
Up: func(ctx context.Context, db bun.IDB) error {
return db.RunInTx(ctx, &sql.TxOptions{}, func(ctx context.Context, tx bun.Tx) error {
_, err := tx.ExecContext(ctx, `
alter table _system.ledgers
alter column metadata set default '{}'::jsonb;
`)
_, err := tx.ExecContext(ctx, jsonCompact)
return err
})
},
},
migrations.Migration{
Name: "Add json_compact function",
Name: "set default metadata on ledgers",
Up: func(ctx context.Context, db bun.IDB) error {
return db.RunInTx(ctx, &sql.TxOptions{}, func(ctx context.Context, tx bun.Tx) error {
_, err := tx.ExecContext(ctx, jsonCompact)
_, err := tx.ExecContext(ctx, `
alter table _system.ledgers
alter column metadata set default '{}'::jsonb;
`)
return err
})
},
Expand Down Expand Up @@ -331,4 +331,4 @@ BEGIN
END IF;
END;
$$ LANGUAGE plpgsql;
`
`
Loading
0