AshClickhouse.DataLayer.Extension (AshClickhouse v0.5.2)

Copy Markdown View Source

Integration point that exposes ash_clickhouse to the standard Ash mix tasks.

mix ash.codegen and mix ash.migrate scan the application for modules that implement Spark.Dsl.Extension and invoke codegen/1 and migrate/1 on each of them. This module fills that role for ClickHouse:

  • codegen/1 prints the CREATE TABLE / ALTER TABLE statements that Ash would run for every resource with a working migrate? flag, without touching the database.
  • migrate/1 runs those statements against every configured repo, matching the behaviour of mix ash_clickhouse.migrate.

The ClickHouse DSL is a lightweight macro layer (see AshClickhouse.DataLayer.Dsl.Macros) rather than a full Spark DSL section, so this extension declares no sections of its own — it exists purely so that the Ash tasks discover and orchestrate the ClickHouse codegen/migrate pipeline.

Summary

Functions

Prints the DDL that mix ash.migrate would apply, without applying it.

Applies the pending ClickHouse changes for all configured resources.

The name shown by mix ash.codegen / mix ash.migrate for this extension.

Functions

codegen(argv)

@spec codegen([String.t()]) :: :ok | no_return()

Prints the DDL that mix ash.migrate would apply, without applying it.

Accepts the --dry-run / --check flags forwarded by mix ash.codegen. Passing --check exits with a non-zero status when there is pending DDL, so it can be used in CI.

migrate(argv)

@spec migrate([String.t()]) :: :ok

Applies the pending ClickHouse changes for all configured resources.

name()

The name shown by mix ash.codegen / mix ash.migrate for this extension.