Expand description
DDL statements that materialize the _mz_deploy tracking database.
Each entry is executed as its own statement by super::setup::setup.
Executing them individually (rather than as one multi-statement batch via
batch_execute) avoids Materialize’s rejection of DDL inside the implicit
transaction block that a simple multi-statement query creates.
Every statement is idempotent — setup is the only command that writes
to _mz_deploy, and it can be re-run any number of times to bring an
existing installation up to the current set of objects. The initial
tables.version row is seeded separately by super::setup::setup with
a pre-check, since there is no INSERT IF NOT EXISTS form in Materialize.
Order matters: tables must exist before the indexes and views that reference them.
EXPECTED_OBJECTS MUST stay in sync with the CREATE statements here;
a unit test in this module guards the invariant.
Constants§
- EXPECTED_
OBJECTS 🔒 - The known set of objects that
_mz_deploycontains after a successfulsetup. Used byverify()to check whether setup has been run. - SETUP_
STATEMENTS 🔒 - All DDL statements required to initialize
_mz_deployfrom a clean database, and safe to re-run against an existing one. The_mz_deploydatabase itself is created separately bysuper::setup::setupimmediately before iterating these.