t3-code-android-nightly/.repos/alchemy-effect/packages/alchemy/test/Cloudflare/D1/fixtures/drizzle-schema.ts
Julius Marminge 108e01746c
Upgrade Effect and Alchemy betas (#4643)
Prepare Relay production infrastructure for the PlanetScale PS_20 HA topology, upgrade Effect and Alchemy to compatible betas, reconcile migration state, and preserve patched MCP session termination behavior.\n\nCo-authored-by: codex <codex@users.noreply.github.com>
2026-07-27 16:21:02 +02:00

30 lines
848 B
TypeScript

import { defineRelations } from "drizzle-orm";
import { integer, sqliteTable, text } from "drizzle-orm/sqlite-core";
export const Users = sqliteTable("users", {
id: integer("id").primaryKey({ autoIncrement: true }),
email: text("email").notNull().unique(),
name: text("name").notNull(),
});
export type User = typeof Users.$inferSelect;
export const Posts = sqliteTable("posts", {
id: integer("id").primaryKey({ autoIncrement: true }),
userId: integer("user_id")
.notNull()
.references(() => Users.id, { onDelete: "cascade" }),
title: text("title").notNull(),
});
export type Post = typeof Posts.$inferSelect;
export const relations = defineRelations({ Users, Posts }, (t) => ({
Users: {
posts: t.many.Posts(),
},
Posts: {
user: t.one.Users({
from: t.Posts.userId,
to: t.Users.id,
}),
},
}));