fix(cli): objectstack dev persists data by default (no :memory: wipe on restart)#1556
Merged
Merged
Conversation
…on restart) `objectstack dev` fell back to a :memory: SQLite DB when no --database / OS_DATABASE_URL was set, wiping all data + AI-authored metadata on every restart — build an app, restart, it's gone. Now `dev` defaults to a persistent file at <cwd>/.objectstack/data/dev.db (gitignored, per-project). Opt-outs unchanged + take precedence: --fresh, --database, OS_DATABASE_URL, --database-driver memory. Logic extracted to resolveDefaultDevDbUrl() + tested. The app-showcase example drops its explicit :memory: datasource override so it persists out of the box. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
objectstack devfell back to a:memory:SQLite database whenever no--database/OS_DATABASE_URLwas provided. Every restart silently wiped all data and AI-authored metadata — you build an app in the Studio assistant, restart the dev server, and everything is gone. That makes local app-building (and the whole AI metadata-authoring loop) effectively unusable.This was surfaced while verifying that an AI-built app is actually usable locally: after publishing an app, a restart lost it entirely because the showcase ran on
:memory:.Fix
devnow defaults to a persistent, project-anchored SQLite file at<cwd>/.objectstack/data/dev.db(gitignored, per-project) when the user hasn't chosen a database another way. All existing opt-outs are unchanged and take precedence:--fresh— ephemeral temp DB (auto-deleted on exit)--database <url>/-dOS_DATABASE_URL/DATABASE_URL--database-driver memoryorOS_DATABASE_DRIVER=memoryResolution is extracted into a pure, exported
resolveDefaultDevDbUrl()helper (unit-tested).The app-showcase example also drops its explicit
:memory:datasource override (datasources+datasourceMapping), which would otherwise route data back to memory and defeat the new default. (Its plugins are instantiated objects → it's a "host config", so it never got the standalone file default — hence the override mattered.)Verification
resolveDefaultDevDbUrl()— defaults to the file path; yields to--database,--fresh,OS_DATABASE_URL/DATABASE_URL, and the memory-driver opt-outs (6 cases).objectstack dev --seed-admin→ driver resolves tofile:.../app-showcase/.objectstack/data/dev.db; built客户回访 (app.customer_visit_app)via the AI assistant, published it, restarted, and the app + itsvisitobject survived (active). Previously this was wiped on every restart.🤖 Generated with Claude Code