CREATE TABLE `analysis_results` ( `id` int AUTO_INCREMENT NOT NULL, `projectId` int NOT NULL, `cadModelId` int, `type` enum('error_analysis','measurement','compression') NOT NULL, `status` enum('pending','processing','completed','error') NOT NULL DEFAULT 'pending', `resultData` json, `errorStats` json, `measurements` json, `createdAt` timestamp NOT NULL DEFAULT (now()), `updatedAt` timestamp NOT NULL DEFAULT (now()) ON UPDATE CURRENT_TIMESTAMP, CONSTRAINT `analysis_results_id` PRIMARY KEY(`id`) ); --> statement-breakpoint CREATE TABLE `cad_models` ( `id` int AUTO_INCREMENT NOT NULL, `projectId` int NOT NULL, `name` varchar(255) NOT NULL, `format` varchar(32) NOT NULL, `fileSize` bigint NOT NULL, `fileUrl` text, `fileKey` varchar(512), `vertexCount` int DEFAULT 0, `faceCount` int DEFAULT 0, `boundingBox` json, `status` enum('uploading','processing','ready','error') NOT NULL DEFAULT 'uploading', `createdAt` timestamp NOT NULL DEFAULT (now()), `updatedAt` timestamp NOT NULL DEFAULT (now()) ON UPDATE CURRENT_TIMESTAMP, CONSTRAINT `cad_models_id` PRIMARY KEY(`id`) ); --> statement-breakpoint CREATE TABLE `lod_nodes` ( `id` int AUTO_INCREMENT NOT NULL, `projectId` int NOT NULL, `level` int NOT NULL, `nodeIndex` varchar(64) NOT NULL, `pointCount` int NOT NULL, `fileUrl` text, `fileKey` varchar(512), `boundingBox` json NOT NULL, `createdAt` timestamp NOT NULL DEFAULT (now()), CONSTRAINT `lod_nodes_id` PRIMARY KEY(`id`) ); --> statement-breakpoint CREATE TABLE `point_cloud_chunks` ( `id` int AUTO_INCREMENT NOT NULL, `projectId` int NOT NULL, `chunkIndex` int NOT NULL, `fileName` varchar(255) NOT NULL, `fileSize` bigint NOT NULL, `pointCount` bigint DEFAULT 0, `fileUrl` text, `fileKey` varchar(512), `status` enum('pending','uploading','uploaded','processing','ready','error') NOT NULL DEFAULT 'pending', `boundingBox` json, `createdAt` timestamp NOT NULL DEFAULT (now()), `updatedAt` timestamp NOT NULL DEFAULT (now()) ON UPDATE CURRENT_TIMESTAMP, CONSTRAINT `point_cloud_chunks_id` PRIMARY KEY(`id`) ); --> statement-breakpoint CREATE TABLE `projects` ( `id` int AUTO_INCREMENT NOT NULL, `userId` int NOT NULL, `name` varchar(255) NOT NULL, `description` text, `status` enum('uploading','processing','ready','error') NOT NULL DEFAULT 'uploading', `totalPoints` bigint DEFAULT 0, `totalChunks` int DEFAULT 0, `uploadedChunks` int DEFAULT 0, `totalSize` bigint DEFAULT 0, `lodLevels` int DEFAULT 0, `boundingBox` json, `createdAt` timestamp NOT NULL DEFAULT (now()), `updatedAt` timestamp NOT NULL DEFAULT (now()) ON UPDATE CURRENT_TIMESTAMP, CONSTRAINT `projects_id` PRIMARY KEY(`id`) );