Skip to content

chore: delete sqlc + dbmate filesystem and Nix references - #1220

Merged
kalbasit merged 3 commits into
mainfrom
chore-delete-sqlc-dbmate-filesystem-and-nix
May 23, 2026
Merged

kalbasit merged 3 commits into
mainfrom
chore-delete-sqlc-dbmate-filesystem-and-nix

Conversation

@kalbasit

Copy link
Copy Markdown
Owner

§12.1-12.3, §12.6-12.9 of the migrate-to-ent-and-atlas change.
With the Go-side cleanup complete and tests fully on Ent, drop the
last vestiges of the old toolchain from disk:

  • db/query.{sqlite,postgres,mysql}.sql (sqlc input)
  • db/schema/{sqlite,postgres,mysql}.sql (sqlc-generated schema dumps)
  • db/migrations/{sqlite,postgres,mysql}/ (dbmate-era migrations;
    the authoritative copies now live at migrations// via
    ent/migrate codegen + Atlas)
  • sqlc.yml at repo root
  • nix/dbmate-wrapper/ + its flake-module import in flake.nix
  • dbmate command in nix/devshells/flake-module.nix
  • dbmate from nix/packages/ncps/default.nix nativeBuildInputs
  • dbmate-wrapper layer + NCPS_DB_MIGRATIONS_DIR/DBMATE_* env in
    nix/packages/docker{,dev}.nix
  • nix/dbmate-wrapper/src golangci-lint exclude in pre-commit/
  • github.com/kalbasit/sqlc-multi-db from the go.mod tool() and
    indirect requires (go mod tidy ran)

Nix source bundle (nix/packages/ncps/default.nix) is updated to
include the new repo-root migrations/ + ent/ + cmd/ + internal/
dirs in place of db/. nix flake check passes; go build + go vet +
go test -race -count=1 across SQLite + Postgres + MySQL + MinIO +
Redis is green across all 29 packages.

Tasks.md is updated to mark §12.1-12.3, §12.6-12.9 complete.

Co-Authored-By: Claude Opus 4.7 [email protected]

