Skip to content

docs(claude): rewrite CLAUDE.md for the Ent + Atlas + Goose workflow - #1224

Merged
kalbasit merged 1 commit into
mainfrom
docs-claude-md-ent-atlas-goose
May 23, 2026
Merged

kalbasit merged 1 commit into
mainfrom
docs-claude-md-ent-atlas-goose

Conversation

@kalbasit

Copy link
Copy Markdown
Owner

Replaces every reference to the removed sqlc / dbmate /
dbmate-wrapper / db/query.*.sql / db/schema/ / db/migrations/ tooling
with the Ent + Atlas + Goose workflow:

  • New "Common Commands" section covers go generate ./ent/...,
    go run ./cmd/ent-lint, task ent:check,
    go run ./cmd/generate-migrations (schema-driven + --sql-only),
    ncps migrate up (with --dry-run), and go run ./cmd/atlas-sum-check.
  • "Skills" block lists the new ent-schema / migrate-new / migrate-up /
    migrate-down skills.
  • "Package Structure" reorganized around cmd/{ent-lint,generate-migrations,atlas-sum-check},
    ent/schema/ (hand-authored) vs ent/ (committed codegen), and
    migrations/<dialect>/ with embedded atlas.sum integrity files.
  • New "Database" section documents the expand-contract policy (column
    changes split across N migrations), the four-step NOT NULL recipe,
    and the five Ent codegen invariants (A1-A5) enforced by
    cmd/ent-lint.

Marks task 14.1 complete in the migrate-to-ent-and-atlas change.

@dosubot dosubot Bot added size:L This PR changes 100-499 lines, ignoring generated files. documentation Improvements or additions to documentation go Pull requests that update go code labels May 21, 2026
@dosubot

dosubot Bot commented May 21, 2026

Copy link
Copy Markdown

Related Knowledge

1 document with suggested updates is ready for review.

kalbasit's Space

Development Environment with MinIO
View Suggested Changes
@@ -38,23 +38,31 @@
 [See initialization script](https://github.com/kalbasit/ncps/blob/cf8e19f/nix/process-compose/init-minio.sh)
 
 # Database Migration Transaction Handling
-**IMPORTANT:** Do NOT manually add `BEGIN`/`COMMIT` blocks to your migration files. The `dbmate` tool automatically wraps each migration in a transaction for atomicity. Adding manual transaction blocks will cause errors such as "cannot start a transaction within a transaction."
+**IMPORTANT:** Do NOT manually add `BEGIN`/`COMMIT` blocks to your migration files. Goose automatically wraps each migration in a transaction for atomicity. Adding manual transaction blocks will cause errors such as "cannot start a transaction within a transaction."
+
+Migrations that need to disable automatic transaction wrapping must add the `-- +goose NO TRANSACTION` directive at the top of the file (immediately below the `-- +goose Up` marker). This is specifically needed for SQLite migrations that require `PRAGMA foreign_keys = OFF`.
 
 **Example:**
 
 ```sql
 -- ❌ WRONG - Don't add manual transactions
--- migrate:up
+-- +goose Up
 BEGIN;
 CREATE TABLE example (...);
 COMMIT;
 
--- ✅ CORRECT - Let dbmate handle transactions
--- migrate:up
+-- ✅ CORRECT - Let Goose handle transactions
+-- +goose Up
 CREATE TABLE example (...);
+
+-- ✅ CORRECT - Disable transactions when needed (e.g., for SQLite PRAGMA)
+-- +goose Up
+-- +goose NO TRANSACTION
+PRAGMA foreign_keys = OFF;
+-- Migration statements here
 ```
 
-Letting dbmate manage transactions ensures that if any part of a migration fails, the entire migration is rolled back, preventing partial or inconsistent database states.
+Letting Goose manage transactions ensures that if any part of a migration fails, the entire migration is rolled back, preventing partial or inconsistent database states.
 
 ## Running MinIO and Initialization
 Start MinIO and run the initialization process using:

[Accept] [Edit] [Decline]

How did I do? Any feedback?  Join Discord

This was referenced May 21, 2026
kalbasit added a commit that referenced this pull request May 22, 2026
…e down

- Bring the Common Commands DSN examples in line with the Database section
  by using the full host:port/database placeholder for postgresql/mysql.
- Replace "there is no migrate down command" with the accurate phrasing:
  the command is implemented (pkg/ncps/migrate.go:107) but returns an
  error pointing at the expand-contract policy.

Addresses gemini-code-assist comments on PR #1224 (PRRT_kwDONV6tZs6D37b-,
PRRT_kwDONV6tZs6D37cD). The third sqlfluff suggestion is intentionally
skipped — migrations/ is sealed by atlas.sum so sqlfluff isn't run
against it, and the only SQL outside migrations/ is already covered by
nix fmt.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
@kalbasit
kalbasit force-pushed the feat-nix-checks-schema-equivalence branch from 90e681a to a7a9235 Compare May 22, 2026 21:54
@kalbasit
kalbasit force-pushed the docs-claude-md-ent-atlas-goose branch from 0711dc7 to 88834a7 Compare May 22, 2026 21:54
kalbasit added a commit that referenced this pull request May 22, 2026
…e down

