Idempotence of create_db script

From what I understand, to create the db schema, the command

server create_db

must be executed from the redash container against the postgres db.

My question is whether this is idempotent and what happens if this accidentally runs against an existing db (populated with data).

Will this ruin the schema / corrupt the data?

Same question goes for the execution of migration scripts

server manage db upgrade

server create_db is a light wrapper around SQLA’s Base.metadata.create_all() call which is idempotent in the way we use it.

Redash uses Alembic by way of Flask-Migrate. The creator of Alembic / SQLA says in the below GH issue that migrations are not idempotent by design. In my experience, however, they are idempotent de facto.

I’m curious why you ask?

Ι am in the process of creating helm charts for redash out of the proposed docker-compose configuration.

I plan to use helm hooks for such tasks (create_db + migration scripts) and was wandering what could possible go wrong (in terms of database corruption) in case such scripts run on the wrong timing.