Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow durable objects migrations within environments #729

Closed
threepointone opened this issue Mar 30, 2022 · 4 comments · Fixed by #5995 or #6038
Closed

feat: allow durable objects migrations within environments #729

threepointone opened this issue Mar 30, 2022 · 4 comments · Fixed by #5995 or #6038
Assignees
Labels
bug Something that isn't working

Comments

@threepointone
Copy link
Contributor

We let folks define [durable_objects] under environments (in fact, we demand it), so one of the two should be true -

  • Either we should verify that the shape of [durable_objects] should be the same across environments (except for DOs with script_name?)
  • Or [migrations] should be defined under environments as well.

I think it should be the former, but open to suggestions.

@threepointone threepointone changed the title feat: additional durable objects migrations Mar 31, 2022
@petebacondarwin
Copy link
Contributor

What happens if you are developing a new DurableObject class, not yet on production, and you want to deploy to staging for testing? It seems that the only way is to decouple the migrations for each environment...

@threepointone threepointone added this to the 2.0 milestone Apr 4, 2022
@threepointone threepointone self-assigned this Apr 4, 2022
@threepointone threepointone modified the milestones: 2.0, 2.1 May 4, 2022
@petebacondarwin petebacondarwin removed this from the Selected for development milestone May 15, 2022
@threepointone threepointone removed their assignment May 16, 2022
@threepointone threepointone added the enhancement New feature or request label May 18, 2022
@petebacondarwin petebacondarwin added bug Something that isn't working and removed enhancement New feature or request labels Feb 16, 2024
@petebacondarwin petebacondarwin changed the title feat: additional durable objects validations Feb 16, 2024
@petebacondarwin
Copy link
Contributor

Given that we are currently sticking with "non-service environments", each environment declared in wrangler.toml results in a new Worker which can have its own Durable Object (DO) declarations. It is very reasonable to have an environment that declares a DO that is not declared in other environments - e.g. adding a new DO in staging before sending it to production, removing a redundant DO in staging before removing it from production.

Therefore I think it is right that migration should also be defined in environments rather than being only at the top level config.

To avoid backward compatibility concerns it is best to make this an "inheritable" configuration property, which means that it can be simply defined at the top level and then apply to all environments without having to redefined it for each environment.

@petebacondarwin petebacondarwin self-assigned this Feb 16, 2024
@yerol
Copy link

yerol commented Mar 19, 2024

Just got hit by this limitation today. Definitely a must have! I have 2 workers with 2 separate environments (dev & prod) sharing most of their code so they have to stay in the same project. 1 worker uses DO but the other one doesn't. There was no way to deploy the one without DO, unless I removed migrations definition from toml. I wish there was a way to use separate toml files for each environment/worker too.

@WalshyDev
Copy link
Member

Hit this today too, we should definitely be supporting this per-env.
cc: @petebacondarwin @RamIdeas

I imagine others will hit this too (is this something you have ran into @jahands with your work?)

petebacondarwin added a commit that referenced this issue Jun 7, 2024
By making the `migrations` key inheritable, users can provide different migrations
for each wrangler.toml environment.

Resolves [#729](#729)
petebacondarwin added a commit that referenced this issue Jun 7, 2024
By making the `migrations` key inheritable, users can provide different migrations
for each wrangler.toml environment.

Resolves [#729](#729)
petebacondarwin added a commit that referenced this issue Jun 14, 2024
* Remove unused jest type from Pages Functions tsconfig

* feat: allow Durable Object migrations to be overridable in environments

By making the `migrations` key inheritable, users can provide different migrations
for each wrangler.toml environment.

Resolves [#729](#729)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something that isn't working
4 participants