blob: 0866313092c6eb4ed53bd6ce3651e018720db4dd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
CREATE TABLE `categorias` (
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
`nombre` text NOT NULL
);
--> statement-breakpoint
CREATE UNIQUE INDEX `categorias_nombre_unique` ON `categorias` (`nombre`);--> statement-breakpoint
CREATE TABLE `productos` (
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
`nombre` text NOT NULL,
`stock` integer,
`precio` real,
`categoria_id` integer,
FOREIGN KEY (`categoria_id`) REFERENCES `categorias`(`id`) ON UPDATE no action ON DELETE no action
);
--> statement-breakpoint
CREATE UNIQUE INDEX `productos_nombre_unique` ON `productos` (`nombre`);
|