Hi to whoever will read this, long time no see! I'm back and am finally able to reveal some stuff I've been working on in the past months.
Tegral PrismaKT
Tegral PrismaKT is a module that generates JetBrains Exposed DAOs and table definitions from your Prisma schema.
In short, automatically get from this:
generator prismakt {
provider = "gradle --console=plain -q runGeneratorInternal"
output = "../build/prismaGeneratedSrc"
exposedTarget = "sql" // or dao
}
datasource db {
provider = "postgresql"
url = "file:./dev.db"
}
model User {
identifier Int @id @default(autoincrement())
email String @unique
name String?
}
To this:
public object UserTable : IdTable<Int>() {
public val email: Column<String> = text(name = "email")
public val name: Column<String?> = text(name = "name").nullable()
public val identifier: Column<EntityID<Int>> = integer(name = "identifier").entityId()
public override val id: Column<EntityID<Int>>
get() = identifier
}
public class UserEntity(
id: EntityID<Int>,
) : Entity<Int>(id) {
public var email: String by UserTable.email
public var name: String? by UserTable.name
public companion object : EntityClass<Int, UserEntity>(UserTable)
}
It integrates into Prisma's existing "generator" concept and generates classes via Prisma's datamodel (DMMF). For more information, check Prisma's article here. Massive thanks to the work done by YassinEldeeb on create-prisma-generator that allowed me to get good documentation on how to do things :)
Status
This will be a "long-life" issue which tracks the progress on PrismaKT. Due to the high complexity of what Prisma can handle, there will be a fairly long period spent debugging things PrismaKT gets totally wrong.
Expected initial release for 0.0.4 along with Tegral Niwen (which is required for this issue)
Initial release: 0.0.4 (planned)
[x] Basic support for Prisma files and JetBrains Exposed SQL or DAO + SQL.
Hi to whoever will read this, long time no see! I'm back and am finally able to reveal some stuff I've been working on in the past months.
Tegral PrismaKT
Tegral PrismaKT is a module that generates JetBrains Exposed DAOs and table definitions from your Prisma schema.
In short, automatically get from this:
To this:
It integrates into Prisma's existing "generator" concept and generates classes via Prisma's datamodel (DMMF). For more information, check Prisma's article here. Massive thanks to the work done by YassinEldeeb on create-prisma-generator that allowed me to get good documentation on how to do things :)
Status
This will be a "long-life" issue which tracks the progress on PrismaKT. Due to the high complexity of what Prisma can handle, there will be a fairly long period spent debugging things PrismaKT gets totally wrong.
Expected initial release for 0.0.4 along with Tegral Niwen (which is required for this issue)
Initial release: 0.0.4 (planned)
Next release: 0.0.5
For alpha release
@@id
fields. This will not be possible with the Exposed DAO API: https://github.com/JetBrains/Exposed/issues/964, but should still be generated for the SQL APIDatabase.connect
calls using Prisma'sdatasource
sectionFor beta release
For stable release