MySQL usage example #92
Replies: 4 comments 4 replies
-
Im having a issue now let me check first .. |
Beta Was this translation helpful? Give feedback.
-
I'm planning to add a branch for MySQL migrations soon (I'll try to work on it Thursday). |
Beta Was this translation helpful? Give feedback.
-
Sure that one above is working as intended but im no longer able to login :v not even on the old one and the 1.0.0 |
Beta Was this translation helpful? Give feedback.
-
@ianlucas There is a mistake above preventing from login in, on: 24 - 'inventory String' -> 'inventory String @db.LongText' should be 'inventory String? @db.LongText' |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
My way to make it work with mysql on 1.0.0:
12 - provider = "postgres" -> provider = "mysql"
24 - 'inventory String' -> 'inventory String? @db.LongText'
46 - 'body String' -> 'body String @db.LongText'
In mysql String will translate to varchar which is 191 lenght, so String @db.LongText translates more correctly to 4GB of text compatible with string of postgres of 1GB of text.
There is no need to change more types because there wont be more then 191 characters on any of it if needed change to String @db.LongText
//Full changes
model User {
authTokens ApiAuthToken[]
avatar String
caches UserCache[]
createdAt DateTime @default(now())
groups UserGroup[]
id String @id
inventories UserDomainInventory[]
inventory String
name String
overwrites UserRule[]
preferences UserPreference?
syncedAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
To:
model User {
authTokens ApiAuthToken[]
avatar String
caches UserCache[]
createdAt DateTime @default(now())
groups UserGroup[]
id String @id
inventories UserDomainInventory[]
inventory String? @db.LongText
name String
overwrites UserRule[]
preferences UserPreference?
syncedAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model UserCache {
@@id([url, userId])
args String?
body String
timestamp DateTime
url String
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
userId String
}
To:
model UserCache {
@@id([url, userId])
args String?
body String @db.LongText
timestamp DateTime
url String
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
userId String
}
Beta Was this translation helpful? Give feedback.
All reactions