Skip to content

fix(init): keep an existing schema when offering the demo - #617

Merged
Brooooooklyn merged 1 commit into
fix/managed-queue-retriesfrom
fix/init-keep-existing-schema
Oct 27, 2026
Merged

Brooooooklyn merged 1 commit into
fix/managed-queue-retriesfrom
fix/init-keep-existing-schema

Conversation

@Brooooooklyn

Copy link
Copy Markdown
Member

Problem

In an existing project that has only a hand-written db/schema.ts, void init still offers "Scaffold demo code?". Saying yes replaces the schema with the demo posts table. src/demo.ts is overwritten the same way.

before:
  pages/routes/migrations? --no--> ask "Scaffold demo?" --yes--> overwrite db/schema.ts, src/demo.ts

after:
  pages/routes/migrations? --no--> schema exists? --yes--> "already has a database schema, skipping demo"
                                        |no
                                   any demo file exists? --yes--> "already has <paths>, skipping demo"
                                        |no
                                   ask "Scaffold demo?" --yes--> write all 3 demo files

What changed

  • New demoFiles(root) returns the three demo targets. scaffoldDemo() now writes to those paths.
  • Before the prompt, init now skips the demo when a Drizzle schema exists or when any demo file already exists, and logs why. The demo is written whole or not at all.

Tests

  • An existing db/schema.ts stays byte-identical, the demo is skipped with the message, and no other demo file is written.
  • An existing src/demo.ts stays unchanged and no half demo is written.
  • A fresh project still gets all three demo files.

Choices to check

  • The demo is skipped silently, with a log line, rather than asking first.
  • The whole demo is skipped on any file that already exists, instead of writing only the missing files.

🤖 Generated with Claude Code

@Brooooooklyn

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-27T08:07:24.208708Z 05c98a8 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

Reviewed commit: 1d05eebd48

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

🚀 Deploying Preview to Cloudflare 🚀

Preview URL: https://fix-init-keep-existing-schema-void-cloud.voidzero-docs.workers.dev (commit 05c98a8)

This URL reflects your latest Preview deployment

Preview Deployments by commit

Status Deployment URL Commit Updated (UTC) See this deployment's details
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://cd262ef7-void-cloud.voidzero-docs.workers.dev 05c98a8 2026-10-27T08:07:34.294Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://202fb91b-void-cloud.voidzero-docs.workers.dev efe4402 2026-10-27T07:56:08.651Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://21cbb378-void-cloud.voidzero-docs.workers.dev 1d05eeb 2026-10-27T07:31:54.447Z Visit the dashboard ↗

@Brooooooklyn
Brooooooklyn force-pushed the fix/init-keep-existing-schema branch from 1d05eeb to efe4402 Compare October 27, 2026 07:54
@Brooooooklyn
Brooooooklyn changed the base branch from main to fix/managed-queue-retries October 27, 2026 07:56
@Brooooooklyn
Brooooooklyn added this pull request to stack #618 October 27, 2026 07:56
In an existing project that had only a hand-written db/schema.ts,
answering yes to "Scaffold demo code?" in `void init` replaced that
schema with the demo posts table. src/demo.ts was overwritten the same
way.

Init now skips the demo, before asking, when the project already has a
Drizzle schema or when any demo file (db/schema.ts, routes/api/posts.ts,
src/demo.ts) already exists, and logs why. The demo is written whole or
not at all.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Brooooooklyn
Brooooooklyn force-pushed the fix/init-keep-existing-schema branch from efe4402 to 05c98a8 Compare October 27, 2026 08:06
@Brooooooklyn
Brooooooklyn enabled stacked auto-merge (squash) October 27, 2026 08:34
@Brooooooklyn
Brooooooklyn disabled stacked auto-merge October 27, 2026 08:34
@Brooooooklyn
Brooooooklyn merged commit 6405c72 into main Oct 27, 2026
19 checks passed
@Brooooooklyn
Brooooooklyn deleted the fix/init-keep-existing-schema branch October 27, 2026 08:51
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.

2 participants