Redwood v0.25.0 🚀

Update: the latest release is now v0.25.1

You’re about to look through these notes and :exploding_head:. Go ahead and take a moment. We’ll wait…

OK, now that you’re back, admittedly there are a lot of changes in this release (we’re looking at you, Prisma :eyes:). But while you see words on a screen including lots of bullet points, what we see is an incredible community of contributors that hammered out 40 merged PRs in just 9 days. Yes, :exploding_head: indeed. Also :rocket:. Lots of :rocket::rocket:

To each and every one of you who contributed, you are simply amazing! And to each and every one of you about to upgrade so you can continue building something amazing, we can’t wait to see what you do with Redwood!

:warning: This release contains Breaking Changes and requires code modifications. See the “Breaking” and “How to Upgrade” sections for more information.

v0.25.0 Highlights :tada:

So. Much. Prisma.

This release upgrades to the new, and greatly improved, Prisma Migrate, which includes new workflows for DB management and a :sparkles: new Prisma CLI. It’s fancy. But it changes a lot of things. Like, a whole lot. Don’t worry. The hard integration work is done for you!

  • This upgrade resolves the Notorious EPIPE serverless API connection error :bug: (What, you don’t know about the EPIPE bug? Lucky you.)
  • :point_right: Get started with the new yarn redwood prisma commands via our CLI Doc
  • Bummer :cry:: we can no longer use two DBs, e.g. provider = ["sqlite", "postgresql"] in schema.prisma (aka the Dynamic Provider). See “Breaking” and “How to Upgrade” sections below.
  • Have a Production DB? You’ll need to, um, migrate it to the new Prisma Migrate! Check out this handy guide covering both local dev and production DB upgrade steps. :eyes:

Scaffold Generators now Support Prisma @relations

With some exceptions about syntax (hint: no @@id), you can now use Redwood’s Scaffold generators with both one-to-many and many-to-many Prisma Schema relations.

Changed

  • Generators: Scaffolded many-to-many relationship #1758 by @cannikin :tada:
  • Generators: Remove warning if you scaffold a model with a relation #1757 by @cannikin
  • CLI: restructure and update Deploy command and change Setup Deploy command template #1747 by @thedavidprice :warning:
  • CLI: Rebuild Prisma Client between upgrades #1155 by @noire-munich
  • CLI: improve rw prisma command options handling #1746 by @thedavidprice
  • CLI: Improvements to rw prisma alias #1750 by @peterp
  • CLI: Prisma migrate dev now handles schema path with spaces #1753 #1762 by @dthyresson
  • CLI: Specify node_env before running build web #1755 by @dac09
  • CLI: Disable --version and -v for prisma alias #1767 by @peterp
  • CLI: yarn rw prisma commands now show a little tip #1772 by @dac09
  • Tests: MockProvider — Wrap children in LocationProvider #1681 by @Tobbe
  • Tests: Update Test command to use new Prisma command #1745 by @thedavidprice
  • Tests: use prisma db push for test DB #1768 by @thedavidprice
  • TS: Router: Explicitly build types #1722 by @Tobbe
  • TS: Router: Automatically import .ts Page files #1723 by @Tobbe
  • TS: Format generated *.d.ts files #1724 by @Tobbe
  • TS: Fix router typescript problem #1737 by @dac09
  • TS: Specify types for the router package #1741 by @dac09
  • Internal: update all contributors and add forrest and kim-adeline #1710 #1763 by @thedavidprice
  • Internal: Don’t run PR build actions on forks #1712 by @Tobbe
  • Internal: Updated Status of Storybook in Technologies #1735 by @VinayaSathyanarayana
  • Internal: update CRWA template remove dynamic provider and related copy #1743 by @thedavidprice
  • Internal: Make e2e tests use local packages #1761 by @peterp
  • Prisma: upgrade Prisma v2.16.0/1 and replace rw db commands with rw prisma #1720 #1766 #1774 by @thedavidprice :tada::warning:
    • See “Breaking” and “How to Upgrade” sections below
    • Release Notes: v2.13.0, v2.13.1, v2.14.0, v2.15.0, v2.16.0, v2.16.1
      • HIGHLIGHTS: New Prisma Migrate (preview), Native DB types support (Preview), Integrated database seeding (Preview), Improved API for filtering arrays in PostgreSQL, More powerful counting of records using select
      • Preview Features: createMany, orderBy, groupBy
      • see Prisma Release Notes above for many many more updates

Added

Fixes

  • Structure: Fix import in RWProject in rw/structure #1707 by @dac09
  • Structure: “pisma” is probably “prisma” #1779 by @jangxyz
  • Tests: Ensure all data is removed during the teardown step #1714 by @tctrautman
  • Cells: don’t pass cell children to useQuery #1734 by @wminshew
  • Storybook: applying afterQuery in storybook mocks #1740 by @dac09
  • Internal: CRWA Readme — Add missing comma #1715 by @Tobbe
  • Internal: Fix obejct typo #1716 by @ajcwebdev
  • Internal: Corrects dataMigrate install instructions #1718 by @dthyresson
  • Internal: Fix env loading in users webpack config #1729 by @dac09
  • CLI: Fix rw prisma alias bugs #1760 by @peterp

Breaking :warning:

Due to Prisma’s release of the new Migrate feature + CLI (and deprecation of previous), this release includes several breaking changes that affect all projects:

  • previous Prisma migrations are deprecated and replaced
    • this means your local dev DB is broken, but also fixable (see guides and “how to upgrade” below)!
    • and, yes, you’ll need to walk through some step to update your production DB’s migrations
  • Dynamic Provider deprecated
  • redwood db [option] command deprecated and replaced with redwood prisma [option]
    • this also means redwood db seed is deprecated and replaced with Prisma DB Seed
  • Deployment command set deprecated and replaced

1. Deprecated yarn rw db command

Due to the new Prisma CLI, all rw db commands are now deprecated.

  • They’ve been replaced with new rw prisma commands — check out the Redwood CLI Doc
  • For a full guide to the Prisma CLI, see this Doc
  • NOTE: rw db seed has been replaced with rw prisma db seed — code modification required

2. Breaking: Deployment Command

Because the redwood db command is deprecated, the command string used to build for deployment has also been replaced.

  • Use yarn rw deploy [target] — see the Doc
  • Vercel hard codes the default Build Command into their dashboard. You’ll need to log in and override if it’s not using rw deploy
  • Netlify requires a code mod to your project’s netlify.toml

3. Old Migrations are Broken. Long live the New Prisma Migrations!

Along with new commands to manage your DB in development and Production, you’ll need to take steps to upgrade to use the New Migrations. It’s non-destructive for production DBs. See “How to Upgrade” below and the walkthrough guide.

4. Prisma’s Dynamic Provider is Deprecated: No more dual DBs

You can no longer use both SQLite and Postgres at the same time, which previously was set in schema.prisma as provider = ["sqlite", "postgresql"]. From here on out you’ll have to make a choice. It’s a bummer, yes. But it’s better for us all in the long run. See “How to Upgrade” below.


How to upgrade Redwood to the latest v0.25

:point_right: IMPORTANT: Skipping versions when upgrading is not recommended and will likely cause problems. Do read through all Release Notes between your current version and this latest version. Each minor release will likely require you to implement breaking change fixes and apply manual code modifications.

Most of these steps are covered in this Upgrading to Redwood v0.25 Guide, including steps to upgrade your production DB using the new prisma migrate resolve command

Upgrade Packages

Typically we suggest making code modifications before you upgrade packages. However, in this release, you’ll need the new packages to run through code modification steps.

Run the following command within your App’s directory:

yarn rw upgrade

Need help or having trouble upgrading packages? See this forum topic for manual upgrade instructions and general upgrade help.

Manual Code Modifications

1. Reminder: Remove Directly Installed Prisma Packages

If you’ve previously added Prisma packages directly to your project package.json or api/package.json, now’s the time to remove them. Once you do, be sure to run yarn --force

2. No more Dynamic Provider