@dosubot dosubot Bot added size:XL This PR changes 500-999 lines, ignoring generated files. 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
@@ -37,24 +37,10 @@
 
 [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."
+# Database Migrations
+The project uses Ent with Atlas for database migrations. Migration files are generated and located at `migrations/<dialect>/` (where `<dialect>` is `sqlite`, `postgres`, or `mysql`). These files are generated by Ent's migrate codegen combined with Atlas.
 
-**Example:**
-
-```sql
--- ❌ WRONG - Don't add manual transactions
--- migrate:up
-BEGIN;
-CREATE TABLE example (...);
-COMMIT;
-
--- ✅ CORRECT - Let dbmate handle transactions
--- migrate:up
-CREATE TABLE example (...);
-```
-
-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.
+Atlas automatically handles transaction wrapping for migrations where appropriate. Do not manually add `BEGIN`/`COMMIT` blocks to migration files unless you have a specific requirement that needs explicit transaction control.
 
 ## 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
kalbasit force-pushed the docs-openspec-mark-11-and-12-done branch from 3574d14 to 61d7585 Compare May 23, 2026 00:36
@kalbasit
kalbasit force-pushed the chore-delete-sqlc-dbmate-filesystem-and-nix branch from 4d61334 to 82a1c60 Compare May 23, 2026 00:36
kalbasit added a commit that referenced this pull request May 23, 2026
The parent commit deletes the sqlc-generated query.<dialect>.sql.go
trees, shrinking the limited (ncps) fileset's vendor down to the
ent-only set. But the golangci-lint-check check that overrides
ncps with `src = ../../.` still sees `cmd/generate-migrations`,
which transitively pulls in modernc.org/sqlite — a dep the
shrunken limited fileset no longer needs. The two derivations
end up wanting different vendorHashes for the same attribute.

Bring `cmd/` into the ncps limited fileset so both derivations
share the same vendor and the single vendorHash satisfies both.
The exclude in #1220's source-list cleanup becomes a no-op for
cmd/ but still removes db/migrations and db/schema cleanly.
@kalbasit
kalbasit force-pushed the docs-openspec-mark-11-and-12-done branch from 61d7585 to 1f076fa Compare May 23, 2026 03:31
@kalbasit
kalbasit force-pushed the chore-delete-sqlc-dbmate-filesystem-and-nix branch from 82a1c60 to d8c802e Compare May 23, 2026 03:31
kalbasit added a commit that referenced this pull request May 23, 2026
The parent commit deletes the sqlc-generated query.<dialect>.sql.go
trees, shrinking the limited (ncps) fileset's vendor down to the
ent-only set. But the golangci-lint-check check that overrides
ncps with `src = ../../.` still sees `cmd/generate-migrations`,
which transitively pulls in modernc.org/sqlite — a dep the
shrunken limited fileset no longer needs. The two derivations
end up wanting different vendorHashes for the same attribute.

Bring `cmd/` into the ncps limited fileset so both derivations
share the same vendor and the single vendorHash satisfies both.
The exclude in #1220's source-list cleanup becomes a no-op for
cmd/ but still removes db/migrations and db/schema cleanly.
@kalbasit
kalbasit force-pushed the docs-openspec-mark-11-and-12-done branch from 1f076fa to 5d4c343 Compare May 23, 2026 03:45
@kalbasit
kalbasit force-pushed the chore-delete-sqlc-dbmate-filesystem-and-nix branch from d8c802e to 0a54b7f Compare May 23, 2026 03:45
kalbasit added a commit that referenced this pull request May 23, 2026
The parent commit deletes the sqlc-generated query.<dialect>.sql.go
trees, shrinking the limited (ncps) fileset's vendor down to the
ent-only set. But the golangci-lint-check check that overrides
ncps with `src = ../../.` still sees `cmd/generate-migrations`,
which transitively pulls in modernc.org/sqlite — a dep the
shrunken limited fileset no longer needs. The two derivations
end up wanting different vendorHashes for the same attribute.

Bring `cmd/` into the ncps limited fileset so both derivations
share the same vendor and the single vendorHash satisfies both.
The exclude in #1220's source-list cleanup becomes a no-op for
cmd/ but still removes db/migrations and db/schema cleanly.
@kalbasit
kalbasit force-pushed the docs-openspec-mark-11-and-12-done branch from 5d4c343 to e484ce8 Compare May 23, 2026 03:58
@kalbasit
kalbasit force-pushed the chore-delete-sqlc-dbmate-filesystem-and-nix branch from 0a54b7f to 5784cf8 Compare May 23, 2026 03:58
kalbasit added a commit that referenced this pull request May 23, 2026
The parent commit deletes the sqlc-generated query.<dialect>.sql.go
trees, shrinking the limited (ncps) fileset's vendor down to the
ent-only set. But the golangci-lint-check check that overrides
ncps with `src = ../../.` still sees `cmd/generate-migrations`,
which transitively pulls in modernc.org/sqlite — a dep the
shrunken limited fileset no longer needs. The two derivations
end up wanting different vendorHashes for the same attribute.

Bring `cmd/` into the ncps limited fileset so both derivations
share the same vendor and the single vendorHash satisfies both.
The exclude in #1220's source-list cleanup becomes a no-op for
cmd/ but still removes db/migrations and db/schema cleanly.
@kalbasit
kalbasit force-pushed the docs-openspec-mark-11-and-12-done branch from e484ce8 to 4154841 Compare May 23, 2026 04:10
@kalbasit
kalbasit force-pushed the chore-delete-sqlc-dbmate-filesystem-and-nix branch from 5784cf8 to 0b7fb67 Compare May 23, 2026 04:10
kalbasit added a commit that referenced this pull request May 23, 2026
The parent commit deletes the sqlc-generated query.<dialect>.sql.go
trees, shrinking the limited (ncps) fileset's vendor down to the
ent-only set. But the golangci-lint-check check that overrides
ncps with `src = ../../.` still sees `cmd/generate-migrations`,
which transitively pulls in modernc.org/sqlite — a dep the
shrunken limited fileset no longer needs. The two derivations
end up wanting different vendorHashes for the same attribute.

Bring `cmd/` into the ncps limited fileset so both derivations
share the same vendor and the single vendorHash satisfies both.
The exclude in #1220's source-list cleanup becomes a no-op for
cmd/ but still removes db/migrations and db/schema cleanly.
@kalbasit
kalbasit force-pushed the docs-openspec-mark-11-and-12-done branch from 4154841 to a6c8063 Compare May 23, 2026 04:22
@kalbasit
kalbasit force-pushed the chore-delete-sqlc-dbmate-filesystem-and-nix branch from 0b7fb67 to 9a83354 Compare May 23, 2026 04:22
kalbasit added a commit that referenced this pull request May 23, 2026
The parent commit deletes the sqlc-generated query.<dialect>.sql.go
trees, shrinking the limited (ncps) fileset's vendor down to the
ent-only set. But the golangci-lint-check check that overrides
ncps with `src = ../../.` still sees `cmd/generate-migrations`,
which transitively pulls in modernc.org/sqlite — a dep the
shrunken limited fileset no longer needs. The two derivations
end up wanting different vendorHashes for the same attribute.

Bring `cmd/` into the ncps limited fileset so both derivations
share the same vendor and the single vendorHash satisfies both.
The exclude in #1220's source-list cleanup becomes a no-op for
cmd/ but still removes db/migrations and db/schema cleanly.
@kalbasit
kalbasit force-pushed the docs-openspec-mark-11-and-12-done branch from a6c8063 to 5ddb281 Compare May 23, 2026 04:34
@kalbasit
kalbasit force-pushed the chore-delete-sqlc-dbmate-filesystem-and-nix branch from 9a83354 to 7365aac Compare May 23, 2026 04:34
kalbasit added a commit that referenced this pull request May 23, 2026
The parent commit deletes the sqlc-generated query.<dialect>.sql.go
trees, shrinking the limited (ncps) fileset's vendor down to the
ent-only set. But the golangci-lint-check check that overrides
ncps with `src = ../../.` still sees `cmd/generate-migrations`,
which transitively pulls in modernc.org/sqlite — a dep the
shrunken limited fileset no longer needs. The two derivations
end up wanting different vendorHashes for the same attribute.

Bring `cmd/` into the ncps limited fileset so both derivations
share the same vendor and the single vendorHash satisfies both.
The exclude in #1220's source-list cleanup becomes a no-op for
cmd/ but still removes db/migrations and db/schema cleanly.
@kalbasit
kalbasit force-pushed the docs-openspec-mark-11-and-12-done branch from 5ddb281 to 5f1242a Compare May 23, 2026 04:47
@kalbasit
kalbasit force-pushed the chore-delete-sqlc-dbmate-filesystem-and-nix branch from 7365aac to 011281b Compare May 23, 2026 04:47
kalbasit added a commit that referenced this pull request May 23, 2026
The parent commit deletes the sqlc-generated query.<dialect>.sql.go
trees, shrinking the limited (ncps) fileset's vendor down to the
ent-only set. But the golangci-lint-check check that overrides
ncps with `src = ../../.` still sees `cmd/generate-migrations`,
which transitively pulls in modernc.org/sqlite — a dep the
shrunken limited fileset no longer needs. The two derivations
end up wanting different vendorHashes for the same attribute.

Bring `cmd/` into the ncps limited fileset so both derivations
share the same vendor and the single vendorHash satisfies both.
The exclude in #1220's source-list cleanup becomes a no-op for
cmd/ but still removes db/migrations and db/schema cleanly.
kalbasit and others added 3 commits May 23, 2026 06:58
§12.1-12.3, §12.6-12.9 of the migrate-to-ent-and-atlas change.
With the Go-side cleanup complete and tests fully on Ent, drop the
last vestiges of the old toolchain from disk:

* db/query.{sqlite,postgres,mysql}.sql (sqlc input)
* db/schema/{sqlite,postgres,mysql}.sql (sqlc-generated schema dumps)
* db/migrations/{sqlite,postgres,mysql}/ (dbmate-era migrations;
  the authoritative copies now live at migrations/<dialect>/ via
  ent/migrate codegen + Atlas)
* sqlc.yml at repo root
* nix/dbmate-wrapper/ + its flake-module import in flake.nix
* dbmate command in nix/devshells/flake-module.nix
* dbmate from nix/packages/ncps/default.nix nativeBuildInputs
* dbmate-wrapper layer + NCPS_DB_MIGRATIONS_DIR/DBMATE_* env in
  nix/packages/docker{,dev}.nix
* nix/dbmate-wrapper/src golangci-lint exclude in pre-commit/
* github.com/kalbasit/sqlc-multi-db from the go.mod tool() and
  indirect requires (go mod tidy ran)

Nix source bundle (nix/packages/ncps/default.nix) is updated to
include the new repo-root migrations/ + ent/ + cmd/ + internal/
dirs in place of db/. nix flake check passes; go build + go vet +
go test -race -count=1 across SQLite + Postgres + MySQL + MinIO +
Redis is green across all 29 packages.

Tasks.md is updated to mark §12.1-12.3, §12.6-12.9 complete.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
After dropping sqlc-multi-db from go.mod in the parent cleanup
commit, two transitive deps it pulled in are now orphaned:

  - mvdan.cc/gofumpt (indirect)
  - github.com/go-quicktest/qt (indirect, h1: entries only)

`go mod tidy` prunes them, and the new vendor set produces a new
fixed-output hash. Refresh vendorHash in nix/packages/ncps/
default.nix so `nix build .#ncps.goModules` (CI's vendor-hash
gate) stays green at this branch and every branch above it.
@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 (273279e) to head (2882f6f).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@          Coverage Diff          @@
##            main   #1220   +/-   ##
=====================================
  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.

@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

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

Labels

go Pull requests that update go code size:XL This PR changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant