CREATE TABLE `audit_logs` (
	`id` varchar(64) NOT NULL,
	`user_id` varchar(64),
	`action` varchar(160) NOT NULL,
	`entity_type` varchar(120) NOT NULL,
	`entity_id` varchar(64),
	`before` longtext,
	`after` longtext,
	`ip_hash` varchar(128),
	`user_agent` text,
	`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	CONSTRAINT `audit_logs_id` PRIMARY KEY(`id`)
);
--> statement-breakpoint
CREATE TABLE `backups` (
	`id` varchar(64) NOT NULL,
	`storage_key` varchar(500) NOT NULL,
	`filename` varchar(255) NOT NULL DEFAULT '',
	`checksum` varchar(128) NOT NULL,
	`size` bigint NOT NULL,
	`encrypted` boolean NOT NULL DEFAULT true,
	`format_version` int NOT NULL DEFAULT 1,
	`table_count` int NOT NULL DEFAULT 0,
	`record_count` int NOT NULL DEFAULT 0,
	`status` varchar(40) NOT NULL,
	`note` text,
	`created_by` varchar(64),
	`expires_at` datetime,
	`completed_at` datetime,
	`last_verified_at` datetime,
	`last_restored_at` datetime,
	`restore_count` int NOT NULL DEFAULT 0,
	`deleted_at` datetime,
	`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	CONSTRAINT `backups_id` PRIMARY KEY(`id`)
);
--> statement-breakpoint
CREATE TABLE `categories` (
	`id` varchar(64) NOT NULL,
	`name` varchar(160) NOT NULL,
	`slug` varchar(255) NOT NULL,
	`description` text NOT NULL DEFAULT (''),
	`robots_index` boolean NOT NULL DEFAULT false,
	`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	`deleted_at` datetime,
	CONSTRAINT `categories_id` PRIMARY KEY(`id`),
	CONSTRAINT `categories_slug_idx` UNIQUE(`slug`)
);
--> statement-breakpoint
CREATE TABLE `faqs` (
	`id` varchar(64) NOT NULL,
	`question` text NOT NULL,
	`answer` longtext NOT NULL,
	`category` varchar(120) NOT NULL DEFAULT 'general',
	`page_id` varchar(64),
	`sort_order` int NOT NULL DEFAULT 0,
	`active` boolean NOT NULL DEFAULT true,
	`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	`deleted_at` datetime,
	CONSTRAINT `faqs_id` PRIMARY KEY(`id`)
);
--> statement-breakpoint
CREATE TABLE `form_submissions` (
	`id` varchar(64) NOT NULL,
	`form_key` varchar(120) NOT NULL,
	`lead_id` varchar(64),
	`payload` longtext NOT NULL,
	`spam_score` int NOT NULL DEFAULT 0,
	`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	CONSTRAINT `form_submissions_id` PRIMARY KEY(`id`)
);
--> statement-breakpoint
CREATE TABLE `leads` (
	`id` varchar(64) NOT NULL,
	`name` varchar(160) NOT NULL,
	`whatsapp` varchar(30) NOT NULL,
	`email` varchar(254),
	`location` text NOT NULL,
	`building_type` varchar(100) NOT NULL,
	`service` varchar(180) NOT NULL,
	`quantity` int,
	`urgency` varchar(40) NOT NULL,
	`description` longtext NOT NULL,
	`photo_media_id` varchar(64),
	`requested_schedule` datetime,
	`privacy_accepted_at` datetime NOT NULL,
	`status` varchar(40) NOT NULL DEFAULT 'new',
	`assigned_to` varchar(64),
	`utm_source` varchar(160),
	`utm_medium` varchar(160),
	`utm_campaign` varchar(200),
	`utm_content` varchar(200),
	`utm_term` varchar(200),
	`landing_page` text,
	`ip_hash` varchar(128),
	`user_agent` text,
	`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	`deleted_at` datetime,
	CONSTRAINT `leads_id` PRIMARY KEY(`id`)
);
--> statement-breakpoint
CREATE TABLE `login_attempts` (
	`id` varchar(64) NOT NULL,
	`email_hash` varchar(128) NOT NULL,
	`ip_hash` varchar(128) NOT NULL,
	`success` boolean NOT NULL DEFAULT false,
	`attempted_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	`locked_until` datetime,
	CONSTRAINT `login_attempts_id` PRIMARY KEY(`id`)
);
--> statement-breakpoint
CREATE TABLE `media` (
	`id` varchar(64) NOT NULL,
	`storage_key` varchar(500) NOT NULL,
	`filename` varchar(255) NOT NULL,
	`mime_type` varchar(100) NOT NULL,
	`size` bigint NOT NULL,
	`width` int,
	`height` int,
	`alt_text` text,
	`caption` text,
	`uploaded_by` varchar(64),
	`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	`deleted_at` datetime,
	CONSTRAINT `media_id` PRIMARY KEY(`id`),
	CONSTRAINT `media_storage_key_idx` UNIQUE(`storage_key`)
);
--> statement-breakpoint
CREATE TABLE `menu_items` (
	`id` varchar(64) NOT NULL,
	`menu_id` varchar(64) NOT NULL,
	`parent_id` varchar(64),
	`label` varchar(180) NOT NULL,
	`url` text NOT NULL,
	`position` int NOT NULL DEFAULT 0,
	`target` varchar(20) NOT NULL DEFAULT '_self',
	`visible` boolean NOT NULL DEFAULT true,
	`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	`deleted_at` datetime,
	CONSTRAINT `menu_items_id` PRIMARY KEY(`id`)
);
--> statement-breakpoint
CREATE TABLE `menus` (
	`id` varchar(64) NOT NULL,
	`name` varchar(180) NOT NULL,
	`location` varchar(80) NOT NULL,
	`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	`deleted_at` datetime,
	CONSTRAINT `menus_id` PRIMARY KEY(`id`),
	CONSTRAINT `menus_location_idx` UNIQUE(`location`)
);
--> statement-breakpoint
CREATE TABLE `page_blocks` (
	`id` varchar(64) NOT NULL,
	`page_id` varchar(64) NOT NULL,
	`block_type` varchar(80) NOT NULL,
	`position` int NOT NULL,
	`data` longtext NOT NULL,
	`settings` longtext,
	`visible` boolean NOT NULL DEFAULT true,
	`reusable_block_id` varchar(64),
	`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	`deleted_at` datetime,
	CONSTRAINT `page_blocks_id` PRIMARY KEY(`id`)
);
--> statement-breakpoint
CREATE TABLE `page_versions` (
	`id` varchar(64) NOT NULL,
	`page_id` varchar(64) NOT NULL,
	`version` int NOT NULL,
	`snapshot` longtext NOT NULL,
	`author_id` varchar(64),
	`note` text,
	`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	CONSTRAINT `page_versions_id` PRIMARY KEY(`id`),
	CONSTRAINT `page_versions_unique_idx` UNIQUE(`page_id`,`version`)
);
--> statement-breakpoint
CREATE TABLE `pages` (
	`id` varchar(64) NOT NULL,
	`title` varchar(300) NOT NULL,
	`slug` varchar(255) NOT NULL,
	`template` varchar(50) NOT NULL DEFAULT 'default',
	`status` varchar(32) NOT NULL DEFAULT 'draft',
	`author_id` varchar(64),
	`seo_title` varchar(300),
	`meta_description` text,
	`canonical_url` text,
	`robots_index` boolean NOT NULL DEFAULT true,
	`robots_follow` boolean NOT NULL DEFAULT true,
	`published_at` datetime,
	`scheduled_at` datetime,
	`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	`deleted_at` datetime,
	CONSTRAINT `pages_id` PRIMARY KEY(`id`),
	CONSTRAINT `pages_slug_active_idx` UNIQUE(`slug`,`deleted_at`)
);
--> statement-breakpoint
CREATE TABLE `permissions` (
	`id` varchar(64) NOT NULL,
	`key` varchar(120) NOT NULL,
	`description` text NOT NULL DEFAULT (''),
	`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	`deleted_at` datetime,
	CONSTRAINT `permissions_id` PRIMARY KEY(`id`),
	CONSTRAINT `permissions_key_idx` UNIQUE(`key`)
);
--> statement-breakpoint
CREATE TABLE `post_categories` (
	`post_id` varchar(64) NOT NULL,
	`category_id` varchar(64) NOT NULL,
	CONSTRAINT `post_categories_unique_idx` UNIQUE(`post_id`,`category_id`)
);
--> statement-breakpoint
CREATE TABLE `post_tags` (
	`post_id` varchar(64) NOT NULL,
	`tag_id` varchar(64) NOT NULL,
	CONSTRAINT `post_tags_unique_idx` UNIQUE(`post_id`,`tag_id`)
);
--> statement-breakpoint
CREATE TABLE `post_versions` (
	`id` varchar(64) NOT NULL,
	`post_id` varchar(64) NOT NULL,
	`version` int NOT NULL,
	`snapshot` longtext NOT NULL,
	`author_id` varchar(64),
	`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	CONSTRAINT `post_versions_id` PRIMARY KEY(`id`),
	CONSTRAINT `post_versions_unique_idx` UNIQUE(`post_id`,`version`)
);
--> statement-breakpoint
CREATE TABLE `posts` (
	`id` varchar(64) NOT NULL,
	`title` varchar(400) NOT NULL,
	`slug` varchar(255) NOT NULL,
	`excerpt` text NOT NULL DEFAULT (''),
	`content` longtext NOT NULL,
	`featured_image_id` varchar(64),
	`author_id` varchar(64),
	`status` varchar(32) NOT NULL DEFAULT 'draft',
	`focus_keyword` varchar(255),
	`secondary_keywords` longtext,
	`seo_title` varchar(300),
	`meta_description` text,
	`canonical_url` text,
	`og_title` varchar(300),
	`og_description` text,
	`og_image_id` varchar(64),
	`robots_index` boolean NOT NULL DEFAULT true,
	`robots_follow` boolean NOT NULL DEFAULT true,
	`published_at` datetime,
	`scheduled_at` datetime,
	`reading_minutes` int NOT NULL DEFAULT 1,
	`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	`deleted_at` datetime,
	CONSTRAINT `posts_id` PRIMARY KEY(`id`),
	CONSTRAINT `posts_slug_active_idx` UNIQUE(`slug`,`deleted_at`)
);
--> statement-breakpoint
CREATE TABLE `price_categories` (
	`id` varchar(64) NOT NULL,
	`name` varchar(160) NOT NULL,
	`slug` varchar(255) NOT NULL,
	`sort_order` int NOT NULL DEFAULT 0,
	`active` boolean NOT NULL DEFAULT true,
	`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	`deleted_at` datetime,
	CONSTRAINT `price_categories_id` PRIMARY KEY(`id`),
	CONSTRAINT `price_categories_slug_idx` UNIQUE(`slug`)
);
--> statement-breakpoint
CREATE TABLE `price_items` (
	`id` varchar(64) NOT NULL,
	`category_id` varchar(64) NOT NULL,
	`name` varchar(300) NOT NULL,
	`slug` varchar(255) NOT NULL,
	`price` bigint,
	`promo_price` bigint,
	`unit` varchar(80) NOT NULL,
	`price_type` varchar(50) NOT NULL DEFAULT 'service_only',
	`description` text NOT NULL DEFAULT (''),
	`active` boolean NOT NULL DEFAULT true,
	`promo_active` boolean NOT NULL DEFAULT false,
	`sort_order` int NOT NULL DEFAULT 0,
	`last_verified_at` datetime,
	`source_url` text,
	`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	`deleted_at` datetime,
	CONSTRAINT `price_items_id` PRIMARY KEY(`id`),
	CONSTRAINT `price_items_slug_idx` UNIQUE(`slug`)
);
--> statement-breakpoint
CREATE TABLE `project_media` (
	`id` varchar(64) NOT NULL,
	`project_id` varchar(64) NOT NULL,
	`media_id` varchar(64) NOT NULL,
	`role` varchar(40) NOT NULL DEFAULT 'gallery',
	`sort_order` int NOT NULL DEFAULT 0,
	`caption` text,
	`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	CONSTRAINT `project_media_id` PRIMARY KEY(`id`),
	CONSTRAINT `project_media_unique_idx` UNIQUE(`project_id`,`media_id`)
);
--> statement-breakpoint
CREATE TABLE `projects` (
	`id` varchar(64) NOT NULL,
	`title` varchar(300) NOT NULL,
	`slug` varchar(255) NOT NULL,
	`project_type` varchar(180) NOT NULL,
	`area` varchar(180) NOT NULL,
	`scope` text NOT NULL,
	`description` longtext NOT NULL,
	`duration` varchar(120),
	`project_year` int,
	`before_media_id` varchar(64),
	`after_media_id` varchar(64),
	`seo_title` varchar(300),
	`meta_description` text,
	`robots_index` boolean NOT NULL DEFAULT true,
	`sort_order` int NOT NULL DEFAULT 0,
	`status` varchar(32) NOT NULL DEFAULT 'draft',
	`published_at` datetime,
	`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	`deleted_at` datetime,
	CONSTRAINT `projects_id` PRIMARY KEY(`id`),
	CONSTRAINT `projects_slug_idx` UNIQUE(`slug`)
);
--> statement-breakpoint
CREATE TABLE `promotions` (
	`id` varchar(64) NOT NULL,
	`title` varchar(300) NOT NULL,
	`slug` varchar(255) NOT NULL,
	`description` text NOT NULL DEFAULT (''),
	`banner_media_id` varchar(64),
	`cta_label` varchar(120),
	`cta_url` text,
	`whatsapp_template` text,
	`starts_at` datetime,
	`ends_at` datetime,
	`status` varchar(32) NOT NULL DEFAULT 'draft',
	`created_by` varchar(64),
	`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	`deleted_at` datetime,
	CONSTRAINT `promotions_id` PRIMARY KEY(`id`),
	CONSTRAINT `promotions_slug_idx` UNIQUE(`slug`)
);
--> statement-breakpoint
CREATE TABLE `redirects` (
	`id` varchar(64) NOT NULL,
	`from_path` varchar(500) NOT NULL,
	`to_path` text NOT NULL,
	`status_code` int NOT NULL DEFAULT 301,
	`hits` bigint NOT NULL DEFAULT 0,
	`active` boolean NOT NULL DEFAULT true,
	`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	`deleted_at` datetime,
	CONSTRAINT `redirects_id` PRIMARY KEY(`id`),
	CONSTRAINT `redirects_from_idx` UNIQUE(`from_path`)
);
--> statement-breakpoint
CREATE TABLE `reusable_blocks` (
	`id` varchar(64) NOT NULL,
	`name` varchar(200) NOT NULL,
	`block_type` varchar(80) NOT NULL,
	`data` longtext NOT NULL,
	`settings` longtext,
	`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	`deleted_at` datetime,
	CONSTRAINT `reusable_blocks_id` PRIMARY KEY(`id`)
);
--> statement-breakpoint
CREATE TABLE `role_permissions` (
	`role_id` varchar(64) NOT NULL,
	`permission_id` varchar(64) NOT NULL,
	`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	CONSTRAINT `role_permissions_unique` UNIQUE(`role_id`,`permission_id`)
);
--> statement-breakpoint
CREATE TABLE `roles` (
	`id` varchar(64) NOT NULL,
	`name` varchar(80) NOT NULL,
	`description` text NOT NULL DEFAULT (''),
	`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	`deleted_at` datetime,
	CONSTRAINT `roles_id` PRIMARY KEY(`id`),
	CONSTRAINT `roles_name_idx` UNIQUE(`name`)
);
--> statement-breakpoint
CREATE TABLE `seo_settings` (
	`key` varchar(120) NOT NULL,
	`value` longtext NOT NULL,
	`updated_by` varchar(64),
	`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	CONSTRAINT `seo_settings_key` PRIMARY KEY(`key`)
);
--> statement-breakpoint
CREATE TABLE `service_areas` (
	`id` varchar(64) NOT NULL,
	`name` varchar(180) NOT NULL,
	`slug` varchar(255) NOT NULL,
	`city` varchar(180) NOT NULL,
	`unique_intro` text NOT NULL,
	`local_details` longtext NOT NULL,
	`geo_lat` double,
	`geo_lng` double,
	`seo_title` varchar(300),
	`meta_description` text,
	`robots_index` boolean NOT NULL DEFAULT true,
	`sort_order` int NOT NULL DEFAULT 0,
	`active` boolean NOT NULL DEFAULT true,
	`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	`deleted_at` datetime,
	CONSTRAINT `service_areas_id` PRIMARY KEY(`id`),
	CONSTRAINT `service_areas_slug_idx` UNIQUE(`slug`)
);
--> statement-breakpoint
CREATE TABLE `services` (
	`id` varchar(64) NOT NULL,
	`title` varchar(255) NOT NULL,
	`slug` varchar(255) NOT NULL,
	`excerpt` text NOT NULL,
	`content` longtext NOT NULL,
	`icon` varchar(80),
	`featured_image_id` varchar(64),
	`status` varchar(32) NOT NULL DEFAULT 'draft',
	`sort_order` int NOT NULL DEFAULT 0,
	`seo_title` varchar(300),
	`meta_description` text,
	`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	`deleted_at` datetime,
	CONSTRAINT `services_id` PRIMARY KEY(`id`),
	CONSTRAINT `services_slug_idx` UNIQUE(`slug`)
);
--> statement-breakpoint
CREATE TABLE `sessions` (
	`id` varchar(64) NOT NULL,
	`user_id` varchar(64) NOT NULL,
	`token_hash` varchar(128) NOT NULL,
	`ip_hash` varchar(128),
	`user_agent` text,
	`expires_at` datetime NOT NULL,
	`invalidated_at` datetime,
	`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	CONSTRAINT `sessions_id` PRIMARY KEY(`id`),
	CONSTRAINT `sessions_token_idx` UNIQUE(`token_hash`)
);
--> statement-breakpoint
CREATE TABLE `site_settings` (
	`key` varchar(120) NOT NULL,
	`value` longtext NOT NULL,
	`is_public` boolean NOT NULL DEFAULT false,
	`updated_by` varchar(64),
	`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	CONSTRAINT `site_settings_key` PRIMARY KEY(`key`)
);
--> statement-breakpoint
CREATE TABLE `tags` (
	`id` varchar(64) NOT NULL,
	`name` varchar(160) NOT NULL,
	`slug` varchar(255) NOT NULL,
	`robots_index` boolean NOT NULL DEFAULT false,
	`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	`deleted_at` datetime,
	CONSTRAINT `tags_id` PRIMARY KEY(`id`),
	CONSTRAINT `tags_slug_idx` UNIQUE(`slug`)
);
--> statement-breakpoint
CREATE TABLE `testimonials` (
	`id` varchar(64) NOT NULL,
	`name` varchar(180) NOT NULL,
	`photo_media_id` varchar(64),
	`service_type` varchar(180),
	`area` varchar(180),
	`content` text NOT NULL,
	`source` text,
	`rating` double,
	`verified` boolean NOT NULL DEFAULT false,
	`active` boolean NOT NULL DEFAULT false,
	`sort_order` int NOT NULL DEFAULT 0,
	`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	`deleted_at` datetime,
	CONSTRAINT `testimonials_id` PRIMARY KEY(`id`)
);
--> statement-breakpoint
CREATE TABLE `users` (
	`id` varchar(64) NOT NULL,
	`email` varchar(254) NOT NULL,
	`name` varchar(120) NOT NULL,
	`password_hash` varchar(255) NOT NULL,
	`password_salt` varchar(120) NOT NULL,
	`role_id` varchar(64) NOT NULL,
	`mfa_secret` varchar(128),
	`mfa_enabled` boolean NOT NULL DEFAULT false,
	`status` varchar(32) NOT NULL DEFAULT 'active',
	`password_changed_at` datetime,
	`last_login_at` datetime,
	`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	`deleted_at` datetime,
	CONSTRAINT `users_id` PRIMARY KEY(`id`),
	CONSTRAINT `users_email_idx` UNIQUE(`email`)
);
--> statement-breakpoint
CREATE TABLE `verification_tokens` (
	`id` varchar(64) NOT NULL,
	`user_id` varchar(64),
	`type` varchar(40) NOT NULL,
	`token_hash` varchar(128) NOT NULL,
	`expires_at` datetime NOT NULL,
	`used_at` datetime,
	`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
	CONSTRAINT `verification_tokens_id` PRIMARY KEY(`id`),
	CONSTRAINT `verification_token_hash_idx` UNIQUE(`token_hash`)
);
--> statement-breakpoint
CREATE INDEX `audit_logs_entity_idx` ON `audit_logs` (`entity_type`,`entity_id`);--> statement-breakpoint
CREATE INDEX `audit_logs_user_idx` ON `audit_logs` (`user_id`,`created_at`);--> statement-breakpoint
CREATE INDEX `audit_logs_created_idx` ON `audit_logs` (`created_at`);--> statement-breakpoint
CREATE INDEX `audit_logs_action_idx` ON `audit_logs` (`action`,`created_at`);--> statement-breakpoint
CREATE INDEX `backups_status_created_idx` ON `backups` (`status`,`created_at`);--> statement-breakpoint
CREATE INDEX `backups_expiry_idx` ON `backups` (`expires_at`);--> statement-breakpoint
CREATE INDEX `leads_status_idx` ON `leads` (`status`,`created_at`);--> statement-breakpoint
CREATE INDEX `leads_assigned_idx` ON `leads` (`assigned_to`);--> statement-breakpoint
CREATE INDEX `login_attempts_lookup_idx` ON `login_attempts` (`email_hash`,`ip_hash`,`attempted_at`);--> statement-breakpoint
CREATE INDEX `login_attempts_time_idx` ON `login_attempts` (`attempted_at`,`success`);--> statement-breakpoint
CREATE INDEX `menu_items_order_idx` ON `menu_items` (`menu_id`,`position`);--> statement-breakpoint
CREATE INDEX `page_blocks_order_idx` ON `page_blocks` (`page_id`,`position`);--> statement-breakpoint
CREATE INDEX `pages_status_idx` ON `pages` (`status`);--> statement-breakpoint
CREATE INDEX `posts_status_idx` ON `posts` (`status`);--> statement-breakpoint
CREATE INDEX `price_items_category_idx` ON `price_items` (`category_id`,`sort_order`);--> statement-breakpoint
CREATE INDEX `project_media_order_idx` ON `project_media` (`project_id`,`sort_order`);--> statement-breakpoint
CREATE INDEX `projects_public_idx` ON `projects` (`status`,`sort_order`);--> statement-breakpoint
CREATE INDEX `promotions_period_idx` ON `promotions` (`starts_at`,`ends_at`);--> statement-breakpoint
CREATE INDEX `service_areas_public_idx` ON `service_areas` (`active`,`sort_order`);--> statement-breakpoint
CREATE INDEX `sessions_user_idx` ON `sessions` (`user_id`);--> statement-breakpoint
CREATE INDEX `sessions_active_idx` ON `sessions` (`invalidated_at`,`expires_at`);--> statement-breakpoint
CREATE INDEX `testimonials_public_idx` ON `testimonials` (`active`,`verified`,`sort_order`);--> statement-breakpoint
CREATE INDEX `users_role_idx` ON `users` (`role_id`);
