Skip to content

Create postgres project scaffold on local init#241

Open
sdairs wants to merge 2 commits into
mainfrom
issue-221-postgres-init-dirs
Open

Create postgres project scaffold on local init#241
sdairs wants to merge 2 commits into
mainfrom
issue-221-postgres-init-dirs

Conversation

@sdairs
Copy link
Copy Markdown
Collaborator

@sdairs sdairs commented Jun 5, 2026

Summary

Closes #221.

local init previously only created the clickhouse/ project scaffold. It now also creates a postgres/ scaffold so Postgres project files have a home.

The Postgres scaffold is PG-native rather than a mirror of the ClickHouse one: plain views/ and functions/ (procedures) are far more central to a Postgres project than ClickHouse-style materialized views — in Postgres a materialized view is just a manually-refreshed query snapshot, not an insert-time pipeline.

clickhouse/
├── tables/
├── materialized_views/
├── queries/
└── seed/
postgres/
├── tables/
├── views/
├── functions/
├── queries/
└── seed/

Each subdir gets a .gitkeep.

Changes

  • init.rs: added postgres_project_dir(); generalized create_project_scaffold to take an explicit target dir + subdirs and call it for both engines.
  • Added unit tests covering scaffold creation (dirs + .gitkeep) and idempotency.
  • Updated the local init agent help text and README.md.

Testing

  • cargo test -p clickhousectl
  • cargo clippy -p clickhousectl

🤖 Generated with Claude Code


Note

Low Risk
Filesystem-only init scaffolding and docs; no runtime server, auth, or data-path behavior changes.

Overview
clickhousectl local init now scaffolds a committed postgres/ tree alongside the existing clickhouse/ layout, so Postgres SQL assets have a standard home next to ClickHouse project files.

Scaffold creation is refactored: create_project_scaffold takes a target directory and subdirectory list and is invoked twice—clickhouse/ keeps tables, materialized_views, queries, seed; postgres/ gets tables, views, functions, queries, seed (each with .gitkeep). postgres_project_dir() was added for the new root. Unit tests cover directory/.gitkeep creation and idempotent re-runs. README and local init agent help text document both trees.

Reviewed by Cursor Bugbot for commit 54d974b. Bugbot is set up for automated code reviews on this repo. Configure here.

`local init` now creates a `postgres/` scaffold (tables/, materialized_views/,
queries/, seed/) alongside the existing `clickhouse/` scaffold, so Postgres
project files have a home too.

Generalized `create_project_scaffold` to take the target dir and subdirs, added
unit tests covering creation and idempotency, and updated the agent help text
and README.

Closes #221

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@sdairs sdairs requested a review from iskakaushik as a code owner June 5, 2026 12:43
Postgres scaffold now uses tables/, views/, functions/, queries/, seed/ —
plain views and functions/procedures are far more central to a Postgres
project than ClickHouse-style materialized views, which in PG are just
manually-refreshed query snapshots.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

add postgres dir init to local init

1 participant