health-petal/packages/data-manager-sqlite/drizzle/0003_useful_ultron.sql
2026-05-23 16:20:42 +05:30

14 lines
610 B
SQL

CREATE TABLE `stock_batches` (
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
`product_id` integer NOT NULL,
`arrived` text NOT NULL,
`batch_no` text NOT NULL,
`mfg` text NOT NULL,
`expiry` text NOT NULL,
`rack_id` integer,
`distributor_id` integer,
`is_default` integer DEFAULT false NOT NULL,
FOREIGN KEY (`product_id`) REFERENCES `products`(`id`) ON UPDATE no action ON DELETE no action,
FOREIGN KEY (`rack_id`) REFERENCES `storage_spaces`(`id`) ON UPDATE no action ON DELETE no action,
FOREIGN KEY (`distributor_id`) REFERENCES `distributors`(`id`) ON UPDATE no action ON DELETE no action
);