From 7809ccbba56be8c5377f94cf2d287a0e1521fdc1 Mon Sep 17 00:00:00 2001 From: Alberto Duarte Delgado Date: Wed, 25 Mar 2026 15:32:20 +0000 Subject: Initial commit: App Oficina base project --- src/db/schema.ts | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 src/db/schema.ts (limited to 'src/db/schema.ts') diff --git a/src/db/schema.ts b/src/db/schema.ts new file mode 100644 index 0000000..322d78d --- /dev/null +++ b/src/db/schema.ts @@ -0,0 +1,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], + }), +})); + +*/ \ No newline at end of file -- cgit v1.2.3-54-g00ecf