- Bring the Common Commands DSN examples in line with the Database section
  by using the full host:port/database placeholder for postgresql/mysql.
- Replace "there is no migrate down command" with the accurate phrasing:
  the command is implemented (pkg/ncps/migrate.go:107) but returns an
  error pointing at the expand-contract policy.

Addresses gemini-code-assist comments on PR #1224 (PRRT_kwDONV6tZs6D37b-,
PRRT_kwDONV6tZs6D37cD). The third sqlfluff suggestion is intentionally
skipped — migrations/ is sealed by atlas.sum so sqlfluff isn't run
against it, and the only SQL outside migrations/ is already covered by
nix fmt.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
@kalbasit
kalbasit force-pushed the feat-nix-checks-schema-equivalence branch from a7a9235 to 5509f29 Compare May 22, 2026 23:02
@kalbasit
kalbasit force-pushed the docs-claude-md-ent-atlas-goose branch from 88834a7 to e392a8d Compare May 22, 2026 23:02
kalbasit added a commit that referenced this pull request May 22, 2026
…e down

- Bring the Common Commands DSN examples in line with the Database section
  by using the full host:port/database placeholder for postgresql/mysql.
- Replace "there is no migrate down command" with the accurate phrasing:
  the command is implemented (pkg/ncps/migrate.go:107) but returns an
  error pointing at the expand-contract policy.

Addresses gemini-code-assist comments on PR #1224 (PRRT_kwDONV6tZs6D37b-,
PRRT_kwDONV6tZs6D37cD). The third sqlfluff suggestion is intentionally
skipped — migrations/ is sealed by atlas.sum so sqlfluff isn't run
against it, and the only SQL outside migrations/ is already covered by
nix fmt.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
@kalbasit
kalbasit force-pushed the feat-nix-checks-schema-equivalence branch from 5509f29 to 27ac0ea Compare May 22, 2026 23:16
@kalbasit
kalbasit force-pushed the docs-claude-md-ent-atlas-goose branch from e392a8d to 490804f Compare May 22, 2026 23:16
kalbasit added a commit that referenced this pull request May 22, 2026
…e down

- Bring the Common Commands DSN examples in line with the Database section
  by using the full host:port/database placeholder for postgresql/mysql.
- Replace "there is no migrate down command" with the accurate phrasing:
  the command is implemented (pkg/ncps/migrate.go:107) but returns an
  error pointing at the expand-contract policy.

Addresses gemini-code-assist comments on PR #1224 (PRRT_kwDONV6tZs6D37b-,
PRRT_kwDONV6tZs6D37cD). The third sqlfluff suggestion is intentionally
skipped — migrations/ is sealed by atlas.sum so sqlfluff isn't run
against it, and the only SQL outside migrations/ is already covered by
nix fmt.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
@kalbasit
kalbasit force-pushed the feat-nix-checks-schema-equivalence branch from 27ac0ea to 2551daa Compare May 22, 2026 23:28
@kalbasit
kalbasit force-pushed the docs-claude-md-ent-atlas-goose branch from 490804f to 1c0dbae Compare May 22, 2026 23:28
kalbasit added a commit that referenced this pull request May 22, 2026
…e down

- Bring the Common Commands DSN examples in line with the Database section
  by using the full host:port/database placeholder for postgresql/mysql.
- Replace "there is no migrate down command" with the accurate phrasing:
  the command is implemented (pkg/ncps/migrate.go:107) but returns an
  error pointing at the expand-contract policy.

Addresses gemini-code-assist comments on PR #1224 (PRRT_kwDONV6tZs6D37b-,
PRRT_kwDONV6tZs6D37cD). The third sqlfluff suggestion is intentionally
skipped — migrations/ is sealed by atlas.sum so sqlfluff isn't run
against it, and the only SQL outside migrations/ is already covered by
nix fmt.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
@kalbasit
kalbasit force-pushed the feat-nix-checks-schema-equivalence branch from 2551daa to 3750cae Compare May 22, 2026 23:54
@kalbasit
kalbasit force-pushed the docs-claude-md-ent-atlas-goose branch from 1c0dbae to 1681faf Compare May 22, 2026 23:54
kalbasit added a commit that referenced this pull request May 22, 2026
…e down

- Bring the Common Commands DSN examples in line with the Database section
  by using the full host:port/database placeholder for postgresql/mysql.
- Replace "there is no migrate down command" with the accurate phrasing:
  the command is implemented (pkg/ncps/migrate.go:107) but returns an
  error pointing at the expand-contract policy.

Addresses gemini-code-assist comments on PR #1224 (PRRT_kwDONV6tZs6D37b-,
PRRT_kwDONV6tZs6D37cD). The third sqlfluff suggestion is intentionally
skipped — migrations/ is sealed by atlas.sum so sqlfluff isn't run
against it, and the only SQL outside migrations/ is already covered by
nix fmt.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
@kalbasit
kalbasit force-pushed the feat-nix-checks-schema-equivalence branch from 3750cae to d3ecada Compare May 23, 2026 00:07
@kalbasit
kalbasit force-pushed the docs-claude-md-ent-atlas-goose branch from 1681faf to 999a958 Compare May 23, 2026 00:07
kalbasit added a commit that referenced this pull request May 23, 2026
…e down

