UNPKG

create-t3-app

Version:

Create web application with the t3 stack

28 lines (24 loc) 850 B
// Example model schema from the Drizzle docs // https://orm.drizzle.team/docs/sql-schema-declaration import { sql } from "drizzle-orm"; import { index, mysqlTableCreator } from "drizzle-orm/mysql-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 = mysqlTableCreator((name) => `project1_${name}`); export const posts = createTable( "post", (d) => ({ id: d.bigint({ mode: "number" }).primaryKey().autoincrement(), name: d.varchar({ length: 256 }), createdAt: d .timestamp() .default(sql`CURRENT_TIMESTAMP`) .notNull(), updatedAt: d.timestamp().onUpdateNow(), }), (t) => [index("name_idx").on(t.name)] );