Skip to content

fix(scaffold): autogenerate initial migration on smpy new (#135) - #146

Merged
antosubash merged 1 commit into
mainfrom
feature/chore-fresh-scaffold-empty-migrations-migration-4zx5u
May 13, 2026
Merged

antosubash merged 1 commit into
mainfrom
feature/chore-fresh-scaffold-empty-migrations-migration-4zx5u

Conversation

@antosubash

Copy link
Copy Markdown
Owner

Summary

  • host/migrations/versions/ ships with only .gitkeep, so the post-install alembic upgrade head was a silent no-op and the freshly-scaffolded app booted against an empty schema (closes Fresh scaffold has empty migrations dir — make migrate is a no-op until make migration msg=... is run #135).
  • smpy new now runs alembic revision --autogenerate -m "initial schema" before alembic upgrade head, skipping if a revision already exists. Alembic is also invoked from host/ (previously from the workspace root, where there's no alembic.ini).
  • --no-install next-steps and the workspace README quickstart now point at make migration msg="initial schema" + make migrate.
  • Minor cleanup: create_app_project now returns the host dir so new.py doesn't recompute the flat-vs-workspace ternary, and the ["uv", "run", "alembic", ...] command is hoisted into a single _ALEMBIC constant.

Test plan

  • uv run pytest framework/cli/tests/ — 108 passed
  • uv run ruff check framework/cli/ and ruff format --check framework/cli/ clean
  • Three new regression tests pin: --no-install next-steps wording, _bootstrap_initial_migration runs autogenerate when only .gitkeep is present, and skips when a revision file already exists
  • Manual smoke: smpy new myapp --yes && cd myapp && sqlite3 host/app.db ".tables" shows the bundled modules' tables instead of just alembic_version

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented May 12, 2026 •

Copy link
Copy Markdown

Deploying simple-module-python with  Cloudflare Pages  Cloudflare Pages

Latest commit: c92b58f
Status: ✅  Deploy successful!
Preview URL: https://ef3fac9e.simple-module-python.pages.dev
Branch Preview URL: https://feature-chore-fresh-scaffold.simple-module-python.pages.dev

View logs

Copy link
Copy Markdown
Owner Author

Not auto-merged in this batch — this PR is in a dirty mergeable state (conflicts against main), and it touches the same framework/cli/simple_module_cli/app_project.py / scaffold new.py files modified by #142, #144, and #147 (just merged).

CI on the head commit is green (12/12), so once rebased onto current main and conflicts resolved, this should be ready to merge. Please rebase and re-run CI.


Generated by Claude Code

@antosubash
antosubash force-pushed the feature/chore-fresh-scaffold-empty-migrations-migration-4zx5u branch from dc6bb44 to 7e55d5a Compare May 13, 2026 16:14
… on a fresh `smpy new` (#135)

`host/migrations/versions/` ships with only `.gitkeep`, so the post-install
`alembic upgrade head` was a silent no-op and the app booted against an
empty schema. Run `alembic revision --autogenerate -m "initial schema"`
first (skipping if a revision already exists), and invoke alembic from
`host/` instead of the workspace root.

Also updates the `--no-install` next-steps and workspace README quickstart
to point at `make migration msg="initial schema"` + `make migrate`.
@antosubash
antosubash force-pushed the feature/chore-fresh-scaffold-empty-migrations-migration-4zx5u branch from 7e55d5a to c92b58f Compare May 13, 2026 16:20
@antosubash
antosubash merged commit a466da6 into main May 13, 2026
12 checks passed
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.

Fresh scaffold has empty migrations dir — make migrate is a no-op until make migration msg=... is run

1 participant