-- Merchant validation programs (2026-07-13). In-park merchants (bar / lavazh) validate a -- customer's ticket so the BOOTH settlement discounts the fee — the merchant only -- validates, all money and paper stay at the booth. The /setup/site checkboxes toggle the -- WELL-KNOWN rows ("bar", "lavazh"); a future merchant is a new row, not a migration. -- Config is plainly MUTABLE (no versioning): the applied validation is a signed ledger -- event carrying the RESOLVED values, so reproducibility never depends on these rows. -- See wiki/concepts/validation-discounts.md. CREATE TABLE `validation_programs` ( `id` text PRIMARY KEY NOT NULL, `name` text NOT NULL, `mode` text DEFAULT 'comp' NOT NULL, `minutes` integer, `percent` integer, `max_amount_minor` integer, `max_per_day` integer, `active` integer DEFAULT 0 NOT NULL, `created_at` text DEFAULT (current_timestamp) NOT NULL, `deleted_at` text, `deleted_by` text ); --> statement-breakpoint -- WHICH users may apply a program: the apply guard is `validation:create` AND a binding -- row here — a bar user can never apply the lavazh program. CREATE TABLE `validation_program_users` ( `program_id` text NOT NULL, `user_id` text NOT NULL, FOREIGN KEY (`program_id`) REFERENCES `validation_programs`(`id`) ON UPDATE no action ON DELETE no action, FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE no action ); --> statement-breakpoint CREATE UNIQUE INDEX `validation_program_users_program_id_user_id_unique` ON `validation_program_users` (`program_id`,`user_id`);