Skip to content

Instantly share code, notes, and snippets.

@ikupenov
ikupenov / base.ts
Created November 10, 2024 09:58
Drizzle RLS DB with Policies
// schema/entities/base.ts
export const getBaseEntityProps = () => ({
id: uuid("id")
.default(sql`gen_random_uuid()`)
.primaryKey(),
createdAt: timestamp("created_at", { precision: 3 }).notNull().defaultNow(),
});
export const getOwnedBaseEntityProps = () => ({
@ikupenov
ikupenov / db-client.ts
Created February 29, 2024 18:40
Intercepting Drizzle db calls
import { and, type DBQueryConfig, eq, type SQLWrapper } from "drizzle-orm";
import { drizzle } from "drizzle-orm/postgres-js";
import postgres, { type Sql } from "postgres";
import { type AnyArgs } from "@/common";
import {
type DbClient,
type DbTable,
type DeleteArgs,
@ikupenov
ikupenov / cloudSettings
Created February 6, 2017 00:36
Visual Studio Code Sync Settings Gist
{"lastUpload":"2017-02-06T00:36:40.699Z","extensionVersion":"v2.4.3"}