Files
openobserve/src/migration
40f932198a feat: separate out ddl client and commands (#6675)
fixes https://github.com/openobserve/openobserve/issues/6621

This separates the functions which execute ddl statements, and only runs
them if certain entry in meta is mis-matching with what we have in our
code. Introduces a new env var `ZO_META_DDL_DSN` , which is optional and
falls back to the original DSN if not specified. Added a new client to
Postgres and Mysql both which uses this DDL DSN, and that is used only
for the ddl statements.

Also added another command to cli `upgrade-db` which runs the db
initialization functions.

For sqlite, there is no change, as it does not have concept of users.

Primarily tested on Postgres to validate that the behavior with
read-write and admin users is as expected.

`DB_SCHEMA_VERSION` is hardcoded in code, and devs are expected to
manually uptick it everytime we do any changes to db schema, similar to
how we maintain ofga.

---------

Signed-off-by: Yashodhan Joshi <yjdoc2@gmail.com>
Co-authored-by: Yashodhan Joshi <yjdoc2@gmail.com>
Co-authored-by: Hengfei Yang <hengfei.yang@gmail.com>
2025-05-01 16:56:37 +05:30
..