You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
rustybuns deploy: adopt existing Cloudflare resources by the names in the config #140
rustybuns plan/deploy doesn't pass the config's names to Alchemy. The Worker gets no name (the config's name), and D1 gets no databaseName, nor R2 a bucketName (packages/cli/src/gen/alchemy.ts). So Alchemy makes <app>-<id>-<stage>-<random> names, and a stack whose local state is gone plans to create everything again.
What happened: codesplitters is live as Worker codesplitters with D1 codesplitters-db, made with wrangler. rustybuns plan wanted to create a new Worker and a new, empty database beside them, so we deployed with wrangler deploy instead. The same thing already left four orphaned druids-curse-...-DB-live-ryanquinn-* databases (see the cleanup issue).
Fix:
Emit the explicit names: Worker name: cfg.name, D1 name: databaseName, R2 name: bucketName. Alchemy's D1 already adopts a database by name when creating it hits "already exists".
Pass --adopt when nothing's in state.
Careful with live Alchemy-managed apps (hippo, druids): a name change replaces resources there, so do it per app or behind a flag.
Alchemy keeps state in .alchemy/ inside the worktree (Alchemy.localState()), so state is lost when a worktree is deleted. Consider a state store that outlives the worktree.
Activity
rustybuns deploy: targets.edge.adopt takes over existing resources by…