Yarn rw g sdl quit working

I have completed the tutorial and started working on extending the blog bit by adding a users table and using bcrypt for hashing passwords and jwt for tokens. I successfully created the table and added it to the migrations. But when I tried generating the sdl file it fails.

I typed: yarn rw g sdl users

The output is:
⠴ Generating SDL files…
:heavy_multiplication_x: Generating SDL files…
Generating service files…
It just hangs there and does nothing.

Could I manually create the sdl and service files and still have them work as a work around?

Hmm, does a users.sdl.js or users.js service already exist? You should see a message if they do. And you can --force to overwrite them. If that’s not the problem then something else is going on…

Yes you can create everything manually if you want, the generators are just a helper to save you from so much boilerplate typing!

No they don’t exist yet. I had just completed the migrations then went to generate the files. I will try the --force option.

And you definitely named your table users plural and not user? Again, there should be an error message, but we’re moving pretty fast and breaking things all the time, so you never know. :grimacing:

Yes it is definitely named users. Here’s my schema.prism file

datasource DS {
provider = “sqlite”
url = env(“DATABASE_URL”)

generator client {
provider = “prisma-client-js”
binaryTargets = env(“BINARY_TARGET”)

model Post {
id Int @id @default(autoincrement())
title String
body String
createdAt DateTime @default(now())

model Contact {
id Int @id @default(autoincrement())
name String
email String
message String
createdAt DateTime @default(now())

model Users {
id Int @id @default(autoincrement())
username String
password String

Did you create a scaffold for Contact, and did it work without any problems?

Yes Contact worked without any problems.

Is the scaffolding needed before a table is created?

You don’t need the actual table to exist in the database, but you do need it defined in the schema (the SDL generator reads and parses the schema file to create everything).

Could you try making Users singular User and see if the SDL generator works? Prisma recently changed some of their pluralization/singularization logic and it’s possible our generator was relying on some old behavior.

If that doesn’t help, is it possible to put your codebase up on Github so we can take a look?

That was it, it didn’t like the plural. I rolled it back and changed it as suggested and it all worked.

1 Like