CREATE TABLE `daily_productions` (
	`id` int AUTO_INCREMENT NOT NULL,
	`reference` varchar(80) NOT NULL,
	`stockItemId` int NOT NULL,
	`stockLotId` int NOT NULL,
	`productionDateUtcMs` bigint NOT NULL,
	`quantityCartons` int NOT NULL,
	`notes` text,
	`createdByUserId` int NOT NULL,
	`updatedByUserId` int,
	`deletedAt` timestamp NULL DEFAULT NULL,
	`createdAt` timestamp NOT NULL DEFAULT (now()),
	`updatedAt` timestamp NOT NULL DEFAULT (now()) ON UPDATE CURRENT_TIMESTAMP,
	CONSTRAINT `daily_productions_id` PRIMARY KEY(`id`),
	CONSTRAINT `daily_productions_reference_unique` UNIQUE(`reference`)
);
--> statement-breakpoint
CREATE INDEX `daily_productions_date_index` ON `daily_productions` (`productionDateUtcMs`);--> statement-breakpoint
CREATE INDEX `daily_productions_item_index` ON `daily_productions` (`stockItemId`);