this repo has no description
1import { pgTable, index, integer, text } from "drizzle-orm/pg-core";
2import { createSelectSchema } from "drizzle-orm/valibot";
3
4export const pokemon = pgTable("pokemon", {
5 id: integer().primaryKey(),
6 name: text().notNull(),
7 dexId: integer("dex_id").notNull(),
8});
9
10export const pokemonSelectSchema = createSelectSchema(pokemon);
11
12export const pokemonTypes = pgTable(
13 "pokemon_types",
14 {
15 id: integer().primaryKey(),
16 pokemonId: integer("pokemon_id")
17 .notNull()
18 .references(() => pokemon.id),
19 typeId: integer("type_id")
20 .notNull()
21 .references(() => types.id),
22 },
23 (table) => [index("idx_pt_type").on(table.typeId), index("idx_pt_pokemon").on(table.pokemonId)],
24);
25
26export const pokemonTypesSelectSchema = createSelectSchema(pokemonTypes);
27
28export const types = pgTable("types", {
29 id: integer().primaryKey(),
30 name: text().notNull(),
31});
32
33export const typesSelectSchema = createSelectSchema(types);