- Bring the Common Commands DSN examples in line with the Database section
  by using the full host:port/database placeholder for postgresql/mysql.
- Replace "there is no migrate down command" with the accurate phrasing:
  the command is implemented (pkg/ncps/migrate.go:107) but returns an
  error pointing at the expand-contract policy.

Addresses gemini-code-assist comments on PR #1224 (PRRT_kwDONV6tZs6D37b-,
PRRT_kwDONV6tZs6D37cD). The third sqlfluff suggestion is intentionally
skipped — migrations/ is sealed by atlas.sum so sqlfluff isn't run
against it, and the only SQL outside migrations/ is already covered by
nix fmt.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
@kalbasit
kalbasit force-pushed the feat-nix-checks-schema-equivalence branch from d3ecada to 16b7c11 Compare May 23, 2026 00:36
@kalbasit
kalbasit force-pushed the docs-claude-md-ent-atlas-goose branch from 999a958 to 55c9051 Compare May 23, 2026 00:36
kalbasit added a commit that referenced this pull request May 23, 2026
…e down

- Bring the Common Commands DSN examples in line with the Database section
  by using the full host:port/database placeholder for postgresql/mysql.
- Replace "there is no migrate down command" with the accurate phrasing:
  the command is implemented (pkg/ncps/migrate.go:107) but returns an
  error pointing at the expand-contract policy.

Addresses gemini-code-assist comments on PR #1224 (PRRT_kwDONV6tZs6D37b-,
PRRT_kwDONV6tZs6D37cD). The third sqlfluff suggestion is intentionally
skipped — migrations/ is sealed by atlas.sum so sqlfluff isn't run
against it, and the only SQL outside migrations/ is already covered by
nix fmt.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
@kalbasit
kalbasit force-pushed the feat-nix-checks-schema-equivalence branch from 16b7c11 to eaa8115 Compare May 23, 2026 03:31
@kalbasit
kalbasit force-pushed the docs-claude-md-ent-atlas-goose branch from 55c9051 to 1783d26 Compare May 23, 2026 03:31
@kalbasit

Copy link
Copy Markdown
Owner Author

Automated stack merge failed during the rebase step. The merge-stack label has been removed from all PRs in the stack. Please resolve conflicts locally, push, and re-apply the label on the top-most PR to retry. Run: https://github.com/kalbasit/ncps/actions/runs/26326665317

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@CLAUDE.md`:
- Around line 42-43: Update the README headings and text that currently claim
"Lint Ent schemas + generated baseline migrations for codegen invariants" (and
the corresponding sections around lines referenced) to precisely state that
cmd/ent-lint only enforces migration-baseline checks and the A1, A2, and A4
invariants today; make the same change in the other occurrences (the sections
around line 169 and the larger section around 730–747) so all headings and
descriptive sentences consistently say "enforces migration-baseline and A1/A2/A4
invariants" rather than implying full A1–A5 coverage.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 1cc4e70c-3bee-412b-80d3-0979883daa12

📥 Commits

Reviewing files that changed from the base of the PR and between 84f42a1 and d01d986.

📒 Files selected for processing (2)
  • CLAUDE.md
  • openspec/changes/migrate-to-ent-and-atlas/tasks.md

Comment thread CLAUDE.md Resolved
Replaces every reference to the removed sqlc / dbmate /
dbmate-wrapper / db/query.*.sql / db/schema/ / db/migrations/ tooling
with the Ent + Atlas + Goose workflow:

- New "Common Commands" section covers `go generate ./ent/...`,
  `go run ./cmd/ent-lint`, `task ent:check`,
  `go run ./cmd/generate-migrations` (schema-driven + --sql-only),
  `ncps migrate up` (with --dry-run), and `go run ./cmd/atlas-sum-check`.
- "Skills" block lists the new ent-schema / migrate-new / migrate-up /
  migrate-down skills.
- "Package Structure" reorganized around `cmd/{ent-lint,generate-migrations,atlas-sum-check}`,
  `ent/schema/` (hand-authored) vs `ent/` (committed codegen), and
  `migrations/<dialect>/` with embedded `atlas.sum` integrity files.
- New "Database" section documents the expand-contract policy (column
  changes split across N migrations), the four-step NOT NULL recipe,
  and the five Ent codegen invariants (A1-A5) enforced by
  `cmd/ent-lint`.

Marks task 14.1 complete in the migrate-to-ent-and-atlas change.
@codecov

codecov Bot commented May 23, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 5.50%. Comparing base (c87b63d) to head (1a11f08).

Additional details and impacted files
@@          Coverage Diff          @@
##            main   #1224   +/-   ##
=====================================
  Coverage   5.50%   5.50%           
=====================================
  Files          6       6           
  Lines        400     400           
=====================================
  Hits          22      22           
  Misses       374     374           
  Partials       4       4           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation go Pull requests that update go code merge-stack size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant