1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
;
import { relations } from 'drizzle-orm';
import { integer, real, sqliteTable, text } from 'drizzle-orm/sqlite-core';
export const personas = sqliteTable('personas', {
id: integer('id').primaryKey({ autoIncrement: true }),
nombre: text('nombre').notNull(),
edad: integer('edad'),
});
/*
export const categorias = sqliteTable('categorias', {
id: integer('id').primaryKey({ autoIncrement: true }),
nombre: text('nombre').unique().notNull(),
});
export const productos = sqliteTable('productos', {
id: integer('id').primaryKey({ autoIncrement: true }),
nombre: text('nombre').unique().notNull(),
stock: integer('stock'),
precio: real('precio'),
categoriaId: integer('categoria_id').references(() => categorias.id),
});
export const categoriasRelations = relations(categorias, ({ many }) => ({
productos: many(productos),
}));
export const productosRelations = relations(productos, ({ one }) => ({
pais: one(categorias, {
fields: [productos.categoriaId],
references: [categorias.id],
}),
}));
*/
|