-- Car Wash module (wiki/decisions/venue-modules.md): admin master data (categories, -- services, the category × service price matrix) + the order rows that are the wash -- desk's queue. Orders freeze names + price at intake; their life is signed onto the -- ledger (carwash_order / carwash_payment). Additive; tables exist whether or not the -- module is entitled/activated at a site (modules are always migrated). CREATE TABLE `carwash_categories` ( `id` text PRIMARY KEY NOT NULL, `name` text NOT NULL, `sort_order` integer DEFAULT 0 NOT NULL, `active` integer DEFAULT true NOT NULL, `created_at` text DEFAULT (current_timestamp) NOT NULL, `deleted_at` text, `deleted_by` text );--> statement-breakpoint CREATE TABLE `carwash_services` ( `id` text PRIMARY KEY NOT NULL, `name` text NOT NULL, `sort_order` integer DEFAULT 0 NOT NULL, `active` integer DEFAULT true NOT NULL, `created_at` text DEFAULT (current_timestamp) NOT NULL, `deleted_at` text, `deleted_by` text );--> statement-breakpoint CREATE TABLE `carwash_prices` ( `category_id` text NOT NULL, `service_id` text NOT NULL, `price_minor` integer NOT NULL, PRIMARY KEY(`category_id`, `service_id`), FOREIGN KEY (`category_id`) REFERENCES `carwash_categories`(`id`) ON UPDATE no action ON DELETE no action, FOREIGN KEY (`service_id`) REFERENCES `carwash_services`(`id`) ON UPDATE no action ON DELETE no action );--> statement-breakpoint CREATE TABLE `carwash_orders` ( `id` text PRIMARY KEY NOT NULL, `identity` text NOT NULL, `plate` text, `category_id` text NOT NULL, `category_name` text NOT NULL, `service_id` text NOT NULL, `service_name` text NOT NULL, `price_minor` integer NOT NULL, `currency` text NOT NULL, `pay_at` text NOT NULL, `status` text DEFAULT 'open' NOT NULL, `created_at` text NOT NULL, `created_by` text NOT NULL, `done_at` text, `done_by` text, `paid_at` text, `paid_by` text, `tender` text, `payment_event_id` text, `validation_event_id` text, `void_at` text, `void_by` text, `void_reason` text );--> statement-breakpoint CREATE INDEX `carwash_orders_identity_idx` ON `carwash_orders` (`identity`);--> statement-breakpoint CREATE INDEX `carwash_orders_status_idx` ON `carwash_orders` (`status`);