The tutorial was great, and now I’m trying to make a real app and have some questions.
How can I edit the schema of a table after it has existed for a while? (How do migrations work?)
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).
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
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?
Ahhh that was a typo in the code snippets, I just fixed them, thanks!
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.
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:
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?
How can I use SCSS files in Redwood?
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!
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.