Auto Crud

Creating Your First Schema

Create your first schema

Create the following schema in ./server/database/schema.ts:

// /server/database/schema.ts
import { sqliteTable, text, integer } from "drizzle-orm/sqlite-core";

export const users = sqliteTable("users", {
  id: integer("id").primaryKey({ autoIncrement: true }),
  name: text("name").notNull(),
  email: text("email").notNull().unique(),
  password: text("password").notNull(),
  avatar: text("avatar").notNull(),
  createdAt: integer("created_at", { mode: "timestamp" }).notNull(),
});

Remember to run the generate command after editing the schema:

bun run db:generate