This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
test.serial('transaction with RLS', async (t) => { | |
const { db } = t.context; | |
const users = pgTable('users_transactions', { | |
id: serial('id').primaryKey(), | |
name: text('name').notNull(), | |
lastName: text('lastname'), | |
}); | |
await db.execute(sql`drop table if exists ${users}`); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { MySqlTable } from "drizzle-orm/mysql-core"; | |
import { db as drizzleDb } from "./mysql/mysql2"; | |
import { eq } from "drizzle-orm"; | |
import { users } from "./mysql/schema"; | |
interface Reader<T extends MySqlTable & { id: any }> { | |
findAll(): Promise<T["$inferSelect"][]>; | |
findOne(id: number): Promise<T["$inferSelect"] | undefined>; | |
} |