UNPKG

create-t3-app

Version:

Create web application with the t3 stack

28 lines (24 loc) 897 B
// Example model schema from the Drizzle docs // https://orm.drizzle.team/docs/sql-schema-declaration import { sql } from "drizzle-orm"; import { index, pgTableCreator } from "drizzle-orm/pg-core"; /** * This is an example of how to use the multi-project schema feature of Drizzle ORM. Use the same * database instance for multiple projects. * * @see https://orm.drizzle.team/docs/goodies#multi-project-schema */ export const createTable = pgTableCreator((name) => `project1_${name}`); export const posts = createTable( "post", (d) => ({ id: d.integer().primaryKey().generatedByDefaultAsIdentity(), name: d.varchar({ length: 256 }), createdAt: d .timestamp({ withTimezone: true }) .default(sql`CURRENT_TIMESTAMP`) .notNull(), updatedAt: d.timestamp({ withTimezone: true }).$onUpdate(() => new Date()), }), (t) => [index("name_idx").on(t.name)] );