First steps after tutorial

The tutorial was great, and now I’m trying to make a real app and have some questions.

  1. How can I edit the schema of a table after it has existed for a while? (How do migrations work?)

  2. If I want to have 3 tables—Posts, Tags, and a many-to-many joiner table (maybe “PostTags”?)—how can I do it? I followed the example at Relations (Reference) | Prisma Docs but I think it broke things (I needed to remove lines from “sdl” files such as tags: Tag and tagsOnPosts: TagsOnPosts).

  3. At https://redwoodjs.com/tutorial/everyone-s-favorite-thing-to-build-forms#fielderror name="name" where I expected to see name="email" and name="message". Was that a mistake? If not, it’s confusing, so could you please explain?

Thanks!

Hello! Glad you liked the tutorial!

  1. Prisma wants you to edit the database schema only via migrations. So whether that’s changing a column name or data type or anything else, you make the change in schema.prisma and create a new migration. They do a diff of that file compared to the latest state in the latest migration directory, and figure out everything that needs to change to bring the database up-to-date. You can read more in their docs: https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-migrate

  2. Our SDL/service generation is still in development. I wouldn’t guarantee that the many-to-many generation is working 100% yet! Do you need to explicitly define the TagsOnPosts table, or could you let Prisma do it for you? Did you see their syntax for the implicit version?

  3. Ahhh that was a typo in the code snippets, I just fixed them, thanks!

@rob Thanks!

  1. Wow, that’s what I thought based on your tutorial, but it felt so unfamiliar to just edit the schema and have the tool automatically figure out the necessary steps (maybe too good to be true). I see in that link that this declarative rather than imperative migration system is still experimental, but that’s really exciting.

  2. Oh ok. Yep, I saw the implicit version but tend to prefer explicit joiner tables (as it says " For example, to store when the relation was created."). I’ll either switch to implicit or wait for the SDL/service generation to be fixed.

New questions:

  1. I’m interested in building a basic React app that works natively on mobile but also on web. I have found Expo, which is interesting, but I’m having trouble understanding whether it’s a competitor/alternative to Redwood or whether they can be used together. In other words, if I would love to write React code just once and have the app work universally (on web, iOS, and Android), can Redwood handle that? What do you recommend?

  2. How can I use SCSS files in Redwood?

  3. I know redwoodjs /tutorial/wrapping-up mentions helpers for authentication. Do you have an estimate of when a code example of auth will be available (ideally an example that doesn’t require signing up for a paid plan such as Netlify Business Teams to use Netlify Identity)?

I’m VERY impressed with you all and will keep spreading the word!

Thanks very much for everything.

  1. I’ve not heard of Expo, specifically, but you’re naming a challenge that’s been around for a long time. I’m not experienced to tell you what’s currently the best bet for “write once, deploy to all clients”. Personally, I’d be suspect of anyone who says they’ve nailed it. With Redwood, there is the concept of Sides, currently represented by API and Web directories. The work is in process for sides to be extensible, e.g. capability to add future sides like “Electron”, “React Native”, “Vue”, etc – anything that represents a client and can consume the API. [Here’s the work in progress.] (https://github.com/redwoodjs/redwood/pull/355) Assuming Expo is similar to React Native, you could add it as a Side to your App. I realize this doesn’t solve your “write once for all” question, however.
  2. There’s no set way, so you’ll need to configure it yourself. This topic includes many comments and links to CSS Setup examples. You might find what you’re looking for in a link or someone there who can help with your questions.
  3. I’d say likely within “weeks”, but we really can’t give a specific estimate. Here’s the tracking Issue to follow, which includes a link to the work in progress. In the meantime, here’s a great guide contributed by the community: How to: Authentication with RedwoodJS
1 Like