Skip to content

Instantly share code, notes, and snippets.

@vaso991
Created May 30, 2024 13:54
Show Gist options
  • Save vaso991/ad5df41cc626c3e8eef59894b39e6a37 to your computer and use it in GitHub Desktop.
Save vaso991/ad5df41cc626c3e8eef59894b39e6a37 to your computer and use it in GitHub Desktop.
Drizzle Postgis
import { pgTable, serial, varchar, timestamp } from "drizzle-orm/pg-core";
import { models } from 'drizzle-postgis';
export const users = pgTable('users', {
id: serial('id').primaryKey(),
name: varchar('name', { length: 50 }),
location: models.point('location', { srid: 4326 }),
createdAt: timestamp('createdAt').notNull().defaultNow(),
updatedAt: timestamp('updatedAt').notNull().defaultNow().$onUpdate(() => new Date())
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment