chkit init
Creates a clickhouse.config.ts configuration file and an example schema file in your project. If either file already exists, it is left untouched.
Synopsis
Section titled “Synopsis”chkit initNo command-specific flags. See global flags.
Behavior
Section titled “Behavior”chkit init writes two files relative to the current working directory:
-
clickhouse.config.ts— project configuration with sensible defaults:schema: './src/db/schema/**/*.ts'outDir: './chkit'migrationsDir: './chkit/migrations'metaDir: './chkit/meta'plugins: []clickhouseblock reading from environment variables (CLICKHOUSE_URL,CLICKHOUSE_USER,CLICKHOUSE_PASSWORD,CLICKHOUSE_DB)
-
src/db/schema/example.ts— a sample table definition usingMergeTreeengine with columnsid(UInt64),source(String), andingested_at(DateTime64(3)).
The command is idempotent — running it again on an existing project does nothing.
Examples
Section titled “Examples”Initialize a new project:
chkit initOutput:
Created clickhouse.config.tsCreated src/db/schema/example.ts
Next steps: 1. Set CLICKHOUSE_URL (and CLICKHOUSE_USER / CLICKHOUSE_PASSWORD / CLICKHOUSE_DB if needed). 2. Edit src/db/schema/example.ts to match your data. 3. Run: bunx chkit generate --name init 4. Run: bunx chkit migrate --apply
Docs: https://chkit.obsessiondb.com/getting-started/add-to-existing-project/Run on an existing project (no changes):
chkit init# No output — both files already existRelated commands
Section titled “Related commands”chkit generate— generate migrations from your schema after init