Not able to update my User Data

I have successfully created schema and pushed db using Prisma but not able to populate the data whenever I do this it send me an error of invalid url string
62 Replies
Percy
Percy6mo ago
Project ID: 3bfe0b93-74ce-47e0-a1e4-e71cf755eefd
Anonymous
Anonymous6mo ago
Railway
404 - Page not found
Railway is an infrastructure platform where you can provision infrastructure, develop with that infrastructure locally, and then deploy to the cloud.
Anonymous
Anonymous6mo ago
@Answer Overflow kindly help it shows my scheam is succesfully linked with prisma n railway but is not able to create a user it gives
Anonymous
Anonymous6mo ago
No description
Anonymous
Anonymous6mo ago
this error I an not able to debug the error
Anonymous
Anonymous6mo ago
actually its a sql database n I adding the same project url to my env it clearly makes the use of env while npx prisma db push but not while creating user
Brody
Brody6mo ago
i recommend postgres so please read those docs pages
Anonymous
Anonymous6mo ago
ok could you also help me with sql mysql
Anonymous
Anonymous6mo ago
Yeah I read those n I am applying the same just wanted to ask does the use of MYSQL_URL from the db is only sufficient to connect to prisma?
Brody
Brody6mo ago
please read the docs pages ive linked they will answer your questions
Anonymous
Anonymous6mo ago
well it didn't help
Anonymous
Anonymous6mo ago
No description
Brody
Brody6mo ago
thats a .env file, do you have it in a service variable too?
Anonymous
Anonymous6mo ago
generator client {
provider = "prisma-client-js"
}

datasource db {
provider = "mysql"
url =env("DATABASE_URL")
relationMode = "prisma"
}

model User {
id String @id @default(uuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
entries JournalEntry[]
clerkId String @unique
email String @unique
}

model JournalEntry {
id String @id @default(uuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
content String @db.Text
analysis Analysis?
userId String
user User @relation(fields: [userId], references: [id])

@@index([userId]) //make unique references
}

model Analysis {
id String @id @default(uuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
entryId String
entry JournalEntry @relation(fields: [entryId], references: [id])
mood String
summary String @db.Text
color String
negative Boolean

@@unique([entryId])
}
generator client {
provider = "prisma-client-js"
}

datasource db {
provider = "mysql"
url =env("DATABASE_URL")
relationMode = "prisma"
}

model User {
id String @id @default(uuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
entries JournalEntry[]
clerkId String @unique
email String @unique
}

model JournalEntry {
id String @id @default(uuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
content String @db.Text
analysis Analysis?
userId String
user User @relation(fields: [userId], references: [id])

@@index([userId]) //make unique references
}

model Analysis {
id String @id @default(uuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
entryId String
entry JournalEntry @relation(fields: [entryId], references: [id])
mood String
summary String @db.Text
color String
negative Boolean

@@unique([entryId])
}
no
Brody
Brody6mo ago
please enclose al code in triple back ticks
Anonymous
Anonymous6mo ago
ok
Brody
Brody6mo ago
then do that
Anonymous
Anonymous6mo ago
could you give me any example I didn't get what you said
Brody
Brody6mo ago
please read the service variables docs guide https://docs.railway.app/guides/variables#autocomplete-dropdown
Anonymous
Anonymous6mo ago
ok what I understood is that I need to add a new variable in my variables on railway with same name as in env to make its connection successful or am I going wrong
Brody
Brody6mo ago
correct
Anonymous
Anonymous6mo ago
ok
Brody
Brody6mo ago
please read this
Anonymous
Anonymous6mo ago
yeah I read but I am not able to find what variable name would suits me as not auto completion was provided as I typed in
Brody
Brody6mo ago
show me a screenshot of your railway project
Anonymous
Anonymous6mo ago
ok
Anonymous
Anonymous6mo ago
No description
Brody
Brody6mo ago
that's not what I asked for a screenshot of the project, not of your database
Anonymous
Anonymous6mo ago
oh ok
Anonymous
Anonymous6mo ago
would this work
No description
Brody
Brody6mo ago
no that's still just a service
Anonymous
Anonymous6mo ago
oh
Brody
Brody6mo ago
full project screenshot, don't crop anything
Anonymous
Anonymous6mo ago
don't mind its my first time use of railway
Anonymous
Anonymous6mo ago
No description
Brody
Brody6mo ago
where is your app service?
Anonymous
Anonymous6mo ago
How to do that earlier I guess there was no use of those or what actually I was watching a tutorial there they didn't use any such service
Brody
Brody6mo ago
how would you deploy your code to railway without a service for your code?
Anonymous
Anonymous6mo ago
ok my bad what are the steps for that
Brody
Brody6mo ago
have you not yet deployed your code to railway?
Anonymous
Anonymous6mo ago
actually what earlier tried was pushing my db to railway using prisma but I didn't know anything about service or deployment
Brody
Brody6mo ago
do you have your code on github?
Anonymous
Anonymous6mo ago
yess
Brody
Brody6mo ago
then deploy it from github, click the + new button
Anonymous
Anonymous6mo ago
ok I want to ask will this db n service how would they be connected or will the service will have its own separate db?
Brody
Brody6mo ago
I have a feeling you haven't been reading the docs pages I've linked you?
Anonymous
Anonymous6mo ago
no no its not that I understood that url would be added into the service variable
Brody
Brody6mo ago
the docs never said that though? the docs point out that you need to add your own service variables to your apps service
Anonymous
Anonymous6mo ago
yeah I am doing but in that variable what is needed to be add what not I didn't get like for example if I wanted add a variable for a mysql database which one I should choose
No description
Brody
Brody6mo ago
the 4th one
Anonymous
Anonymous6mo ago
ok
Brody
Brody6mo ago
then after you add it you can go back and change it's name to the name of the variable you use in your code
Anonymous
Anonymous6mo ago
ok and the value will be the db url of db ?
Brody
Brody6mo ago
yes that's the 4th option
Anonymous
Anonymous6mo ago
ok what if I select 1st then what will be the value for that or will selecting the 4th one will do my work
Brody
Brody6mo ago
you want to add the 4th variable
Anonymous
Anonymous6mo ago
yess
Brody
Brody6mo ago
that's the only one prisma needs
Anonymous
Anonymous6mo ago
okk yeah it worked thanks a lot
Brody
Brody6mo ago
no problem