// @generated by packages/core/scripts/embed-migrations.ts // Sources: apps/desktop/drizzle/ + packages/core/src/db/migrations/ // Do not edit by hand. Run `bun run packages/core/scripts/embed-migrations.ts` // to regenerate after migration changes. export type EmbeddedJournalEntry = { idx: number; version: string; when: number; tag: string; breakpoints: boolean; /** Raw .sql file contents, used as reconcile input (hashed + split on breakpoints). */ sql: string; }; export type EmbeddedMigrations = { version: string; dialect: string; entries: EmbeddedJournalEntry[]; }; export const EMBEDDED_MIGRATIONS: EmbeddedMigrations = { "version": "7", "dialect": "sqlite", "entries": [ { "idx": 0, "version": "6", "when": 1784334787884, "tag": "0000_baseline", "breakpoints": true, "sql": "CREATE TABLE `account` (\n\t`id` text PRIMARY KEY NOT NULL,\n\t`account_id` text NOT NULL,\n\t`provider_id` text NOT NULL,\n\t`user_id` text NOT NULL,\n\t`access_token` text,\n\t`refresh_token` text,\n\t`id_token` text,\n\t`access_token_expires_at` integer,\n\t`refresh_token_expires_at` integer,\n\t`scope` text,\n\t`password` text,\n\t`created_at` integer DEFAULT (cast(unixepoch('subsecond') * 1000 as integer)) NOT NULL,\n\t`updated_at` integer DEFAULT (cast(unixepoch('subsecond') * 1000 as integer)) NOT NULL,\n\tFOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE cascade\n);\n--> statement-breakpoint\nCREATE INDEX `account_userId_idx` ON `account` (`user_id`);--> statement-breakpoint\nCREATE TABLE `apikey` (\n\t`id` text PRIMARY KEY NOT NULL,\n\t`config_id` text DEFAULT 'default' NOT NULL,\n\t`name` text,\n\t`start` text,\n\t`reference_id` text NOT NULL,\n\t`prefix` text,\n\t`key` text NOT NULL,\n\t`refill_interval` integer,\n\t`refill_amount` integer,\n\t`last_refill_at` integer,\n\t`enabled` integer DEFAULT true,\n\t`rate_limit_enabled` integer DEFAULT true,\n\t`rate_limit_time_window` integer DEFAULT 86400000,\n\t`rate_limit_max` integer DEFAULT 10,\n\t`request_count` integer DEFAULT 0,\n\t`remaining` integer,\n\t`last_request` integer,\n\t`expires_at` integer,\n\t`created_at` integer NOT NULL,\n\t`updated_at` integer NOT NULL,\n\t`permissions` text,\n\t`metadata` text\n);\n--> statement-breakpoint\nCREATE INDEX `apikey_configId_idx` ON `apikey` (`config_id`);--> statement-breakpoint\nCREATE INDEX `apikey_referenceId_idx` ON `apikey` (`reference_id`);--> statement-breakpoint\nCREATE INDEX `apikey_key_idx` ON `apikey` (`key`);--> statement-breakpoint\nCREATE TABLE `app_settings` (\n\t`key` text PRIMARY KEY NOT NULL,\n\t`value` text,\n\t`updated_at` integer DEFAULT (unixepoch())\n);\n--> statement-breakpoint\nCREATE TABLE `clients` (\n\t`id` text PRIMARY KEY NOT NULL,\n\t`user_id` text NOT NULL,\n\t`organization_id` text,\n\t`name` text NOT NULL,\n\t`abbreviation` text,\n\t`email` text,\n\t`phone` text,\n\t`address` text,\n\t`tax_id` text,\n\t`notes` text,\n\t`default_rate` integer,\n\t`currency` text DEFAULT 'USD',\n\t`created_at` integer DEFAULT (unixepoch()),\n\t`updated_at` integer DEFAULT (unixepoch()),\n\tFOREIGN KEY (`organization_id`) REFERENCES `organization`(`id`) ON UPDATE no action ON DELETE cascade\n);\n--> statement-breakpoint\nCREATE INDEX `clients_user_idx` ON `clients` (`user_id`);--> statement-breakpoint\nCREATE INDEX `clients_org_idx` ON `clients` (`organization_id`);--> statement-breakpoint\nCREATE UNIQUE INDEX `clients_user_abbreviation_uidx` ON `clients` (`user_id`,`abbreviation`);--> statement-breakpoint\nCREATE TABLE `commit_provenance` (\n\t`id` text PRIMARY KEY NOT NULL,\n\t`commit_id` text NOT NULL,\n\t`source` text NOT NULL,\n\t`device_id` text,\n\t`user_id` text,\n\t`ingested_at` integer DEFAULT (unixepoch()),\n\tFOREIGN KEY (`commit_id`) REFERENCES `git_commits`(`id`) ON UPDATE no action ON DELETE cascade\n);\n--> statement-breakpoint\nCREATE INDEX `commit_provenance_commit_idx` ON `commit_provenance` (`commit_id`);--> statement-breakpoint\nCREATE TABLE `device_code` (\n\t`id` text PRIMARY KEY NOT NULL,\n\t`device_code` text NOT NULL,\n\t`user_code` text NOT NULL,\n\t`user_id` text,\n\t`expires_at` integer NOT NULL,\n\t`status` text NOT NULL,\n\t`last_polled_at` integer,\n\t`polling_interval` integer,\n\t`client_id` text,\n\t`scope` text\n);\n--> statement-breakpoint\nCREATE TABLE `devices` (\n\t`id` text PRIMARY KEY NOT NULL,\n\t`name` text NOT NULL,\n\t`user_id` text NOT NULL,\n\t`organization_id` text,\n\t`machine_id` text,\n\t`last_sync_at` integer,\n\t`local_event_count` integer,\n\t`local_latest_ts` integer,\n\t`sync_requested` integer DEFAULT false,\n\t`created_at` integer DEFAULT (unixepoch()),\n\tFOREIGN KEY (`organization_id`) REFERENCES `organization`(`id`) ON UPDATE no action ON DELETE set null\n);\n--> statement-breakpoint\nCREATE UNIQUE INDEX `devices_machine_id_unique` ON `devices` (`machine_id`);--> statement-breakpoint\nCREATE INDEX `devices_user_idx` ON `devices` (`user_id`);--> statement-breakpoint\nCREATE INDEX `devices_organization_idx` ON `devices` (`organization_id`);--> statement-breakpoint\nCREATE TABLE `email_log` (\n\t`id` text PRIMARY KEY NOT NULL,\n\t`user_id` text NOT NULL,\n\t`email_type` text NOT NULL,\n\t`period_key` text NOT NULL,\n\t`sent_at` integer DEFAULT (cast(unixepoch('subsecond') * 1000 as integer)) NOT NULL,\n\tFOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE cascade\n);\n--> statement-breakpoint\nCREATE UNIQUE INDEX `email_log_dedup_idx` ON `email_log` (`user_id`,`email_type`,`period_key`);--> statement-breakpoint\nCREATE INDEX `email_log_user_idx` ON `email_log` (`user_id`);--> statement-breakpoint\nCREATE TABLE `email_preferences` (\n\t`user_id` text PRIMARY KEY NOT NULL,\n\t`weekly_digest` integer DEFAULT true NOT NULL,\n\t`inactivity_nudges` integer DEFAULT true NOT NULL,\n\t`product_updates` integer DEFAULT true NOT NULL,\n\t`onboarding_emails` integer DEFAULT true NOT NULL,\n\t`digest_day_of_week` integer DEFAULT 1 NOT NULL,\n\t`updated_at` integer DEFAULT (cast(unixepoch('subsecond') * 1000 as integer)) NOT NULL,\n\tFOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE cascade\n);\n--> statement-breakpoint\nCREATE TABLE `environment_variables` (\n\t`id` text PRIMARY KEY NOT NULL,\n\t`environment_id` text NOT NULL,\n\t`key` text NOT NULL,\n\t`initial_value` text DEFAULT '' NOT NULL,\n\t`current_value` text DEFAULT '' NOT NULL,\n\t`secret` integer DEFAULT false NOT NULL,\n\t`created_at` integer DEFAULT (unixepoch()),\n\t`updated_at` integer DEFAULT (unixepoch()),\n\tFOREIGN KEY (`environment_id`) REFERENCES `environments`(`id`) ON UPDATE no action ON DELETE cascade\n);\n--> statement-breakpoint\nCREATE INDEX `env_vars_environment_idx` ON `environment_variables` (`environment_id`);--> statement-breakpoint\nCREATE INDEX `env_vars_key_idx` ON `environment_variables` (`key`);--> statement-breakpoint\nCREATE TABLE `environments` (\n\t`id` text PRIMARY KEY NOT NULL,\n\t`name` text NOT NULL,\n\t`sync_to_hub` integer DEFAULT false NOT NULL,\n\t`created_at` integer DEFAULT (unixepoch()),\n\t`updated_at` integer DEFAULT (unixepoch())\n);\n--> statement-breakpoint\nCREATE TABLE `evidence_messages` (\n\t`id` text PRIMARY KEY NOT NULL,\n\t`thread_id` text NOT NULL,\n\t`provider_id` text NOT NULL,\n\t`external_message_id` text,\n\t`role` text NOT NULL,\n\t`timestamp` integer NOT NULL,\n\t`content_text` text,\n\t`content_hash` text,\n\t`tool_name` text,\n\t`tool_status` text,\n\t`token_in` integer,\n\t`token_out` integer,\n\t`raw_json` text,\n\t`created_at` integer DEFAULT (unixepoch()),\n\tFOREIGN KEY (`thread_id`) REFERENCES `evidence_threads`(`id`) ON UPDATE no action ON DELETE cascade\n);\n--> statement-breakpoint\nCREATE INDEX `evidence_messages_thread_idx` ON `evidence_messages` (`thread_id`);--> statement-breakpoint\nCREATE INDEX `evidence_messages_provider_idx` ON `evidence_messages` (`provider_id`);--> statement-breakpoint\nCREATE UNIQUE INDEX `evidence_messages_external_uidx` ON `evidence_messages` (`provider_id`,`external_message_id`);--> statement-breakpoint\nCREATE INDEX `evidence_messages_timestamp_idx` ON `evidence_messages` (`timestamp`);--> statement-breakpoint\nCREATE INDEX `evidence_messages_content_hash_idx` ON `evidence_messages` (`content_hash`);--> statement-breakpoint\nCREATE TABLE `evidence_threads` (\n\t`id` text PRIMARY KEY NOT NULL,\n\t`provider_id` text NOT NULL,\n\t`external_thread_id` text NOT NULL,\n\t`workspace_path` text,\n\t`workspace_hash` text,\n\t`title` text,\n\t`organization_id` text,\n\t`started_at` integer,\n\t`ended_at` integer,\n\t`provider_metadata` text,\n\t`created_at` integer DEFAULT (unixepoch()),\n\t`share_token` text,\n\t`share_expires_at` integer,\n\t`share_visibility` text DEFAULT 'public',\n\t`share_view_count` integer DEFAULT 0\n);\n--> statement-breakpoint\nCREATE UNIQUE INDEX `evidence_threads_share_token_unique` ON `evidence_threads` (`share_token`);--> statement-breakpoint\nCREATE INDEX `evidence_threads_provider_idx` ON `evidence_threads` (`provider_id`);--> statement-breakpoint\nCREATE INDEX `evidence_threads_external_idx` ON `evidence_threads` (`provider_id`,`external_thread_id`);--> statement-breakpoint\nCREATE INDEX `evidence_threads_workspace_hash_idx` ON `evidence_threads` (`workspace_hash`);--> statement-breakpoint\nCREATE INDEX `evidence_threads_org_idx` ON `evidence_threads` (`organization_id`);--> statement-breakpoint\nCREATE INDEX `evidence_threads_share_token_idx` ON `evidence_threads` (`share_token`);--> statement-breakpoint\nCREATE TABLE `git_commits` (\n\t`id` text PRIMARY KEY NOT NULL,\n\t`organization_id` text NOT NULL,\n\t`commit_key` text NOT NULL,\n\t`sha` text NOT NULL,\n\t`git_remote` text,\n\t`repo_full_name` text,\n\t`message` text,\n\t`author_name` text,\n\t`author_email` text,\n\t`authored_at` integer,\n\t`additions` integer,\n\t`deletions` integer,\n\t`files_changed` text,\n\t`html_url` text,\n\t`created_at` integer DEFAULT (unixepoch()),\n\t`updated_at` integer DEFAULT (unixepoch()),\n\tFOREIGN KEY (`organization_id`) REFERENCES `organization`(`id`) ON UPDATE no action ON DELETE cascade\n);\n--> statement-breakpoint\nCREATE UNIQUE INDEX `git_commits_org_key_uidx` ON `git_commits` (`organization_id`,`commit_key`);--> statement-breakpoint\nCREATE INDEX `git_commits_org_idx` ON `git_commits` (`organization_id`);--> statement-breakpoint\nCREATE INDEX `git_commits_key_idx` ON `git_commits` (`commit_key`);--> statement-breakpoint\nCREATE TABLE `github_installations` (\n\t`id` text PRIMARY KEY NOT NULL,\n\t`organization_id` text NOT NULL,\n\t`installation_id` text NOT NULL,\n\t`account_login` text,\n\t`account_id` integer,\n\t`account_type` text,\n\t`repository_selection` text,\n\t`permissions` text,\n\t`installed_at` integer DEFAULT (unixepoch()),\n\t`created_at` integer DEFAULT (unixepoch()),\n\t`updated_at` integer DEFAULT (unixepoch()),\n\tFOREIGN KEY (`organization_id`) REFERENCES `organization`(`id`) ON UPDATE no action ON DELETE cascade\n);\n--> statement-breakpoint\nCREATE UNIQUE INDEX `github_installations_org_uidx` ON `github_installations` (`organization_id`);--> statement-breakpoint\nCREATE UNIQUE INDEX `github_installations_installation_uidx` ON `github_installations` (`installation_id`);--> statement-breakpoint\nCREATE INDEX `github_installations_org_idx` ON `github_installations` (`organization_id`);--> statement-breakpoint\nCREATE TABLE `github_repositories` (\n\t`id` text PRIMARY KEY NOT NULL,\n\t`organization_id` text NOT NULL,\n\t`project_id` text,\n\t`installation_id` text,\n\t`github_repo_id` integer NOT NULL,\n\t`owner` text NOT NULL,\n\t`name` text NOT NULL,\n\t`full_name` text NOT NULL,\n\t`private` integer DEFAULT false NOT NULL,\n\t`default_branch` text,\n\t`html_url` text,\n\t`selected` integer DEFAULT true NOT NULL,\n\t`last_ingested_at` integer,\n\t`created_at` integer DEFAULT (unixepoch()),\n\t`updated_at` integer DEFAULT (unixepoch()),\n\tFOREIGN KEY (`organization_id`) REFERENCES `organization`(`id`) ON UPDATE no action ON DELETE cascade,\n\tFOREIGN KEY (`project_id`) REFERENCES `projects`(`id`) ON UPDATE no action ON DELETE set null\n);\n--> statement-breakpoint\nCREATE UNIQUE INDEX `github_repositories_org_repo_uidx` ON `github_repositories` (`organization_id`,`github_repo_id`);--> statement-breakpoint\nCREATE INDEX `github_repositories_org_idx` ON `github_repositories` (`organization_id`);--> statement-breakpoint\nCREATE INDEX `github_repositories_project_idx` ON `github_repositories` (`project_id`);--> statement-breakpoint\nCREATE INDEX `github_repositories_full_name_idx` ON `github_repositories` (`full_name`);--> statement-breakpoint\nCREATE TABLE `invitation` (\n\t`id` text PRIMARY KEY NOT NULL,\n\t`organization_id` text NOT NULL,\n\t`email` text NOT NULL,\n\t`role` text,\n\t`status` text DEFAULT 'pending' NOT NULL,\n\t`expires_at` integer NOT NULL,\n\t`created_at` integer DEFAULT (cast(unixepoch('subsecond') * 1000 as integer)) NOT NULL,\n\t`inviter_id` text NOT NULL,\n\tFOREIGN KEY (`organization_id`) REFERENCES `organization`(`id`) ON UPDATE no action ON DELETE cascade,\n\tFOREIGN KEY (`inviter_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE cascade\n);\n--> statement-breakpoint\nCREATE INDEX `invitation_organizationId_idx` ON `invitation` (`organization_id`);--> statement-breakpoint\nCREATE INDEX `invitation_email_idx` ON `invitation` (`email`);--> statement-breakpoint\nCREATE TABLE `invoice_line_items` (\n\t`id` text PRIMARY KEY NOT NULL,\n\t`invoice_id` text NOT NULL,\n\t`project_id` text,\n\t`description` text NOT NULL,\n\t`quantity` integer NOT NULL,\n\t`quantity_type` text DEFAULT 'hours',\n\t`rate` integer NOT NULL,\n\t`amount` integer NOT NULL,\n\t`event_ids` text,\n\t`sort_order` integer DEFAULT 0,\n\tFOREIGN KEY (`invoice_id`) REFERENCES `invoices`(`id`) ON UPDATE no action ON DELETE cascade,\n\tFOREIGN KEY (`project_id`) REFERENCES `projects`(`id`) ON UPDATE no action ON DELETE set null\n);\n--> statement-breakpoint\nCREATE INDEX `invoice_line_items_invoice_idx` ON `invoice_line_items` (`invoice_id`);--> statement-breakpoint\nCREATE TABLE `invoice_templates` (\n\t`id` text PRIMARY KEY NOT NULL,\n\t`user_id` text NOT NULL,\n\t`organization_id` text,\n\t`name` text NOT NULL,\n\t`is_default` integer DEFAULT false,\n\t`config` text,\n\t`created_at` integer DEFAULT (unixepoch()),\n\tFOREIGN KEY (`organization_id`) REFERENCES `organization`(`id`) ON UPDATE no action ON DELETE cascade\n);\n--> statement-breakpoint\nCREATE INDEX `invoice_templates_user_idx` ON `invoice_templates` (`user_id`);--> statement-breakpoint\nCREATE INDEX `invoice_templates_org_idx` ON `invoice_templates` (`organization_id`);--> statement-breakpoint\nCREATE TABLE `invoices` (\n\t`id` text PRIMARY KEY NOT NULL,\n\t`user_id` text NOT NULL,\n\t`organization_id` text,\n\t`client_id` text,\n\t`template_id` text,\n\t`invoice_number` text NOT NULL,\n\t`status` text DEFAULT 'draft',\n\t`issue_date` integer NOT NULL,\n\t`due_date` integer,\n\t`paid_date` integer,\n\t`subtotal` integer NOT NULL,\n\t`tax_rate` integer DEFAULT 0,\n\t`tax_amount` integer DEFAULT 0,\n\t`total` integer NOT NULL,\n\t`currency` text DEFAULT 'USD',\n\t`period_start` integer,\n\t`period_end` integer,\n\t`share_token` text,\n\t`share_url` text,\n\t`share_expires_at` integer,\n\t`viewed_at` integer,\n\t`notes` text,\n\t`payment_notes` text,\n\t`created_at` integer DEFAULT (unixepoch()),\n\t`updated_at` integer DEFAULT (unixepoch()),\n\tFOREIGN KEY (`organization_id`) REFERENCES `organization`(`id`) ON UPDATE no action ON DELETE cascade,\n\tFOREIGN KEY (`client_id`) REFERENCES `clients`(`id`) ON UPDATE no action ON DELETE set null,\n\tFOREIGN KEY (`template_id`) REFERENCES `invoice_templates`(`id`) ON UPDATE no action ON DELETE set null\n);\n--> statement-breakpoint\nCREATE UNIQUE INDEX `invoices_share_token_unique` ON `invoices` (`share_token`);--> statement-breakpoint\nCREATE INDEX `invoices_user_idx` ON `invoices` (`user_id`);--> statement-breakpoint\nCREATE INDEX `invoices_org_idx` ON `invoices` (`organization_id`);--> statement-breakpoint\nCREATE INDEX `invoices_client_idx` ON `invoices` (`client_id`);--> statement-breakpoint\nCREATE INDEX `invoices_status_idx` ON `invoices` (`status`);--> statement-breakpoint\nCREATE INDEX `invoices_share_token_idx` ON `invoices` (`share_token`);--> statement-breakpoint\nCREATE UNIQUE INDEX `invoices_org_number_unique` ON `invoices` (`organization_id`,`invoice_number`);--> statement-breakpoint\nCREATE TABLE `jwks` (\n\t`id` text PRIMARY KEY NOT NULL,\n\t`public_key` text NOT NULL,\n\t`private_key` text NOT NULL,\n\t`created_at` integer NOT NULL,\n\t`expires_at` integer\n);\n--> statement-breakpoint\nCREATE TABLE `linear_project_mappings` (\n\t`id` text PRIMARY KEY NOT NULL,\n\t`organization_id` text,\n\t`linear_project_name` text NOT NULL,\n\t`project_id` text NOT NULL,\n\t`created_at` integer DEFAULT (unixepoch()),\n\tFOREIGN KEY (`organization_id`) REFERENCES `organization`(`id`) ON UPDATE no action ON DELETE cascade,\n\tFOREIGN KEY (`project_id`) REFERENCES `projects`(`id`) ON UPDATE no action ON DELETE cascade\n);\n--> statement-breakpoint\nCREATE UNIQUE INDEX `linear_project_mappings_org_name_idx` ON `linear_project_mappings` (`organization_id`,`linear_project_name`);--> statement-breakpoint\nCREATE INDEX `linear_project_mappings_project_idx` ON `linear_project_mappings` (`project_id`);--> statement-breakpoint\nCREATE TABLE `link_invites` (\n\t`id` text PRIMARY KEY NOT NULL,\n\t`organization_id` text NOT NULL,\n\t`token` text NOT NULL,\n\t`created_by` text NOT NULL,\n\t`expires_at` integer,\n\t`max_uses` integer,\n\t`use_count` integer DEFAULT 0 NOT NULL,\n\t`revoked` integer DEFAULT false NOT NULL,\n\t`created_at` integer DEFAULT (unixepoch()),\n\tFOREIGN KEY (`organization_id`) REFERENCES `organization`(`id`) ON UPDATE no action ON DELETE cascade\n);\n--> statement-breakpoint\nCREATE UNIQUE INDEX `link_invites_token_unique` ON `link_invites` (`token`);--> statement-breakpoint\nCREATE INDEX `link_invites_organization_idx` ON `link_invites` (`organization_id`);--> statement-breakpoint\nCREATE INDEX `link_invites_token_idx` ON `link_invites` (`token`);--> statement-breakpoint\nCREATE TABLE `live_activity_sessions` (\n\t`id` text PRIMARY KEY NOT NULL,\n\t`provider_id` text NOT NULL,\n\t`external_thread_id` text NOT NULL,\n\t`title` text,\n\t`project_root_id` text,\n\t`project_id` text,\n\t`project_name` text,\n\t`project_path` text,\n\t`conversation_file` text,\n\t`last_message_preview` text,\n\t`last_message_role` text,\n\t`message_count` integer DEFAULT 0,\n\t`last_activity_at` integer NOT NULL,\n\t`last_ingest_at` integer,\n\t`state` text DEFAULT 'idle',\n\t`created_at` integer DEFAULT (unixepoch()),\n\t`updated_at` integer DEFAULT (unixepoch()),\n\tFOREIGN KEY (`project_root_id`) REFERENCES `project_roots`(`id`) ON UPDATE no action ON DELETE set null,\n\tFOREIGN KEY (`project_id`) REFERENCES `projects`(`id`) ON UPDATE no action ON DELETE set null\n);\n--> statement-breakpoint\nCREATE INDEX `live_activity_provider_thread_idx` ON `live_activity_sessions` (`provider_id`,`external_thread_id`);--> statement-breakpoint\nCREATE INDEX `live_activity_last_activity_idx` ON `live_activity_sessions` (`last_activity_at`);--> statement-breakpoint\nCREATE INDEX `live_activity_state_idx` ON `live_activity_sessions` (`state`);--> statement-breakpoint\nCREATE INDEX `live_activity_project_idx` ON `live_activity_sessions` (`project_id`);--> statement-breakpoint\nCREATE TABLE `member` (\n\t`id` text PRIMARY KEY NOT NULL,\n\t`organization_id` text NOT NULL,\n\t`user_id` text NOT NULL,\n\t`role` text DEFAULT 'member' NOT NULL,\n\t`created_at` integer NOT NULL,\n\tFOREIGN KEY (`organization_id`) REFERENCES `organization`(`id`) ON UPDATE no action ON DELETE cascade,\n\tFOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE cascade\n);\n--> statement-breakpoint\nCREATE INDEX `member_organizationId_idx` ON `member` (`organization_id`);--> statement-breakpoint\nCREATE INDEX `member_userId_idx` ON `member` (`user_id`);--> statement-breakpoint\nCREATE TABLE `oauth_access_token` (\n\t`id` text PRIMARY KEY NOT NULL,\n\t`token` text,\n\t`client_id` text NOT NULL,\n\t`session_id` text,\n\t`user_id` text,\n\t`reference_id` text,\n\t`refresh_id` text,\n\t`expires_at` integer,\n\t`created_at` integer,\n\t`scopes` text NOT NULL,\n\tFOREIGN KEY (`client_id`) REFERENCES `oauth_client`(`client_id`) ON UPDATE no action ON DELETE cascade,\n\tFOREIGN KEY (`session_id`) REFERENCES `session`(`id`) ON UPDATE no action ON DELETE set null,\n\tFOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE cascade,\n\tFOREIGN KEY (`refresh_id`) REFERENCES `oauth_refresh_token`(`id`) ON UPDATE no action ON DELETE cascade\n);\n--> statement-breakpoint\nCREATE UNIQUE INDEX `oauth_access_token_token_unique` ON `oauth_access_token` (`token`);--> statement-breakpoint\nCREATE INDEX `oauthAccessToken_clientId_idx` ON `oauth_access_token` (`client_id`);--> statement-breakpoint\nCREATE INDEX `oauthAccessToken_sessionId_idx` ON `oauth_access_token` (`session_id`);--> statement-breakpoint\nCREATE INDEX `oauthAccessToken_userId_idx` ON `oauth_access_token` (`user_id`);--> statement-breakpoint\nCREATE INDEX `oauthAccessToken_refreshId_idx` ON `oauth_access_token` (`refresh_id`);--> statement-breakpoint\nCREATE TABLE `oauth_client` (\n\t`id` text PRIMARY KEY NOT NULL,\n\t`client_id` text NOT NULL,\n\t`client_secret` text,\n\t`disabled` integer DEFAULT false,\n\t`skip_consent` integer,\n\t`enable_end_session` integer,\n\t`subject_type` text,\n\t`scopes` text,\n\t`user_id` text,\n\t`created_at` integer,\n\t`updated_at` integer,\n\t`name` text,\n\t`uri` text,\n\t`icon` text,\n\t`contacts` text,\n\t`tos` text,\n\t`policy` text,\n\t`software_id` text,\n\t`software_version` text,\n\t`software_statement` text,\n\t`redirect_uris` text NOT NULL,\n\t`post_logout_redirect_uris` text,\n\t`token_endpoint_auth_method` text,\n\t`grant_types` text,\n\t`response_types` text,\n\t`public` integer,\n\t`type` text,\n\t`require_pkce` integer,\n\t`reference_id` text,\n\t`metadata` text,\n\tFOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE cascade\n);\n--> statement-breakpoint\nCREATE UNIQUE INDEX `oauth_client_client_id_unique` ON `oauth_client` (`client_id`);--> statement-breakpoint\nCREATE INDEX `oauthClient_userId_idx` ON `oauth_client` (`user_id`);--> statement-breakpoint\nCREATE TABLE `oauth_consent` (\n\t`id` text PRIMARY KEY NOT NULL,\n\t`client_id` text NOT NULL,\n\t`user_id` text,\n\t`reference_id` text,\n\t`scopes` text NOT NULL,\n\t`created_at` integer,\n\t`updated_at` integer,\n\tFOREIGN KEY (`client_id`) REFERENCES `oauth_client`(`client_id`) ON UPDATE no action ON DELETE cascade,\n\tFOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE cascade\n);\n--> statement-breakpoint\nCREATE INDEX `oauthConsent_clientId_idx` ON `oauth_consent` (`client_id`);--> statement-breakpoint\nCREATE INDEX `oauthConsent_userId_idx` ON `oauth_consent` (`user_id`);--> statement-breakpoint\nCREATE TABLE `oauth_refresh_token` (\n\t`id` text PRIMARY KEY NOT NULL,\n\t`token` text NOT NULL,\n\t`client_id` text NOT NULL,\n\t`session_id` text,\n\t`user_id` text NOT NULL,\n\t`reference_id` text,\n\t`expires_at` integer,\n\t`created_at` integer,\n\t`revoked` integer,\n\t`auth_time` integer,\n\t`scopes` text NOT NULL,\n\tFOREIGN KEY (`client_id`) REFERENCES `oauth_client`(`client_id`) ON UPDATE no action ON DELETE cascade,\n\tFOREIGN KEY (`session_id`) REFERENCES `session`(`id`) ON UPDATE no action ON DELETE set null,\n\tFOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE cascade\n);\n--> statement-breakpoint\nCREATE UNIQUE INDEX `oauth_refresh_token_token_unique` ON `oauth_refresh_token` (`token`);--> statement-breakpoint\nCREATE INDEX `oauthRefreshToken_clientId_idx` ON `oauth_refresh_token` (`client_id`);--> statement-breakpoint\nCREATE INDEX `oauthRefreshToken_sessionId_idx` ON `oauth_refresh_token` (`session_id`);--> statement-breakpoint\nCREATE INDEX `oauthRefreshToken_userId_idx` ON `oauth_refresh_token` (`user_id`);--> statement-breakpoint\nCREATE TABLE `observer_state` (\n\t`id` text PRIMARY KEY NOT NULL,\n\t`status` text DEFAULT 'starting' NOT NULL,\n\t`watched_root_count` integer DEFAULT 0,\n\t`watched_roots` text,\n\t`recent_project_activity` text,\n\t`last_heartbeat_at` integer,\n\t`last_error` text,\n\t`last_error_at` integer,\n\t`metadata` text,\n\t`updated_at` integer DEFAULT (unixepoch())\n);\n--> statement-breakpoint\nCREATE TABLE `org_environment_variables` (\n\t`id` text PRIMARY KEY NOT NULL,\n\t`environment_id` text NOT NULL,\n\t`key` text NOT NULL,\n\t`initial_value` text DEFAULT '' NOT NULL,\n\t`secret` integer DEFAULT false NOT NULL,\n\t`updated_at` integer DEFAULT (unixepoch()),\n\tFOREIGN KEY (`environment_id`) REFERENCES `org_environments`(`id`) ON UPDATE no action ON DELETE cascade\n);\n--> statement-breakpoint\nCREATE INDEX `org_env_vars_environment_idx` ON `org_environment_variables` (`environment_id`);--> statement-breakpoint\nCREATE TABLE `org_environments` (\n\t`id` text PRIMARY KEY NOT NULL,\n\t`organization_id` text NOT NULL,\n\t`name` text NOT NULL,\n\t`created_at` integer DEFAULT (unixepoch())\n);\n--> statement-breakpoint\nCREATE TABLE `organization` (\n\t`id` text PRIMARY KEY NOT NULL,\n\t`stripe_customer_id` text,\n\t`name` text NOT NULL,\n\t`slug` text NOT NULL,\n\t`logo` text,\n\t`created_at` integer NOT NULL,\n\t`metadata` text\n);\n--> statement-breakpoint\nCREATE UNIQUE INDEX `organization_slug_unique` ON `organization` (`slug`);--> statement-breakpoint\nCREATE UNIQUE INDEX `organization_slug_uidx` ON `organization` (`slug`);--> statement-breakpoint\nCREATE TABLE `organization_role` (\n\t`id` text PRIMARY KEY NOT NULL,\n\t`organization_id` text NOT NULL,\n\t`role` text NOT NULL,\n\t`permission` text NOT NULL,\n\t`created_at` integer DEFAULT (cast(unixepoch('subsecond') * 1000 as integer)) NOT NULL,\n\t`updated_at` integer,\n\tFOREIGN KEY (`organization_id`) REFERENCES `organization`(`id`) ON UPDATE no action ON DELETE cascade\n);\n--> statement-breakpoint\nCREATE INDEX `organization_role_organizationId_idx` ON `organization_role` (`organization_id`);--> statement-breakpoint\nCREATE INDEX `organization_role_role_idx` ON `organization_role` (`role`);--> statement-breakpoint\nCREATE TABLE `project_associations` (\n\t`id` text PRIMARY KEY NOT NULL,\n\t`project_root_id` text,\n\t`pattern` text NOT NULL,\n\t`priority` integer DEFAULT 0,\n\tFOREIGN KEY (`project_root_id`) REFERENCES `project_roots`(`id`) ON UPDATE no action ON DELETE cascade\n);\n--> statement-breakpoint\nCREATE TABLE `project_roots` (\n\t`id` text PRIMARY KEY NOT NULL,\n\t`scan_root_id` text,\n\t`project_id` text,\n\t`device_id` text,\n\t`path` text NOT NULL,\n\t`detected_name` text,\n\t`git_remote` text,\n\t`peacock_color` text,\n\t`created_at` integer DEFAULT (unixepoch()),\n\tFOREIGN KEY (`scan_root_id`) REFERENCES `scan_roots`(`id`) ON UPDATE no action ON DELETE cascade,\n\tFOREIGN KEY (`project_id`) REFERENCES `projects`(`id`) ON UPDATE no action ON DELETE set null,\n\tFOREIGN KEY (`device_id`) REFERENCES `devices`(`id`) ON UPDATE no action ON DELETE cascade\n);\n--> statement-breakpoint\nCREATE INDEX `project_roots_path_device_idx` ON `project_roots` (`path`,`device_id`);--> statement-breakpoint\nCREATE INDEX `project_roots_project_id_idx` ON `project_roots` (`project_id`);--> statement-breakpoint\nCREATE TABLE `projects` (\n\t`id` text PRIMARY KEY NOT NULL,\n\t`name` text NOT NULL,\n\t`color` text,\n\t`icon` text,\n\t`summary` text,\n\t`summary_generated_at` integer,\n\t`organization_id` text,\n\t`client_id` text,\n\t`hourly_rate` integer,\n\t`billable` integer DEFAULT true,\n\t`created_at` integer DEFAULT (unixepoch()),\n\tFOREIGN KEY (`organization_id`) REFERENCES `organization`(`id`) ON UPDATE no action ON DELETE cascade,\n\tFOREIGN KEY (`client_id`) REFERENCES `clients`(`id`) ON UPDATE no action ON DELETE set null\n);\n--> statement-breakpoint\nCREATE INDEX `projects_name_idx` ON `projects` (`name`);--> statement-breakpoint\nCREATE INDEX `projects_org_idx` ON `projects` (`organization_id`);--> statement-breakpoint\nCREATE TABLE `scan_history` (\n\t`id` text PRIMARY KEY NOT NULL,\n\t`scan_root_id` text,\n\t`started_at` integer NOT NULL,\n\t`completed_at` integer,\n\t`events_found` integer DEFAULT 0,\n\t`status` text DEFAULT 'running',\n\t`error` text,\n\tFOREIGN KEY (`scan_root_id`) REFERENCES `scan_roots`(`id`) ON UPDATE no action ON DELETE cascade\n);\n--> statement-breakpoint\nCREATE TABLE `scan_roots` (\n\t`id` text PRIMARY KEY NOT NULL,\n\t`path` text NOT NULL,\n\t`type` text NOT NULL,\n\t`provider_id` text,\n\t`root_type` text DEFAULT 'path',\n\t`provider_config` text,\n\t`last_cursor` text,\n\t`capabilities` text,\n\t`enabled` integer DEFAULT true,\n\t`last_scanned` integer,\n\t`created_at` integer DEFAULT (unixepoch())\n);\n--> statement-breakpoint\nCREATE INDEX `scan_roots_path_type_idx` ON `scan_roots` (`path`,`type`);--> statement-breakpoint\nCREATE TABLE `secret_alerts` (\n\t`id` text PRIMARY KEY NOT NULL,\n\t`event_id` text,\n\t`device_id` text,\n\t`type` text NOT NULL,\n\t`field` text NOT NULL,\n\t`preview` text NOT NULL,\n\t`redacted` integer DEFAULT true NOT NULL,\n\t`acknowledged` integer DEFAULT false NOT NULL,\n\t`detected_at` integer DEFAULT (unixepoch()),\n\t`acknowledged_at` integer,\n\tFOREIGN KEY (`event_id`) REFERENCES `timeline_events`(`id`) ON UPDATE no action ON DELETE cascade\n);\n--> statement-breakpoint\nCREATE INDEX `secret_alerts_event_idx` ON `secret_alerts` (`event_id`);--> statement-breakpoint\nCREATE INDEX `secret_alerts_type_idx` ON `secret_alerts` (`type`);--> statement-breakpoint\nCREATE INDEX `secret_alerts_detected_idx` ON `secret_alerts` (`detected_at`);--> statement-breakpoint\nCREATE TABLE `session` (\n\t`id` text PRIMARY KEY NOT NULL,\n\t`expires_at` integer NOT NULL,\n\t`token` text NOT NULL,\n\t`created_at` integer DEFAULT (cast(unixepoch('subsecond') * 1000 as integer)) NOT NULL,\n\t`updated_at` integer DEFAULT (cast(unixepoch('subsecond') * 1000 as integer)) NOT NULL,\n\t`ip_address` text,\n\t`user_agent` text,\n\t`user_id` text NOT NULL,\n\t`active_organization_id` text,\n\t`roles` text,\n\t`impersonated_by` text,\n\tFOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE cascade\n);\n--> statement-breakpoint\nCREATE UNIQUE INDEX `session_token_unique` ON `session` (`token`);--> statement-breakpoint\nCREATE INDEX `session_userId_idx` ON `session` (`user_id`);--> statement-breakpoint\nCREATE TABLE `subscription` (\n\t`id` text PRIMARY KEY NOT NULL,\n\t`plan` text NOT NULL,\n\t`reference_id` text NOT NULL,\n\t`stripe_customer_id` text,\n\t`stripe_subscription_id` text,\n\t`status` text DEFAULT 'incomplete',\n\t`period_start` integer,\n\t`period_end` integer,\n\t`trial_start` integer,\n\t`trial_end` integer,\n\t`cancel_at_period_end` integer DEFAULT false,\n\t`cancel_at` integer,\n\t`canceled_at` integer,\n\t`ended_at` integer,\n\t`seats` integer,\n\t`billing_interval` text,\n\t`stripe_schedule_id` text\n);\n--> statement-breakpoint\nCREATE INDEX `subscription_reference_idx` ON `subscription` (`reference_id`);--> statement-breakpoint\nCREATE INDEX `subscription_stripe_customer_idx` ON `subscription` (`stripe_customer_id`);--> statement-breakpoint\nCREATE TABLE `sync_history` (\n\t`id` text PRIMARY KEY NOT NULL,\n\t`host_url` text NOT NULL,\n\t`device_id` text NOT NULL,\n\t`started_at` integer NOT NULL,\n\t`completed_at` integer,\n\t`events_uploaded` integer DEFAULT 0,\n\t`projects_uploaded` integer DEFAULT 0,\n\t`total_bytes` integer DEFAULT 0,\n\t`status` text DEFAULT 'running',\n\t`error` text\n);\n--> statement-breakpoint\nCREATE TABLE `timeline_events` (\n\t`id` text PRIMARY KEY NOT NULL,\n\t`timestamp` integer NOT NULL,\n\t`source` text NOT NULL,\n\t`provider_id` text,\n\t`event_type` text DEFAULT 'message',\n\t`external_thread_id` text,\n\t`external_message_id` text,\n\t`project_root_id` text,\n\t`device_id` text,\n\t`source_id` text,\n\t`commit_key` text,\n\t`metadata` text,\n\t`content` text,\n\t`content_hash` text,\n\t`raw_ref` text,\n\t`estimated_minutes` integer DEFAULT 15,\n\t`auth_mode` text,\n\t`attested_bap_id` text,\n\t`attested_sig` text,\n\t`ingest_nonce` text,\n\t`annotation` text,\n\t`annotated_at` integer,\n\t`edited_at` integer,\n\t`created_at` integer DEFAULT (unixepoch()),\n\tFOREIGN KEY (`project_root_id`) REFERENCES `project_roots`(`id`) ON UPDATE no action ON DELETE set null,\n\tFOREIGN KEY (`device_id`) REFERENCES `devices`(`id`) ON UPDATE no action ON DELETE cascade\n);\n--> statement-breakpoint\nCREATE INDEX `timestamp_idx` ON `timeline_events` (`timestamp`);--> statement-breakpoint\nCREATE INDEX `source_idx` ON `timeline_events` (`source`);--> statement-breakpoint\nCREATE INDEX `device_idx` ON `timeline_events` (`device_id`);--> statement-breakpoint\nCREATE INDEX `events_source_device_idx` ON `timeline_events` (`source_id`,`device_id`);--> statement-breakpoint\nCREATE INDEX `events_device_timestamp_idx` ON `timeline_events` (`device_id`,`timestamp`);--> statement-breakpoint\nCREATE INDEX `events_provider_idx` ON `timeline_events` (`provider_id`);--> statement-breakpoint\nCREATE INDEX `events_event_type_idx` ON `timeline_events` (`event_type`);--> statement-breakpoint\nCREATE INDEX `events_external_thread_idx` ON `timeline_events` (`external_thread_id`);--> statement-breakpoint\nCREATE INDEX `events_external_message_idx` ON `timeline_events` (`external_message_id`);--> statement-breakpoint\nCREATE INDEX `events_commit_key_idx` ON `timeline_events` (`commit_key`);--> statement-breakpoint\nCREATE INDEX `events_content_hash_idx` ON `timeline_events` (`content_hash`);--> statement-breakpoint\nCREATE INDEX `events_ingest_nonce_idx` ON `timeline_events` (`ingest_nonce`);--> statement-breakpoint\nCREATE INDEX `events_project_timestamp_idx` ON `timeline_events` (`project_root_id`,`timestamp`);--> statement-breakpoint\nCREATE INDEX `events_root_device_source_ts_idx` ON `timeline_events` (`project_root_id`,`device_id`,`source`,`timestamp`);--> statement-breakpoint\nCREATE TABLE `timeline_rollups` (\n\t`id` text PRIMARY KEY NOT NULL,\n\t`organization_id` text NOT NULL,\n\t`granularity` text NOT NULL,\n\t`bucket_start` integer NOT NULL,\n\t`bucket_end` integer NOT NULL,\n\t`project_id` text DEFAULT '__unassigned__' NOT NULL,\n\t`project_name` text DEFAULT 'Unassigned' NOT NULL,\n\t`project_color` text DEFAULT 'oklch(0.55 0.02 260)' NOT NULL,\n\t`event_count` integer DEFAULT 0 NOT NULL,\n\t`estimated_minutes` integer DEFAULT 0 NOT NULL,\n\t`source_counts` text NOT NULL,\n\t`updated_at` integer DEFAULT (unixepoch())\n);\n--> statement-breakpoint\nCREATE INDEX `rollups_org_gran_start_idx` ON `timeline_rollups` (`organization_id`,`granularity`,`bucket_start`);--> statement-breakpoint\nCREATE UNIQUE INDEX `rollups_upsert_uidx` ON `timeline_rollups` (`organization_id`,`granularity`,`bucket_start`,`project_id`);--> statement-breakpoint\nCREATE INDEX `rollups_project_idx` ON `timeline_rollups` (`project_id`);--> statement-breakpoint\nCREATE TABLE `user` (\n\t`id` text PRIMARY KEY NOT NULL,\n\t`name` text NOT NULL,\n\t`email` text NOT NULL,\n\t`email_verified` integer DEFAULT false NOT NULL,\n\t`image` text,\n\t`created_at` integer DEFAULT (cast(unixepoch('subsecond') * 1000 as integer)) NOT NULL,\n\t`updated_at` integer DEFAULT (cast(unixepoch('subsecond') * 1000 as integer)) NOT NULL,\n\t`pubkey` text,\n\t`bap_id` text,\n\t`stripe_customer_id` text,\n\t`tour_completed` integer DEFAULT false,\n\t`onboarding_completed` integer DEFAULT false,\n\t`roles` text DEFAULT 'user',\n\t`role` text,\n\t`banned` integer DEFAULT false,\n\t`ban_reason` text,\n\t`ban_expires` integer\n);\n--> statement-breakpoint\nCREATE UNIQUE INDEX `user_email_unique` ON `user` (`email`);--> statement-breakpoint\nCREATE UNIQUE INDEX `user_pubkey_unique` ON `user` (`pubkey`);--> statement-breakpoint\nCREATE UNIQUE INDEX `user_bap_id_unique` ON `user` (`bap_id`);--> statement-breakpoint\nCREATE TABLE `verification` (\n\t`id` text PRIMARY KEY NOT NULL,\n\t`identifier` text NOT NULL,\n\t`value` text NOT NULL,\n\t`expires_at` integer NOT NULL,\n\t`created_at` integer DEFAULT (cast(unixepoch('subsecond') * 1000 as integer)) NOT NULL,\n\t`updated_at` integer DEFAULT (cast(unixepoch('subsecond') * 1000 as integer)) NOT NULL\n);\n--> statement-breakpoint\nCREATE INDEX `verification_identifier_idx` ON `verification` (`identifier`);--> statement-breakpoint\nCREATE TABLE `waitlist_entries` (\n\t`id` text PRIMARY KEY NOT NULL,\n\t`email` text NOT NULL,\n\t`status` text DEFAULT 'pending' NOT NULL,\n\t`source` text,\n\t`use_case` text,\n\t`notes` text,\n\t`invite_token_hash` text,\n\t`invite_expires_at` integer,\n\t`created_at` integer NOT NULL,\n\t`invited_at` integer,\n\t`admitted_at` integer,\n\t`signed_up_at` integer\n);\n--> statement-breakpoint\nCREATE UNIQUE INDEX `waitlist_entries_email_unique` ON `waitlist_entries` (`email`);--> statement-breakpoint\nCREATE INDEX `waitlist_status_idx` ON `waitlist_entries` (`status`);--> statement-breakpoint\nCREATE INDEX `waitlist_created_idx` ON `waitlist_entries` (`created_at`);--> statement-breakpoint\nCREATE INDEX `waitlist_email_idx` ON `waitlist_entries` (`email`);" }, { "idx": 1, "version": "6", "when": 1784374356327, "tag": "0001_generated_reports", "breakpoints": true, "sql": "CREATE TABLE `generated_reports` (\n\t`id` text PRIMARY KEY NOT NULL,\n\t`organization_id` text NOT NULL,\n\t`created_by_user_id` text NOT NULL,\n\t`title` text NOT NULL,\n\t`status` text DEFAULT 'pending' NOT NULL,\n\t`error` text,\n\t`criteria` text NOT NULL,\n\t`range_start` integer,\n\t`range_end` integer,\n\t`scope` text NOT NULL,\n\t`filter` text NOT NULL,\n\t`depth` text NOT NULL,\n\t`total_events` integer DEFAULT 0,\n\t`total_estimated_minutes` integer DEFAULT 0,\n\t`active_days` integer DEFAULT 0,\n\t`payload` text,\n\t`created_at` integer DEFAULT (unixepoch()),\n\t`completed_at` integer,\n\tFOREIGN KEY (`organization_id`) REFERENCES `organization`(`id`) ON UPDATE no action ON DELETE cascade,\n\tFOREIGN KEY (`created_by_user_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE cascade\n);\n--> statement-breakpoint\nCREATE INDEX `generated_reports_org_created_idx` ON `generated_reports` (`organization_id`,`created_at`);--> statement-breakpoint\nCREATE INDEX `generated_reports_org_user_idx` ON `generated_reports` (`organization_id`,`created_by_user_id`);--> statement-breakpoint\nCREATE INDEX `generated_reports_status_idx` ON `generated_reports` (`status`);" }, { "idx": 2, "version": "6", "when": 1784375672356, "tag": "0002_manually_assigned", "breakpoints": true, "sql": "ALTER TABLE `project_roots` ADD `manually_assigned` integer DEFAULT false NOT NULL;" }, { "idx": 3, "version": "6", "when": 1784475616146, "tag": "0003_wandering_robbie_robertson", "breakpoints": true, "sql": "CREATE TABLE `cron_runs` (\n\t`id` text PRIMARY KEY NOT NULL,\n\t`job` text NOT NULL,\n\t`trigger` text DEFAULT 'schedule' NOT NULL,\n\t`started_at` integer NOT NULL,\n\t`finished_at` integer,\n\t`status` text DEFAULT 'running' NOT NULL,\n\t`result` text,\n\t`error` text\n);\n--> statement-breakpoint\nCREATE INDEX `cron_runs_job_started_idx` ON `cron_runs` (`job`,`started_at`);" }, { "idx": 4, "version": "6", "when": 1784478033259, "tag": "0004_red_nocturne", "breakpoints": true, "sql": "CREATE TABLE `email_template_overrides` (\n\t`template_key` text PRIMARY KEY NOT NULL,\n\t`subject` text NOT NULL,\n\t`html` text NOT NULL,\n\t`enabled` integer DEFAULT false NOT NULL,\n\t`updated_at` integer NOT NULL,\n\t`updated_by` text\n);\n" }, { "idx": 5, "version": "6", "when": 1784480313558, "tag": "0005_stale_the_anarchist", "breakpoints": true, "sql": "CREATE TABLE `email_template_versions` (\n\t`id` text PRIMARY KEY NOT NULL,\n\t`template_key` text NOT NULL,\n\t`subject` text NOT NULL,\n\t`html` text NOT NULL,\n\t`was_enabled` integer DEFAULT false NOT NULL,\n\t`saved_at` integer NOT NULL,\n\t`saved_by` text\n);\n--> statement-breakpoint\nCREATE INDEX `email_template_versions_key_saved_idx` ON `email_template_versions` (`template_key`,`saved_at`);" }, { "idx": 6, "version": "6", "when": 1784494004350, "tag": "0006_chat_persistence", "breakpoints": true, "sql": "CREATE TABLE `chat_conversations` (\n\t`id` text PRIMARY KEY NOT NULL,\n\t`user_id` text NOT NULL,\n\t`organization_id` text,\n\t`title` text,\n\t`created_at` integer DEFAULT (unixepoch()),\n\t`updated_at` integer DEFAULT (unixepoch())\n);\n--> statement-breakpoint\nCREATE INDEX `chat_conversations_owner_idx` ON `chat_conversations` (`user_id`,`organization_id`,`updated_at`);--> statement-breakpoint\nCREATE TABLE `chat_messages` (\n\t`id` text PRIMARY KEY NOT NULL,\n\t`conversation_id` text NOT NULL,\n\t`position` integer NOT NULL,\n\t`message` text NOT NULL,\n\t`created_at` integer DEFAULT (unixepoch()),\n\tFOREIGN KEY (`conversation_id`) REFERENCES `chat_conversations`(`id`) ON UPDATE no action ON DELETE cascade\n);\n--> statement-breakpoint\nCREATE INDEX `chat_messages_conversation_idx` ON `chat_messages` (`conversation_id`,`position`);" }, { "idx": 7, "version": "6", "when": 1784585147931, "tag": "0007_team_theme_color", "breakpoints": true, "sql": "ALTER TABLE `organization` ADD `theme_color` text;" }, { "idx": 8, "version": "6", "when": 1784728895016, "tag": "0008_long_zombie", "breakpoints": true, "sql": "ALTER TABLE `organization` ADD `is_default` integer DEFAULT false NOT NULL;\n--> statement-breakpoint\n-- Backfill: flag each existing signup/default team. Mirrors web 0014\n-- (OPL-3135). On single-device desktop this is effectively a no-op (no\n-- auth/multi-org), but kept identical so the two migration sets stay aligned.\n-- The auto-provisioned org's slug is exactly `personal-` (see ensureUserHasOrganization); match that precisely so a\n-- manually-named \"Personal ...\" team can't be mistaken for a default team.\nUPDATE `organization` SET `is_default` = 1 WHERE `id` IN (\n SELECT o.`id` FROM `organization` o\n JOIN `member` m ON m.`organization_id` = o.`id` AND m.`role` = 'owner'\n WHERE o.`slug` = 'personal-' || substr(m.`user_id`, 1, 8)\n);\n" }, { "idx": 9, "version": "6", "when": 1784760923688, "tag": "0009_overconfident_lucky_pierre", "breakpoints": true, "sql": "ALTER TABLE `user` ADD `github_login` text;" }, { "idx": 10, "version": "6", "when": 1784763678030, "tag": "0010_lively_living_tribunal", "breakpoints": true, "sql": "ALTER TABLE `github_installations` ADD `installed_by_user_id` text REFERENCES user(id);" }, { "idx": 11, "version": "6", "when": 1783699200000, "tag": "0011_normalize_cli_invoice_hours", "breakpoints": true, "sql": "UPDATE invoice_line_items\nSET quantity = quantity * 60\nWHERE (quantity_type = 'hours' OR quantity_type IS NULL)\n AND quantity > 0\n AND amount = quantity * rate;\n" } ] };