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 );