Disland

Information about the Disland application.

Disland was internally using Drizzle for saving data to the database, but one thing was odd & weird, that made us switch fully to Prisma.

1. Drizzle's db.insert is weird.

So, when you use db.insert you get a object with some random stuff, like .name, .fields, etc, which is weird, and would require us to make two queries, one for create and one for getting the actual data, which was something we wanted to avoid.

2. Drizzle relationships are weird.

Drizzle handles relationships by forcing you to add another export & variable to your schema.ts, here's an example:

export const roleTable = pgTable("role", {
     id: text("id").notNull().primaryKey(),
     // ...
});

export const statusTable = pgTable("status", {
     id: text("id").notNull().primaryKey(),
     // ...
})

export const userTable = pgTable("user", {
     id: text("id").notNull().primaryKey(),
     // ...
});

export const userTableRelations = relations(userTable, ({ one, many }) => {
     return {
          status: one(statusTable),
          roles: many(rolesTable)
     }
});

and this wouldn't even work with our setup, it just would crash without any explanation, so we switched to Prisma.

3. The switch

To switch to Prisma, we had to edit every single database call to use Prisma's apis instead of Drizzle's, This took no more than a few minutes for us, thankfully.

You've stumbled upon the new Disland blog! (There's a 99% chance you came here from Andrew's World)

This place is gonna be for general blog stuff like changelogs, code stuff idk how to describe this.

Yeah, I suppose?