If applicable to your project, you need to remove provider = ["sqlite", "postgresql"] from schema.prisma and replace it with either provider = "sqlite" or `provider = “postgresql” :cry:

3. Upgrading DBs to use the New Prisma Migrate

See the Upgrading to Redwood v0.25 Guide to transition both your local dev DB and (if applicable) production DB.

3. Want to deploy? Use the new yarn rw deploy [target] command

  • see the CLI Doc for reference
  • Netlify: in the file netlify.toml, you need to replace the Build Command with yarn rw deploy netlify
  • Vercel: the command is set in the Vercel dashboard “Deploy Setting”. Examine the build command and make sure it’s yarn rw deploy vercel, overriding if necessary
  • AWS Lambdas via Serverless: the command has changed to be yarn rw deploy aws
  • Note about Self-hosting: there is no specific command, however, the build command string has changed to yarn install && yarn rw build && yarn rw prisma deploy && yarn rw prisma db seed. (The Seed step is optional.) See this Doc.

4. Rename your Seeds file :seedling:

Rename the file api/db/seeds.js to api/db/seed.js to be compatible with the new command yarn rw prisma db seed.

5. Rename Prisma findOne → findUnique

Prisma deprecated findOne. Search your project and replace with findUnique as needed.

6. You made it!

Redwood is rewarding on its own. But this upgrade process was way beyond normal. So now you get a well-deserved :trophy:

Happy coding! We hope you build something amazing (and then tell us about it).


Redwood Releases on GitHub

You can see all Redwood release notes and version history on GitHub

10 Likes

Tomorrow’s breakfast :rocket:

2 Likes

Odd question to ask but I keep seeing the suggestion of scaffold generator having —prefix there as well as us being able to nominate the layout the scaffold generators create.

Has this merely been discussion with no PR being logged for it ?

Sorry for being greedy , specially given how much awesome redwoodjs has been , but I have been waiting for that update.

Also hopefully we will get someone to contribute on the documentation end. Documentation for @redwoodjs/form and @redwoodjs/web seem a bit lacking. Hopefully we get better documentation on those.

The form part I sometimes feel I should give a crack at writing some documentation specially given things like SelectField has virtually nothing and I have been experimenting on them ; but a bit apprehensive to do so as I am just a hobbiest and sometimes feel not really qualified enough to add the documentation.

Hopefully someone from the core team gets some free time to update those.

With all the Wishlist though Redwoodjs has been absolutely awesome ; don’t remember the last time I feel in love with a framework this much. Tutorial part 2 was amazing too huge kudos to the team :smile:

1 Like

If I understand correctly, in addition to being able to pass yarn rw g scaffold [model] <path/model> (see this section of the docs, you’d also like to be able to do something like yarn rw g scaffold [model] <path/model> --prefix=admin which would result in something like path/admin-model/admin-model.js component structure? If I’m anywhere in the ballpark, you are correct that this is not supported nor are there any relevant PRs. Could you create a new post ( outlining your deserved behavior and use-case) to get the conversation going?

Also hopefully we will get someone to contribute on the documentation end. Documentation for @redwoodjs/form and @redwoodjs/web seem a bit lacking. Hopefully, we get better documentation on those.

I’m looping in @dom here as well. If you would indeed like to help, both Dom and I could coordinate with you to use the outline/topics/draft you’d like to improve, help iterate and edit, and then get into shape for merging.

As a next step you could start a Forum post including Dom and I. Or you could open a PR, start some draft content, and loop in Dom and me.

Suggestions or thoughts otherwise?

Most of all, thanks for your involvement and enthusiasm!

1 Like

You’ve got that spot on :slight_smile: thank you.

I will start working on the draft for form documentation , and will post that as a thread on this forum adding both you and dom.

Might take me a couple of days to get the draft out ; and let’s take it from there :slight_smile:

2 Likes

Patch v0.25.1

We’ve released patch v0.25.1, which fixes two issues:

  1. Restores Prisma CLI interactivity when using yarn rw prisma #1785 #1790 by @dac09
  2. yarn rw dataMigrate install now runs successfully #1787 #1798 by @dthyresson

To upgrade from v0.25.0, please run:

yarn rw upgrade
1 Like