Skip to content

Instantly share code, notes, and snippets.

@PaulieScanlon
Last active May 17, 2024 21:58
Show Gist options
  • Save PaulieScanlon/84c06357e8f1ad14cfdd3412da2f0b59 to your computer and use it in GitHub Desktop.
Save PaulieScanlon/84c06357e8f1ad14cfdd3412da2f0b59 to your computer and use it in GitHub Desktop.
Example InferSectionModel
import { pgTable, serial, varchar, timestamp, decimal} from 'drizzle-orm/pg-core';
+ import { type InferSelectModel } from 'drizzle-orm';
export const analytics = pgTable('analytics', {
id: serial('id').primaryKey(),
date: timestamp('date').notNull(),
slug: varchar('slug', { length: 255 }).notNull(),
referrer: varchar('referrer', { length: 255 }),
flag: varchar('flag', { length: 16 }),
country: varchar('country', { length: 255 }),
city: varchar('city', { length: 255 }),
latitude: decimal('latitude'),
longitude: decimal('longitude'),
});
+ export type AnalyticsType = InferSelectModel<typeof analytics>;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment