summaryrefslogtreecommitdiffstats
path: root/src/db/schema.ts
diff options
context:
space:
mode:
authorAlberto Duarte Delgado <alberto@albertoduarte.com>2026-03-25 15:32:20 +0000
committerAlberto Duarte Delgado <alberto@albertoduarte.com>2026-03-25 15:32:20 +0000
commit7809ccbba56be8c5377f94cf2d287a0e1521fdc1 (patch)
tree1c590049df5546f141eeb3bf58ad5ea9d1e0fbf6 /src/db/schema.ts
parentd071a19fdeb0fc369e356004118f59a7fe4fed91 (diff)
Initial commit: App Oficina base project
Diffstat (limited to 'src/db/schema.ts')
-rw-r--r--src/db/schema.ts43
1 files changed, 43 insertions, 0 deletions
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