diff --git a/drizzle/0014_brave_randall.sql b/drizzle/0014_brave_randall.sql new file mode 100644 index 0000000..aac3ad3 --- /dev/null +++ b/drizzle/0014_brave_randall.sql @@ -0,0 +1,393 @@ +CREATE TABLE `company_financial_bundle` ( + `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL, + `ticker` text NOT NULL, + `surface_kind` text NOT NULL, + `cadence` text NOT NULL, + `bundle_version` integer NOT NULL, + `source_snapshot_ids` text NOT NULL, + `source_signature` text NOT NULL, + `payload` text NOT NULL, + `created_at` text NOT NULL, + `updated_at` text NOT NULL +); +--> statement-breakpoint +CREATE UNIQUE INDEX `company_financial_bundle_uidx` ON `company_financial_bundle` (`ticker`,`surface_kind`,`cadence`);--> statement-breakpoint +CREATE INDEX `company_financial_bundle_ticker_idx` ON `company_financial_bundle` (`ticker`,`updated_at`);--> statement-breakpoint +CREATE TABLE `company_overview_cache` ( + `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL, + `user_id` text NOT NULL, + `ticker` text NOT NULL, + `cache_version` integer NOT NULL, + `source_signature` text NOT NULL, + `payload` text NOT NULL, + `created_at` text NOT NULL, + `updated_at` text NOT NULL, + FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE cascade +); +--> statement-breakpoint +CREATE UNIQUE INDEX `company_overview_cache_uidx` ON `company_overview_cache` (`user_id`,`ticker`);--> statement-breakpoint +CREATE INDEX `company_overview_cache_lookup_idx` ON `company_overview_cache` (`user_id`,`ticker`,`updated_at`);--> statement-breakpoint +CREATE TABLE `filing_statement_snapshot` ( + `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL, + `filing_id` integer NOT NULL, + `ticker` text NOT NULL, + `filing_date` text NOT NULL, + `filing_type` text NOT NULL, + `period_end` text, + `statement_bundle` text, + `standardized_bundle` text, + `dimension_bundle` text, + `parse_status` text NOT NULL, + `parse_error` text, + `source` text NOT NULL, + `created_at` text NOT NULL, + `updated_at` text NOT NULL, + FOREIGN KEY (`filing_id`) REFERENCES `filing`(`id`) ON UPDATE no action ON DELETE cascade +); +--> statement-breakpoint +CREATE UNIQUE INDEX `filing_stmt_filing_uidx` ON `filing_statement_snapshot` (`filing_id`);--> statement-breakpoint +CREATE INDEX `filing_stmt_ticker_date_idx` ON `filing_statement_snapshot` (`ticker`,`filing_date`);--> statement-breakpoint +CREATE INDEX `filing_stmt_date_idx` ON `filing_statement_snapshot` (`filing_date`);--> statement-breakpoint +CREATE INDEX `filing_stmt_status_idx` ON `filing_statement_snapshot` (`parse_status`);--> statement-breakpoint +CREATE TABLE `filing_taxonomy_asset` ( + `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL, + `snapshot_id` integer NOT NULL, + `asset_type` text NOT NULL, + `name` text NOT NULL, + `url` text NOT NULL, + `size_bytes` integer, + `score` numeric, + `is_selected` integer DEFAULT false NOT NULL, + `created_at` text NOT NULL, + FOREIGN KEY (`snapshot_id`) REFERENCES `filing_taxonomy_snapshot`(`id`) ON UPDATE no action ON DELETE cascade +); +--> statement-breakpoint +CREATE INDEX `filing_taxonomy_asset_snapshot_idx` ON `filing_taxonomy_asset` (`snapshot_id`);--> statement-breakpoint +CREATE INDEX `filing_taxonomy_asset_type_idx` ON `filing_taxonomy_asset` (`snapshot_id`,`asset_type`);--> statement-breakpoint +CREATE TABLE `filing_taxonomy_concept` ( + `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL, + `snapshot_id` integer NOT NULL, + `concept_key` text NOT NULL, + `qname` text NOT NULL, + `namespace_uri` text NOT NULL, + `local_name` text NOT NULL, + `label` text, + `is_extension` integer DEFAULT false NOT NULL, + `balance` text, + `period_type` text, + `data_type` text, + `statement_kind` text, + `role_uri` text, + `authoritative_concept_key` text, + `mapping_method` text, + `surface_key` text, + `detail_parent_surface_key` text, + `kpi_key` text, + `residual_flag` integer DEFAULT false NOT NULL, + `presentation_order` numeric, + `presentation_depth` integer, + `parent_concept_key` text, + `is_abstract` integer DEFAULT false NOT NULL, + `created_at` text NOT NULL, + FOREIGN KEY (`snapshot_id`) REFERENCES `filing_taxonomy_snapshot`(`id`) ON UPDATE no action ON DELETE cascade +); +--> statement-breakpoint +CREATE INDEX `filing_taxonomy_concept_snapshot_idx` ON `filing_taxonomy_concept` (`snapshot_id`);--> statement-breakpoint +CREATE INDEX `filing_taxonomy_concept_statement_idx` ON `filing_taxonomy_concept` (`snapshot_id`,`statement_kind`);--> statement-breakpoint +CREATE UNIQUE INDEX `filing_taxonomy_concept_uidx` ON `filing_taxonomy_concept` (`snapshot_id`,`concept_key`,`role_uri`,`presentation_order`);--> statement-breakpoint +CREATE TABLE `filing_taxonomy_context` ( + `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL, + `snapshot_id` integer NOT NULL, + `context_id` text NOT NULL, + `entity_identifier` text, + `entity_scheme` text, + `period_start` text, + `period_end` text, + `period_instant` text, + `segment_json` text, + `scenario_json` text, + `created_at` text NOT NULL, + FOREIGN KEY (`snapshot_id`) REFERENCES `filing_taxonomy_snapshot`(`id`) ON UPDATE no action ON DELETE cascade +); +--> statement-breakpoint +CREATE INDEX `filing_taxonomy_context_snapshot_idx` ON `filing_taxonomy_context` (`snapshot_id`);--> statement-breakpoint +CREATE UNIQUE INDEX `filing_taxonomy_context_uidx` ON `filing_taxonomy_context` (`snapshot_id`,`context_id`);--> statement-breakpoint +CREATE TABLE `filing_taxonomy_fact` ( + `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL, + `snapshot_id` integer NOT NULL, + `concept_key` text NOT NULL, + `qname` text NOT NULL, + `namespace_uri` text NOT NULL, + `local_name` text NOT NULL, + `data_type` text, + `statement_kind` text, + `role_uri` text, + `authoritative_concept_key` text, + `mapping_method` text, + `surface_key` text, + `detail_parent_surface_key` text, + `kpi_key` text, + `residual_flag` integer DEFAULT false NOT NULL, + `context_id` text NOT NULL, + `unit` text, + `decimals` text, + `precision` text, + `nil` integer DEFAULT false NOT NULL, + `value_num` numeric NOT NULL, + `period_start` text, + `period_end` text, + `period_instant` text, + `dimensions` text NOT NULL, + `is_dimensionless` integer DEFAULT true NOT NULL, + `source_file` text, + `created_at` text NOT NULL, + FOREIGN KEY (`snapshot_id`) REFERENCES `filing_taxonomy_snapshot`(`id`) ON UPDATE no action ON DELETE cascade +); +--> statement-breakpoint +CREATE INDEX `filing_taxonomy_fact_snapshot_idx` ON `filing_taxonomy_fact` (`snapshot_id`);--> statement-breakpoint +CREATE INDEX `filing_taxonomy_fact_concept_idx` ON `filing_taxonomy_fact` (`snapshot_id`,`concept_key`);--> statement-breakpoint +CREATE INDEX `filing_taxonomy_fact_period_idx` ON `filing_taxonomy_fact` (`snapshot_id`,`period_end`,`period_instant`);--> statement-breakpoint +CREATE INDEX `filing_taxonomy_fact_statement_idx` ON `filing_taxonomy_fact` (`snapshot_id`,`statement_kind`);--> statement-breakpoint +CREATE TABLE `filing_taxonomy_metric_validation` ( + `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL, + `snapshot_id` integer NOT NULL, + `metric_key` text NOT NULL, + `taxonomy_value` numeric, + `llm_value` numeric, + `absolute_diff` numeric, + `relative_diff` numeric, + `status` text NOT NULL, + `evidence_pages` text NOT NULL, + `pdf_url` text, + `provider` text, + `model` text, + `error` text, + `created_at` text NOT NULL, + `updated_at` text NOT NULL, + FOREIGN KEY (`snapshot_id`) REFERENCES `filing_taxonomy_snapshot`(`id`) ON UPDATE no action ON DELETE cascade +); +--> statement-breakpoint +CREATE INDEX `filing_taxonomy_metric_validation_snapshot_idx` ON `filing_taxonomy_metric_validation` (`snapshot_id`);--> statement-breakpoint +CREATE INDEX `filing_taxonomy_metric_validation_status_idx` ON `filing_taxonomy_metric_validation` (`snapshot_id`,`status`);--> statement-breakpoint +CREATE UNIQUE INDEX `filing_taxonomy_metric_validation_uidx` ON `filing_taxonomy_metric_validation` (`snapshot_id`,`metric_key`);--> statement-breakpoint +CREATE TABLE `filing_taxonomy_snapshot` ( + `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL, + `filing_id` integer NOT NULL, + `ticker` text NOT NULL, + `filing_date` text NOT NULL, + `filing_type` text NOT NULL, + `parse_status` text NOT NULL, + `parse_error` text, + `source` text NOT NULL, + `parser_engine` text DEFAULT 'fiscal-xbrl' NOT NULL, + `parser_version` text DEFAULT 'unknown' NOT NULL, + `taxonomy_regime` text DEFAULT 'unknown' NOT NULL, + `fiscal_pack` text, + `periods` text, + `faithful_rows` text, + `statement_rows` text, + `surface_rows` text, + `detail_rows` text, + `kpi_rows` text, + `derived_metrics` text, + `validation_result` text, + `normalization_summary` text, + `facts_count` integer DEFAULT 0 NOT NULL, + `concepts_count` integer DEFAULT 0 NOT NULL, + `dimensions_count` integer DEFAULT 0 NOT NULL, + `created_at` text NOT NULL, + `updated_at` text NOT NULL, + FOREIGN KEY (`filing_id`) REFERENCES `filing`(`id`) ON UPDATE no action ON DELETE cascade +); +--> statement-breakpoint +CREATE UNIQUE INDEX `filing_taxonomy_snapshot_filing_uidx` ON `filing_taxonomy_snapshot` (`filing_id`);--> statement-breakpoint +CREATE INDEX `filing_taxonomy_snapshot_ticker_date_idx` ON `filing_taxonomy_snapshot` (`ticker`,`filing_date`);--> statement-breakpoint +CREATE INDEX `filing_taxonomy_snapshot_status_idx` ON `filing_taxonomy_snapshot` (`parse_status`);--> statement-breakpoint +CREATE TABLE `research_artifact` ( + `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL, + `user_id` text NOT NULL, + `organization_id` text, + `ticker` text NOT NULL, + `accession_number` text, + `kind` text NOT NULL, + `source` text DEFAULT 'user' NOT NULL, + `subtype` text, + `title` text, + `summary` text, + `body_markdown` text, + `search_text` text, + `visibility_scope` text DEFAULT 'private' NOT NULL, + `tags` text, + `metadata` text, + `file_name` text, + `mime_type` text, + `file_size_bytes` integer, + `storage_path` text, + `created_at` text NOT NULL, + `updated_at` text NOT NULL, + FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE cascade, + FOREIGN KEY (`organization_id`) REFERENCES `organization`(`id`) ON UPDATE no action ON DELETE set null +); +--> statement-breakpoint +CREATE INDEX `research_artifact_ticker_idx` ON `research_artifact` (`user_id`,`ticker`,`updated_at`);--> statement-breakpoint +CREATE INDEX `research_artifact_kind_idx` ON `research_artifact` (`user_id`,`kind`,`updated_at`);--> statement-breakpoint +CREATE INDEX `research_artifact_accession_idx` ON `research_artifact` (`user_id`,`accession_number`);--> statement-breakpoint +CREATE INDEX `research_artifact_source_idx` ON `research_artifact` (`user_id`,`source`,`updated_at`);--> statement-breakpoint +CREATE TABLE `research_copilot_message` ( + `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL, + `session_id` integer NOT NULL, + `user_id` text NOT NULL, + `role` text NOT NULL, + `content_markdown` text NOT NULL, + `citations` text, + `follow_ups` text, + `suggested_actions` text, + `selected_sources` text, + `pinned_artifact_ids` text, + `memo_section` text, + `created_at` text NOT NULL, + FOREIGN KEY (`session_id`) REFERENCES `research_copilot_session`(`id`) ON UPDATE no action ON DELETE cascade, + FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE cascade +); +--> statement-breakpoint +CREATE INDEX `research_copilot_message_session_idx` ON `research_copilot_message` (`session_id`,`created_at`);--> statement-breakpoint +CREATE INDEX `research_copilot_message_user_idx` ON `research_copilot_message` (`user_id`,`created_at`);--> statement-breakpoint +CREATE TABLE `research_copilot_session` ( + `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL, + `user_id` text NOT NULL, + `ticker` text NOT NULL, + `title` text, + `selected_sources` text NOT NULL, + `pinned_artifact_ids` text NOT NULL, + `created_at` text NOT NULL, + `updated_at` text NOT NULL, + FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE cascade +); +--> statement-breakpoint +CREATE UNIQUE INDEX `research_copilot_session_ticker_uidx` ON `research_copilot_session` (`user_id`,`ticker`);--> statement-breakpoint +CREATE INDEX `research_copilot_session_updated_idx` ON `research_copilot_session` (`user_id`,`updated_at`);--> statement-breakpoint +CREATE TABLE `research_journal_entry` ( + `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL, + `user_id` text NOT NULL, + `ticker` text NOT NULL, + `accession_number` text, + `entry_type` text NOT NULL, + `title` text, + `body_markdown` text NOT NULL, + `metadata` text, + `created_at` text NOT NULL, + `updated_at` text NOT NULL, + FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE cascade +); +--> statement-breakpoint +CREATE INDEX `research_journal_ticker_idx` ON `research_journal_entry` (`user_id`,`ticker`,`created_at`);--> statement-breakpoint +CREATE INDEX `research_journal_accession_idx` ON `research_journal_entry` (`user_id`,`accession_number`);--> statement-breakpoint +CREATE TABLE `research_memo` ( + `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL, + `user_id` text NOT NULL, + `organization_id` text, + `ticker` text NOT NULL, + `rating` text, + `conviction` text, + `time_horizon_months` integer, + `packet_title` text, + `packet_subtitle` text, + `thesis_markdown` text DEFAULT '' NOT NULL, + `variant_view_markdown` text DEFAULT '' NOT NULL, + `catalysts_markdown` text DEFAULT '' NOT NULL, + `risks_markdown` text DEFAULT '' NOT NULL, + `disconfirming_evidence_markdown` text DEFAULT '' NOT NULL, + `next_actions_markdown` text DEFAULT '' NOT NULL, + `created_at` text NOT NULL, + `updated_at` text NOT NULL, + FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE cascade, + FOREIGN KEY (`organization_id`) REFERENCES `organization`(`id`) ON UPDATE no action ON DELETE set null +); +--> statement-breakpoint +CREATE UNIQUE INDEX `research_memo_ticker_uidx` ON `research_memo` (`user_id`,`ticker`);--> statement-breakpoint +CREATE INDEX `research_memo_updated_idx` ON `research_memo` (`user_id`,`updated_at`);--> statement-breakpoint +CREATE TABLE `research_memo_evidence` ( + `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL, + `memo_id` integer NOT NULL, + `artifact_id` integer NOT NULL, + `section` text NOT NULL, + `annotation` text, + `sort_order` integer DEFAULT 0 NOT NULL, + `created_at` text NOT NULL, + FOREIGN KEY (`memo_id`) REFERENCES `research_memo`(`id`) ON UPDATE no action ON DELETE cascade, + FOREIGN KEY (`artifact_id`) REFERENCES `research_artifact`(`id`) ON UPDATE no action ON DELETE cascade +); +--> statement-breakpoint +CREATE INDEX `research_memo_evidence_memo_idx` ON `research_memo_evidence` (`memo_id`,`section`,`sort_order`);--> statement-breakpoint +CREATE INDEX `research_memo_evidence_artifact_idx` ON `research_memo_evidence` (`artifact_id`);--> statement-breakpoint +CREATE UNIQUE INDEX `research_memo_evidence_unique_uidx` ON `research_memo_evidence` (`memo_id`,`artifact_id`,`section`);--> statement-breakpoint +CREATE TABLE `search_chunk` ( + `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL, + `document_id` integer NOT NULL, + `chunk_index` integer NOT NULL, + `chunk_text` text NOT NULL, + `char_count` integer NOT NULL, + `start_offset` integer NOT NULL, + `end_offset` integer NOT NULL, + `heading_path` text, + `citation_label` text NOT NULL, + `created_at` text NOT NULL, + FOREIGN KEY (`document_id`) REFERENCES `search_document`(`id`) ON UPDATE no action ON DELETE cascade +); +--> statement-breakpoint +CREATE UNIQUE INDEX `search_chunk_document_chunk_uidx` ON `search_chunk` (`document_id`,`chunk_index`);--> statement-breakpoint +CREATE INDEX `search_chunk_document_idx` ON `search_chunk` (`document_id`);--> statement-breakpoint +CREATE TABLE `search_document` ( + `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL, + `source_kind` text NOT NULL, + `source_ref` text NOT NULL, + `scope` text NOT NULL, + `user_id` text, + `ticker` text, + `accession_number` text, + `title` text, + `content_text` text NOT NULL, + `content_hash` text NOT NULL, + `metadata` text, + `index_status` text NOT NULL, + `indexed_at` text, + `last_error` text, + `created_at` text NOT NULL, + `updated_at` text NOT NULL, + FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE cascade +); +--> statement-breakpoint +CREATE UNIQUE INDEX `search_document_source_uidx` ON `search_document` (`scope`,`ifnull("user_id"`,` '')`,`source_kind`,`source_ref`);--> statement-breakpoint +CREATE INDEX `search_document_scope_idx` ON `search_document` (`scope`,`source_kind`,`ticker`,`updated_at`);--> statement-breakpoint +CREATE INDEX `search_document_accession_idx` ON `search_document` (`accession_number`,`source_kind`);--> statement-breakpoint +CREATE TABLE `task_stage_event` ( + `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL, + `task_id` text NOT NULL, + `user_id` text NOT NULL, + `stage` text NOT NULL, + `stage_detail` text, + `stage_context` text, + `status` text NOT NULL, + `created_at` text NOT NULL, + FOREIGN KEY (`task_id`) REFERENCES `task_run`(`id`) ON UPDATE no action ON DELETE cascade, + FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE cascade +); +--> statement-breakpoint +CREATE INDEX `task_stage_event_task_created_idx` ON `task_stage_event` (`task_id`,`created_at`);--> statement-breakpoint +CREATE INDEX `task_stage_event_user_created_idx` ON `task_stage_event` (`user_id`,`created_at`);--> statement-breakpoint +ALTER TABLE `holding` ADD `company_name` text;--> statement-breakpoint +ALTER TABLE `task_run` ADD `stage` text NOT NULL;--> statement-breakpoint +ALTER TABLE `task_run` ADD `stage_detail` text;--> statement-breakpoint +ALTER TABLE `task_run` ADD `stage_context` text;--> statement-breakpoint +ALTER TABLE `task_run` ADD `resource_key` text;--> statement-breakpoint +ALTER TABLE `task_run` ADD `notification_read_at` text;--> statement-breakpoint +ALTER TABLE `task_run` ADD `notification_silenced_at` text;--> statement-breakpoint +CREATE INDEX `task_user_updated_idx` ON `task_run` (`user_id`,`updated_at`);--> statement-breakpoint +CREATE INDEX `task_user_resource_status_idx` ON `task_run` (`user_id`,`task_type`,`resource_key`,`status`,`created_at`);--> statement-breakpoint +ALTER TABLE `watchlist_item` ADD `category` text;--> statement-breakpoint +ALTER TABLE `watchlist_item` ADD `tags` text;--> statement-breakpoint +ALTER TABLE `watchlist_item` ADD `status` text DEFAULT 'backlog' NOT NULL;--> statement-breakpoint +ALTER TABLE `watchlist_item` ADD `priority` text DEFAULT 'medium' NOT NULL;--> statement-breakpoint +ALTER TABLE `watchlist_item` ADD `updated_at` text NOT NULL;--> statement-breakpoint +ALTER TABLE `watchlist_item` ADD `last_reviewed_at` text;--> statement-breakpoint +CREATE INDEX `watchlist_user_updated_idx` ON `watchlist_item` (`user_id`,`updated_at`); \ No newline at end of file diff --git a/drizzle/meta/0014_snapshot.json b/drizzle/meta/0014_snapshot.json new file mode 100644 index 0000000..7ee0c3b --- /dev/null +++ b/drizzle/meta/0014_snapshot.json @@ -0,0 +1,4113 @@ +{ + "version": "6", + "dialect": "sqlite", + "id": "a2e1568e-76a0-4317-be02-d5db28855703", + "prevId": "cf403080-e012-41c0-93a2-52333bb44df1", + "tables": { + "account": { + "name": "account", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "accountId": { + "name": "accountId", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "providerId": { + "name": "providerId", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "userId": { + "name": "userId", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "accessToken": { + "name": "accessToken", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "refreshToken": { + "name": "refreshToken", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "idToken": { + "name": "idToken", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "accessTokenExpiresAt": { + "name": "accessTokenExpiresAt", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "refreshTokenExpiresAt": { + "name": "refreshTokenExpiresAt", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "scope": { + "name": "scope", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "password": { + "name": "password", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "createdAt": { + "name": "createdAt", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updatedAt": { + "name": "updatedAt", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "account_userId_idx": { + "name": "account_userId_idx", + "columns": [ + "userId" + ], + "isUnique": false + } + }, + "foreignKeys": { + "account_userId_user_id_fk": { + "name": "account_userId_user_id_fk", + "tableFrom": "account", + "tableTo": "user", + "columnsFrom": [ + "userId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "company_financial_bundle": { + "name": "company_financial_bundle", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "ticker": { + "name": "ticker", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "surface_kind": { + "name": "surface_kind", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "cadence": { + "name": "cadence", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "bundle_version": { + "name": "bundle_version", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "source_snapshot_ids": { + "name": "source_snapshot_ids", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "source_signature": { + "name": "source_signature", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "payload": { + "name": "payload", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "company_financial_bundle_uidx": { + "name": "company_financial_bundle_uidx", + "columns": [ + "ticker", + "surface_kind", + "cadence" + ], + "isUnique": true + }, + "company_financial_bundle_ticker_idx": { + "name": "company_financial_bundle_ticker_idx", + "columns": [ + "ticker", + "updated_at" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "company_overview_cache": { + "name": "company_overview_cache", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "ticker": { + "name": "ticker", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "cache_version": { + "name": "cache_version", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "source_signature": { + "name": "source_signature", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "payload": { + "name": "payload", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "company_overview_cache_uidx": { + "name": "company_overview_cache_uidx", + "columns": [ + "user_id", + "ticker" + ], + "isUnique": true + }, + "company_overview_cache_lookup_idx": { + "name": "company_overview_cache_lookup_idx", + "columns": [ + "user_id", + "ticker", + "updated_at" + ], + "isUnique": false + } + }, + "foreignKeys": { + "company_overview_cache_user_id_user_id_fk": { + "name": "company_overview_cache_user_id_user_id_fk", + "tableFrom": "company_overview_cache", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "filing": { + "name": "filing", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "ticker": { + "name": "ticker", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "filing_type": { + "name": "filing_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "filing_date": { + "name": "filing_date", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "accession_number": { + "name": "accession_number", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "cik": { + "name": "cik", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "company_name": { + "name": "company_name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "filing_url": { + "name": "filing_url", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "submission_url": { + "name": "submission_url", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "primary_document": { + "name": "primary_document", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "metrics": { + "name": "metrics", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "analysis": { + "name": "analysis", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "filing_accession_uidx": { + "name": "filing_accession_uidx", + "columns": [ + "accession_number" + ], + "isUnique": true + }, + "filing_ticker_date_idx": { + "name": "filing_ticker_date_idx", + "columns": [ + "ticker", + "filing_date" + ], + "isUnique": false + }, + "filing_date_idx": { + "name": "filing_date_idx", + "columns": [ + "filing_date" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "filing_link": { + "name": "filing_link", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "filing_id": { + "name": "filing_id", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "link_type": { + "name": "link_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "url": { + "name": "url", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "source": { + "name": "source", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'sec'" + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "filing_link_unique_uidx": { + "name": "filing_link_unique_uidx", + "columns": [ + "filing_id", + "url" + ], + "isUnique": true + }, + "filing_link_filing_idx": { + "name": "filing_link_filing_idx", + "columns": [ + "filing_id" + ], + "isUnique": false + } + }, + "foreignKeys": { + "filing_link_filing_id_filing_id_fk": { + "name": "filing_link_filing_id_filing_id_fk", + "tableFrom": "filing_link", + "tableTo": "filing", + "columnsFrom": [ + "filing_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "filing_statement_snapshot": { + "name": "filing_statement_snapshot", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "filing_id": { + "name": "filing_id", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "ticker": { + "name": "ticker", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "filing_date": { + "name": "filing_date", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "filing_type": { + "name": "filing_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "period_end": { + "name": "period_end", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "statement_bundle": { + "name": "statement_bundle", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "standardized_bundle": { + "name": "standardized_bundle", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "dimension_bundle": { + "name": "dimension_bundle", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "parse_status": { + "name": "parse_status", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "parse_error": { + "name": "parse_error", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "source": { + "name": "source", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "filing_stmt_filing_uidx": { + "name": "filing_stmt_filing_uidx", + "columns": [ + "filing_id" + ], + "isUnique": true + }, + "filing_stmt_ticker_date_idx": { + "name": "filing_stmt_ticker_date_idx", + "columns": [ + "ticker", + "filing_date" + ], + "isUnique": false + }, + "filing_stmt_date_idx": { + "name": "filing_stmt_date_idx", + "columns": [ + "filing_date" + ], + "isUnique": false + }, + "filing_stmt_status_idx": { + "name": "filing_stmt_status_idx", + "columns": [ + "parse_status" + ], + "isUnique": false + } + }, + "foreignKeys": { + "filing_statement_snapshot_filing_id_filing_id_fk": { + "name": "filing_statement_snapshot_filing_id_filing_id_fk", + "tableFrom": "filing_statement_snapshot", + "tableTo": "filing", + "columnsFrom": [ + "filing_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "filing_taxonomy_asset": { + "name": "filing_taxonomy_asset", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "snapshot_id": { + "name": "snapshot_id", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "asset_type": { + "name": "asset_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "url": { + "name": "url", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "size_bytes": { + "name": "size_bytes", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "score": { + "name": "score", + "type": "numeric", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "is_selected": { + "name": "is_selected", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "filing_taxonomy_asset_snapshot_idx": { + "name": "filing_taxonomy_asset_snapshot_idx", + "columns": [ + "snapshot_id" + ], + "isUnique": false + }, + "filing_taxonomy_asset_type_idx": { + "name": "filing_taxonomy_asset_type_idx", + "columns": [ + "snapshot_id", + "asset_type" + ], + "isUnique": false + } + }, + "foreignKeys": { + "filing_taxonomy_asset_snapshot_id_filing_taxonomy_snapshot_id_fk": { + "name": "filing_taxonomy_asset_snapshot_id_filing_taxonomy_snapshot_id_fk", + "tableFrom": "filing_taxonomy_asset", + "tableTo": "filing_taxonomy_snapshot", + "columnsFrom": [ + "snapshot_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "filing_taxonomy_concept": { + "name": "filing_taxonomy_concept", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "snapshot_id": { + "name": "snapshot_id", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "concept_key": { + "name": "concept_key", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "qname": { + "name": "qname", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "namespace_uri": { + "name": "namespace_uri", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "local_name": { + "name": "local_name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "label": { + "name": "label", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "is_extension": { + "name": "is_extension", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + }, + "balance": { + "name": "balance", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "period_type": { + "name": "period_type", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "data_type": { + "name": "data_type", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "statement_kind": { + "name": "statement_kind", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "role_uri": { + "name": "role_uri", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "authoritative_concept_key": { + "name": "authoritative_concept_key", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "mapping_method": { + "name": "mapping_method", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "surface_key": { + "name": "surface_key", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "detail_parent_surface_key": { + "name": "detail_parent_surface_key", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "kpi_key": { + "name": "kpi_key", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "residual_flag": { + "name": "residual_flag", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + }, + "presentation_order": { + "name": "presentation_order", + "type": "numeric", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "presentation_depth": { + "name": "presentation_depth", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "parent_concept_key": { + "name": "parent_concept_key", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "is_abstract": { + "name": "is_abstract", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "filing_taxonomy_concept_snapshot_idx": { + "name": "filing_taxonomy_concept_snapshot_idx", + "columns": [ + "snapshot_id" + ], + "isUnique": false + }, + "filing_taxonomy_concept_statement_idx": { + "name": "filing_taxonomy_concept_statement_idx", + "columns": [ + "snapshot_id", + "statement_kind" + ], + "isUnique": false + }, + "filing_taxonomy_concept_uidx": { + "name": "filing_taxonomy_concept_uidx", + "columns": [ + "snapshot_id", + "concept_key", + "role_uri", + "presentation_order" + ], + "isUnique": true + } + }, + "foreignKeys": { + "filing_taxonomy_concept_snapshot_id_filing_taxonomy_snapshot_id_fk": { + "name": "filing_taxonomy_concept_snapshot_id_filing_taxonomy_snapshot_id_fk", + "tableFrom": "filing_taxonomy_concept", + "tableTo": "filing_taxonomy_snapshot", + "columnsFrom": [ + "snapshot_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "filing_taxonomy_context": { + "name": "filing_taxonomy_context", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "snapshot_id": { + "name": "snapshot_id", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "context_id": { + "name": "context_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "entity_identifier": { + "name": "entity_identifier", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "entity_scheme": { + "name": "entity_scheme", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "period_start": { + "name": "period_start", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "period_end": { + "name": "period_end", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "period_instant": { + "name": "period_instant", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "segment_json": { + "name": "segment_json", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "scenario_json": { + "name": "scenario_json", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "filing_taxonomy_context_snapshot_idx": { + "name": "filing_taxonomy_context_snapshot_idx", + "columns": [ + "snapshot_id" + ], + "isUnique": false + }, + "filing_taxonomy_context_uidx": { + "name": "filing_taxonomy_context_uidx", + "columns": [ + "snapshot_id", + "context_id" + ], + "isUnique": true + } + }, + "foreignKeys": { + "filing_taxonomy_context_snapshot_id_filing_taxonomy_snapshot_id_fk": { + "name": "filing_taxonomy_context_snapshot_id_filing_taxonomy_snapshot_id_fk", + "tableFrom": "filing_taxonomy_context", + "tableTo": "filing_taxonomy_snapshot", + "columnsFrom": [ + "snapshot_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "filing_taxonomy_fact": { + "name": "filing_taxonomy_fact", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "snapshot_id": { + "name": "snapshot_id", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "concept_key": { + "name": "concept_key", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "qname": { + "name": "qname", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "namespace_uri": { + "name": "namespace_uri", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "local_name": { + "name": "local_name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "data_type": { + "name": "data_type", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "statement_kind": { + "name": "statement_kind", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "role_uri": { + "name": "role_uri", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "authoritative_concept_key": { + "name": "authoritative_concept_key", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "mapping_method": { + "name": "mapping_method", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "surface_key": { + "name": "surface_key", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "detail_parent_surface_key": { + "name": "detail_parent_surface_key", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "kpi_key": { + "name": "kpi_key", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "residual_flag": { + "name": "residual_flag", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + }, + "context_id": { + "name": "context_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "unit": { + "name": "unit", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "decimals": { + "name": "decimals", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "precision": { + "name": "precision", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "nil": { + "name": "nil", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + }, + "value_num": { + "name": "value_num", + "type": "numeric", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "period_start": { + "name": "period_start", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "period_end": { + "name": "period_end", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "period_instant": { + "name": "period_instant", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "dimensions": { + "name": "dimensions", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "is_dimensionless": { + "name": "is_dimensionless", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": true + }, + "source_file": { + "name": "source_file", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "filing_taxonomy_fact_snapshot_idx": { + "name": "filing_taxonomy_fact_snapshot_idx", + "columns": [ + "snapshot_id" + ], + "isUnique": false + }, + "filing_taxonomy_fact_concept_idx": { + "name": "filing_taxonomy_fact_concept_idx", + "columns": [ + "snapshot_id", + "concept_key" + ], + "isUnique": false + }, + "filing_taxonomy_fact_period_idx": { + "name": "filing_taxonomy_fact_period_idx", + "columns": [ + "snapshot_id", + "period_end", + "period_instant" + ], + "isUnique": false + }, + "filing_taxonomy_fact_statement_idx": { + "name": "filing_taxonomy_fact_statement_idx", + "columns": [ + "snapshot_id", + "statement_kind" + ], + "isUnique": false + } + }, + "foreignKeys": { + "filing_taxonomy_fact_snapshot_id_filing_taxonomy_snapshot_id_fk": { + "name": "filing_taxonomy_fact_snapshot_id_filing_taxonomy_snapshot_id_fk", + "tableFrom": "filing_taxonomy_fact", + "tableTo": "filing_taxonomy_snapshot", + "columnsFrom": [ + "snapshot_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "filing_taxonomy_metric_validation": { + "name": "filing_taxonomy_metric_validation", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "snapshot_id": { + "name": "snapshot_id", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "metric_key": { + "name": "metric_key", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "taxonomy_value": { + "name": "taxonomy_value", + "type": "numeric", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "llm_value": { + "name": "llm_value", + "type": "numeric", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "absolute_diff": { + "name": "absolute_diff", + "type": "numeric", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "relative_diff": { + "name": "relative_diff", + "type": "numeric", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "evidence_pages": { + "name": "evidence_pages", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "pdf_url": { + "name": "pdf_url", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "provider": { + "name": "provider", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "model": { + "name": "model", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "error": { + "name": "error", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "filing_taxonomy_metric_validation_snapshot_idx": { + "name": "filing_taxonomy_metric_validation_snapshot_idx", + "columns": [ + "snapshot_id" + ], + "isUnique": false + }, + "filing_taxonomy_metric_validation_status_idx": { + "name": "filing_taxonomy_metric_validation_status_idx", + "columns": [ + "snapshot_id", + "status" + ], + "isUnique": false + }, + "filing_taxonomy_metric_validation_uidx": { + "name": "filing_taxonomy_metric_validation_uidx", + "columns": [ + "snapshot_id", + "metric_key" + ], + "isUnique": true + } + }, + "foreignKeys": { + "filing_taxonomy_metric_validation_snapshot_id_filing_taxonomy_snapshot_id_fk": { + "name": "filing_taxonomy_metric_validation_snapshot_id_filing_taxonomy_snapshot_id_fk", + "tableFrom": "filing_taxonomy_metric_validation", + "tableTo": "filing_taxonomy_snapshot", + "columnsFrom": [ + "snapshot_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "filing_taxonomy_snapshot": { + "name": "filing_taxonomy_snapshot", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "filing_id": { + "name": "filing_id", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "ticker": { + "name": "ticker", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "filing_date": { + "name": "filing_date", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "filing_type": { + "name": "filing_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "parse_status": { + "name": "parse_status", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "parse_error": { + "name": "parse_error", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "source": { + "name": "source", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "parser_engine": { + "name": "parser_engine", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'fiscal-xbrl'" + }, + "parser_version": { + "name": "parser_version", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'unknown'" + }, + "taxonomy_regime": { + "name": "taxonomy_regime", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'unknown'" + }, + "fiscal_pack": { + "name": "fiscal_pack", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "periods": { + "name": "periods", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "faithful_rows": { + "name": "faithful_rows", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "statement_rows": { + "name": "statement_rows", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "surface_rows": { + "name": "surface_rows", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "detail_rows": { + "name": "detail_rows", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "kpi_rows": { + "name": "kpi_rows", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "derived_metrics": { + "name": "derived_metrics", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "validation_result": { + "name": "validation_result", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "normalization_summary": { + "name": "normalization_summary", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "facts_count": { + "name": "facts_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "concepts_count": { + "name": "concepts_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "dimensions_count": { + "name": "dimensions_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "filing_taxonomy_snapshot_filing_uidx": { + "name": "filing_taxonomy_snapshot_filing_uidx", + "columns": [ + "filing_id" + ], + "isUnique": true + }, + "filing_taxonomy_snapshot_ticker_date_idx": { + "name": "filing_taxonomy_snapshot_ticker_date_idx", + "columns": [ + "ticker", + "filing_date" + ], + "isUnique": false + }, + "filing_taxonomy_snapshot_status_idx": { + "name": "filing_taxonomy_snapshot_status_idx", + "columns": [ + "parse_status" + ], + "isUnique": false + } + }, + "foreignKeys": { + "filing_taxonomy_snapshot_filing_id_filing_id_fk": { + "name": "filing_taxonomy_snapshot_filing_id_filing_id_fk", + "tableFrom": "filing_taxonomy_snapshot", + "tableTo": "filing", + "columnsFrom": [ + "filing_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "holding": { + "name": "holding", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "ticker": { + "name": "ticker", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "company_name": { + "name": "company_name", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "shares": { + "name": "shares", + "type": "numeric", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "avg_cost": { + "name": "avg_cost", + "type": "numeric", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "current_price": { + "name": "current_price", + "type": "numeric", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "market_value": { + "name": "market_value", + "type": "numeric", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "gain_loss": { + "name": "gain_loss", + "type": "numeric", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "gain_loss_pct": { + "name": "gain_loss_pct", + "type": "numeric", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "last_price_at": { + "name": "last_price_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "holding_user_ticker_uidx": { + "name": "holding_user_ticker_uidx", + "columns": [ + "user_id", + "ticker" + ], + "isUnique": true + }, + "holding_user_idx": { + "name": "holding_user_idx", + "columns": [ + "user_id" + ], + "isUnique": false + } + }, + "foreignKeys": { + "holding_user_id_user_id_fk": { + "name": "holding_user_id_user_id_fk", + "tableFrom": "holding", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "invitation": { + "name": "invitation", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "organizationId": { + "name": "organizationId", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "role": { + "name": "role", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'pending'" + }, + "expiresAt": { + "name": "expiresAt", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "createdAt": { + "name": "createdAt", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "inviterId": { + "name": "inviterId", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "invitation_organizationId_idx": { + "name": "invitation_organizationId_idx", + "columns": [ + "organizationId" + ], + "isUnique": false + }, + "invitation_email_idx": { + "name": "invitation_email_idx", + "columns": [ + "email" + ], + "isUnique": false + } + }, + "foreignKeys": { + "invitation_organizationId_organization_id_fk": { + "name": "invitation_organizationId_organization_id_fk", + "tableFrom": "invitation", + "tableTo": "organization", + "columnsFrom": [ + "organizationId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "invitation_inviterId_user_id_fk": { + "name": "invitation_inviterId_user_id_fk", + "tableFrom": "invitation", + "tableTo": "user", + "columnsFrom": [ + "inviterId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "member": { + "name": "member", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "organizationId": { + "name": "organizationId", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "userId": { + "name": "userId", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "role": { + "name": "role", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'member'" + }, + "createdAt": { + "name": "createdAt", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "member_organizationId_idx": { + "name": "member_organizationId_idx", + "columns": [ + "organizationId" + ], + "isUnique": false + }, + "member_userId_idx": { + "name": "member_userId_idx", + "columns": [ + "userId" + ], + "isUnique": false + } + }, + "foreignKeys": { + "member_organizationId_organization_id_fk": { + "name": "member_organizationId_organization_id_fk", + "tableFrom": "member", + "tableTo": "organization", + "columnsFrom": [ + "organizationId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "member_userId_user_id_fk": { + "name": "member_userId_user_id_fk", + "tableFrom": "member", + "tableTo": "user", + "columnsFrom": [ + "userId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "organization": { + "name": "organization", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "slug": { + "name": "slug", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "logo": { + "name": "logo", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "createdAt": { + "name": "createdAt", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "metadata": { + "name": "metadata", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "organization_slug_uidx": { + "name": "organization_slug_uidx", + "columns": [ + "slug" + ], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "portfolio_insight": { + "name": "portfolio_insight", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "provider": { + "name": "provider", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "model": { + "name": "model", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "content": { + "name": "content", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "insight_user_created_idx": { + "name": "insight_user_created_idx", + "columns": [ + "user_id", + "created_at" + ], + "isUnique": false + } + }, + "foreignKeys": { + "portfolio_insight_user_id_user_id_fk": { + "name": "portfolio_insight_user_id_user_id_fk", + "tableFrom": "portfolio_insight", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "research_artifact": { + "name": "research_artifact", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "organization_id": { + "name": "organization_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "ticker": { + "name": "ticker", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "accession_number": { + "name": "accession_number", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "kind": { + "name": "kind", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "source": { + "name": "source", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'user'" + }, + "subtype": { + "name": "subtype", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "summary": { + "name": "summary", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "body_markdown": { + "name": "body_markdown", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "search_text": { + "name": "search_text", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "visibility_scope": { + "name": "visibility_scope", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'private'" + }, + "tags": { + "name": "tags", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "metadata": { + "name": "metadata", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "file_name": { + "name": "file_name", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "mime_type": { + "name": "mime_type", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "file_size_bytes": { + "name": "file_size_bytes", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "storage_path": { + "name": "storage_path", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "research_artifact_ticker_idx": { + "name": "research_artifact_ticker_idx", + "columns": [ + "user_id", + "ticker", + "updated_at" + ], + "isUnique": false + }, + "research_artifact_kind_idx": { + "name": "research_artifact_kind_idx", + "columns": [ + "user_id", + "kind", + "updated_at" + ], + "isUnique": false + }, + "research_artifact_accession_idx": { + "name": "research_artifact_accession_idx", + "columns": [ + "user_id", + "accession_number" + ], + "isUnique": false + }, + "research_artifact_source_idx": { + "name": "research_artifact_source_idx", + "columns": [ + "user_id", + "source", + "updated_at" + ], + "isUnique": false + } + }, + "foreignKeys": { + "research_artifact_user_id_user_id_fk": { + "name": "research_artifact_user_id_user_id_fk", + "tableFrom": "research_artifact", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "research_artifact_organization_id_organization_id_fk": { + "name": "research_artifact_organization_id_organization_id_fk", + "tableFrom": "research_artifact", + "tableTo": "organization", + "columnsFrom": [ + "organization_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "research_copilot_message": { + "name": "research_copilot_message", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "session_id": { + "name": "session_id", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "role": { + "name": "role", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "content_markdown": { + "name": "content_markdown", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "citations": { + "name": "citations", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "follow_ups": { + "name": "follow_ups", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "suggested_actions": { + "name": "suggested_actions", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "selected_sources": { + "name": "selected_sources", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "pinned_artifact_ids": { + "name": "pinned_artifact_ids", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "memo_section": { + "name": "memo_section", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "research_copilot_message_session_idx": { + "name": "research_copilot_message_session_idx", + "columns": [ + "session_id", + "created_at" + ], + "isUnique": false + }, + "research_copilot_message_user_idx": { + "name": "research_copilot_message_user_idx", + "columns": [ + "user_id", + "created_at" + ], + "isUnique": false + } + }, + "foreignKeys": { + "research_copilot_message_session_id_research_copilot_session_id_fk": { + "name": "research_copilot_message_session_id_research_copilot_session_id_fk", + "tableFrom": "research_copilot_message", + "tableTo": "research_copilot_session", + "columnsFrom": [ + "session_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "research_copilot_message_user_id_user_id_fk": { + "name": "research_copilot_message_user_id_user_id_fk", + "tableFrom": "research_copilot_message", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "research_copilot_session": { + "name": "research_copilot_session", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "ticker": { + "name": "ticker", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "selected_sources": { + "name": "selected_sources", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "pinned_artifact_ids": { + "name": "pinned_artifact_ids", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "research_copilot_session_ticker_uidx": { + "name": "research_copilot_session_ticker_uidx", + "columns": [ + "user_id", + "ticker" + ], + "isUnique": true + }, + "research_copilot_session_updated_idx": { + "name": "research_copilot_session_updated_idx", + "columns": [ + "user_id", + "updated_at" + ], + "isUnique": false + } + }, + "foreignKeys": { + "research_copilot_session_user_id_user_id_fk": { + "name": "research_copilot_session_user_id_user_id_fk", + "tableFrom": "research_copilot_session", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "research_journal_entry": { + "name": "research_journal_entry", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "ticker": { + "name": "ticker", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "accession_number": { + "name": "accession_number", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "entry_type": { + "name": "entry_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "body_markdown": { + "name": "body_markdown", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "metadata": { + "name": "metadata", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "research_journal_ticker_idx": { + "name": "research_journal_ticker_idx", + "columns": [ + "user_id", + "ticker", + "created_at" + ], + "isUnique": false + }, + "research_journal_accession_idx": { + "name": "research_journal_accession_idx", + "columns": [ + "user_id", + "accession_number" + ], + "isUnique": false + } + }, + "foreignKeys": { + "research_journal_entry_user_id_user_id_fk": { + "name": "research_journal_entry_user_id_user_id_fk", + "tableFrom": "research_journal_entry", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "research_memo": { + "name": "research_memo", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "organization_id": { + "name": "organization_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "ticker": { + "name": "ticker", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "rating": { + "name": "rating", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "conviction": { + "name": "conviction", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "time_horizon_months": { + "name": "time_horizon_months", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "packet_title": { + "name": "packet_title", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "packet_subtitle": { + "name": "packet_subtitle", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "thesis_markdown": { + "name": "thesis_markdown", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "''" + }, + "variant_view_markdown": { + "name": "variant_view_markdown", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "''" + }, + "catalysts_markdown": { + "name": "catalysts_markdown", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "''" + }, + "risks_markdown": { + "name": "risks_markdown", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "''" + }, + "disconfirming_evidence_markdown": { + "name": "disconfirming_evidence_markdown", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "''" + }, + "next_actions_markdown": { + "name": "next_actions_markdown", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "''" + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "research_memo_ticker_uidx": { + "name": "research_memo_ticker_uidx", + "columns": [ + "user_id", + "ticker" + ], + "isUnique": true + }, + "research_memo_updated_idx": { + "name": "research_memo_updated_idx", + "columns": [ + "user_id", + "updated_at" + ], + "isUnique": false + } + }, + "foreignKeys": { + "research_memo_user_id_user_id_fk": { + "name": "research_memo_user_id_user_id_fk", + "tableFrom": "research_memo", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "research_memo_organization_id_organization_id_fk": { + "name": "research_memo_organization_id_organization_id_fk", + "tableFrom": "research_memo", + "tableTo": "organization", + "columnsFrom": [ + "organization_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "research_memo_evidence": { + "name": "research_memo_evidence", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "memo_id": { + "name": "memo_id", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "artifact_id": { + "name": "artifact_id", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "section": { + "name": "section", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "annotation": { + "name": "annotation", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "sort_order": { + "name": "sort_order", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "research_memo_evidence_memo_idx": { + "name": "research_memo_evidence_memo_idx", + "columns": [ + "memo_id", + "section", + "sort_order" + ], + "isUnique": false + }, + "research_memo_evidence_artifact_idx": { + "name": "research_memo_evidence_artifact_idx", + "columns": [ + "artifact_id" + ], + "isUnique": false + }, + "research_memo_evidence_unique_uidx": { + "name": "research_memo_evidence_unique_uidx", + "columns": [ + "memo_id", + "artifact_id", + "section" + ], + "isUnique": true + } + }, + "foreignKeys": { + "research_memo_evidence_memo_id_research_memo_id_fk": { + "name": "research_memo_evidence_memo_id_research_memo_id_fk", + "tableFrom": "research_memo_evidence", + "tableTo": "research_memo", + "columnsFrom": [ + "memo_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "research_memo_evidence_artifact_id_research_artifact_id_fk": { + "name": "research_memo_evidence_artifact_id_research_artifact_id_fk", + "tableFrom": "research_memo_evidence", + "tableTo": "research_artifact", + "columnsFrom": [ + "artifact_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "search_chunk": { + "name": "search_chunk", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "document_id": { + "name": "document_id", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "chunk_index": { + "name": "chunk_index", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "chunk_text": { + "name": "chunk_text", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "char_count": { + "name": "char_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "start_offset": { + "name": "start_offset", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "end_offset": { + "name": "end_offset", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "heading_path": { + "name": "heading_path", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "citation_label": { + "name": "citation_label", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "search_chunk_document_chunk_uidx": { + "name": "search_chunk_document_chunk_uidx", + "columns": [ + "document_id", + "chunk_index" + ], + "isUnique": true + }, + "search_chunk_document_idx": { + "name": "search_chunk_document_idx", + "columns": [ + "document_id" + ], + "isUnique": false + } + }, + "foreignKeys": { + "search_chunk_document_id_search_document_id_fk": { + "name": "search_chunk_document_id_search_document_id_fk", + "tableFrom": "search_chunk", + "tableTo": "search_document", + "columnsFrom": [ + "document_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "search_document": { + "name": "search_document", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "source_kind": { + "name": "source_kind", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "source_ref": { + "name": "source_ref", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "scope": { + "name": "scope", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "ticker": { + "name": "ticker", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "accession_number": { + "name": "accession_number", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "content_text": { + "name": "content_text", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "content_hash": { + "name": "content_hash", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "metadata": { + "name": "metadata", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "index_status": { + "name": "index_status", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "indexed_at": { + "name": "indexed_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "last_error": { + "name": "last_error", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "search_document_source_uidx": { + "name": "search_document_source_uidx", + "columns": [ + "scope", + "ifnull(\"user_id\", '')", + "source_kind", + "source_ref" + ], + "isUnique": true + }, + "search_document_scope_idx": { + "name": "search_document_scope_idx", + "columns": [ + "scope", + "source_kind", + "ticker", + "updated_at" + ], + "isUnique": false + }, + "search_document_accession_idx": { + "name": "search_document_accession_idx", + "columns": [ + "accession_number", + "source_kind" + ], + "isUnique": false + } + }, + "foreignKeys": { + "search_document_user_id_user_id_fk": { + "name": "search_document_user_id_user_id_fk", + "tableFrom": "search_document", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "session": { + "name": "session", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "expiresAt": { + "name": "expiresAt", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "token": { + "name": "token", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "createdAt": { + "name": "createdAt", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updatedAt": { + "name": "updatedAt", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "ipAddress": { + "name": "ipAddress", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "userAgent": { + "name": "userAgent", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "userId": { + "name": "userId", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "impersonatedBy": { + "name": "impersonatedBy", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "activeOrganizationId": { + "name": "activeOrganizationId", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "session_token_uidx": { + "name": "session_token_uidx", + "columns": [ + "token" + ], + "isUnique": true + }, + "session_userId_idx": { + "name": "session_userId_idx", + "columns": [ + "userId" + ], + "isUnique": false + } + }, + "foreignKeys": { + "session_userId_user_id_fk": { + "name": "session_userId_user_id_fk", + "tableFrom": "session", + "tableTo": "user", + "columnsFrom": [ + "userId" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "task_run": { + "name": "task_run", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "task_type": { + "name": "task_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "stage": { + "name": "stage", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "stage_detail": { + "name": "stage_detail", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "stage_context": { + "name": "stage_context", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "resource_key": { + "name": "resource_key", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "notification_read_at": { + "name": "notification_read_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "notification_silenced_at": { + "name": "notification_silenced_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "priority": { + "name": "priority", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "payload": { + "name": "payload", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "result": { + "name": "result", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "error": { + "name": "error", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "attempts": { + "name": "attempts", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "max_attempts": { + "name": "max_attempts", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "workflow_run_id": { + "name": "workflow_run_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "finished_at": { + "name": "finished_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "task_user_created_idx": { + "name": "task_user_created_idx", + "columns": [ + "user_id", + "created_at" + ], + "isUnique": false + }, + "task_user_updated_idx": { + "name": "task_user_updated_idx", + "columns": [ + "user_id", + "updated_at" + ], + "isUnique": false + }, + "task_status_idx": { + "name": "task_status_idx", + "columns": [ + "status" + ], + "isUnique": false + }, + "task_user_resource_status_idx": { + "name": "task_user_resource_status_idx", + "columns": [ + "user_id", + "task_type", + "resource_key", + "status", + "created_at" + ], + "isUnique": false + }, + "task_workflow_run_uidx": { + "name": "task_workflow_run_uidx", + "columns": [ + "workflow_run_id" + ], + "isUnique": true + } + }, + "foreignKeys": { + "task_run_user_id_user_id_fk": { + "name": "task_run_user_id_user_id_fk", + "tableFrom": "task_run", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "task_stage_event": { + "name": "task_stage_event", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "task_id": { + "name": "task_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "stage": { + "name": "stage", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "stage_detail": { + "name": "stage_detail", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "stage_context": { + "name": "stage_context", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "task_stage_event_task_created_idx": { + "name": "task_stage_event_task_created_idx", + "columns": [ + "task_id", + "created_at" + ], + "isUnique": false + }, + "task_stage_event_user_created_idx": { + "name": "task_stage_event_user_created_idx", + "columns": [ + "user_id", + "created_at" + ], + "isUnique": false + } + }, + "foreignKeys": { + "task_stage_event_task_id_task_run_id_fk": { + "name": "task_stage_event_task_id_task_run_id_fk", + "tableFrom": "task_stage_event", + "tableTo": "task_run", + "columnsFrom": [ + "task_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "task_stage_event_user_id_user_id_fk": { + "name": "task_stage_event_user_id_user_id_fk", + "tableFrom": "task_stage_event", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "user": { + "name": "user", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "emailVerified": { + "name": "emailVerified", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": false + }, + "image": { + "name": "image", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "createdAt": { + "name": "createdAt", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updatedAt": { + "name": "updatedAt", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "role": { + "name": "role", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "banned": { + "name": "banned", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false, + "default": false + }, + "banReason": { + "name": "banReason", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "banExpires": { + "name": "banExpires", + "type": "integer", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "user_email_uidx": { + "name": "user_email_uidx", + "columns": [ + "email" + ], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "verification": { + "name": "verification", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "autoincrement": false + }, + "identifier": { + "name": "identifier", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "value": { + "name": "value", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "expiresAt": { + "name": "expiresAt", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "createdAt": { + "name": "createdAt", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updatedAt": { + "name": "updatedAt", + "type": "integer", + "primaryKey": false, + "notNull": true, + "autoincrement": false + } + }, + "indexes": { + "verification_identifier_idx": { + "name": "verification_identifier_idx", + "columns": [ + "identifier" + ], + "isUnique": false + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + }, + "watchlist_item": { + "name": "watchlist_item", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "autoincrement": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "ticker": { + "name": "ticker", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "company_name": { + "name": "company_name", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "sector": { + "name": "sector", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "category": { + "name": "category", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "tags": { + "name": "tags", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'backlog'" + }, + "priority": { + "name": "priority", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false, + "default": "'medium'" + }, + "created_at": { + "name": "created_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "updated_at": { + "name": "updated_at", + "type": "text", + "primaryKey": false, + "notNull": true, + "autoincrement": false + }, + "last_reviewed_at": { + "name": "last_reviewed_at", + "type": "text", + "primaryKey": false, + "notNull": false, + "autoincrement": false + } + }, + "indexes": { + "watchlist_user_ticker_uidx": { + "name": "watchlist_user_ticker_uidx", + "columns": [ + "user_id", + "ticker" + ], + "isUnique": true + }, + "watchlist_user_created_idx": { + "name": "watchlist_user_created_idx", + "columns": [ + "user_id", + "created_at" + ], + "isUnique": false + }, + "watchlist_user_updated_idx": { + "name": "watchlist_user_updated_idx", + "columns": [ + "user_id", + "updated_at" + ], + "isUnique": false + } + }, + "foreignKeys": { + "watchlist_item_user_id_user_id_fk": { + "name": "watchlist_item_user_id_user_id_fk", + "tableFrom": "watchlist_item", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "checkConstraints": {} + } + }, + "views": {}, + "enums": {}, + "_meta": { + "schemas": {}, + "tables": {}, + "columns": {} + }, + "internal": { + "indexes": { + "search_document_source_uidx": { + "columns": { + "ifnull(\"user_id\", '')": { + "isExpression": true + } + } + } + } + } +} \ No newline at end of file diff --git a/drizzle/meta/_journal.json b/drizzle/meta/_journal.json index 786b614..959881a 100644 --- a/drizzle/meta/_journal.json +++ b/drizzle/meta/_journal.json @@ -99,6 +99,13 @@ "when": 1773514800000, "tag": "0013_research_copilot", "breakpoints": true + }, + { + "idx": 14, + "version": "6", + "when": 1773533245431, + "tag": "0014_brave_randall", + "breakpoints": true } ] -} +} \ No newline at end of file diff --git a/lib/server/ai.test.ts b/lib/server/ai.test.ts index af64789..0290b17 100644 --- a/lib/server/ai.test.ts +++ b/lib/server/ai.test.ts @@ -24,7 +24,7 @@ describe('ai config and runtime', () => { expect(config.provider).toBe('zhipu'); expect(config.apiKey).toBe('key'); expect(config.baseUrl).toBe(CODING_API_BASE_URL); - expect(config.model).toBe('glm-5'); + expect(config.model).toBe('glm-4.6'); expect(config.temperature).toBe(0.2); }); @@ -80,7 +80,7 @@ describe('ai config and runtime', () => { expect(config.provider).toBe('zhipu'); expect(config.apiKey).toBe('new-key'); expect(config.baseUrl).toBe(CODING_API_BASE_URL); - expect(config.model).toBe('glm-5'); + expect(config.model).toBe('glm-4.6'); expect(config.temperature).toBe(0); return { modelId: config.model }; }); @@ -109,7 +109,7 @@ describe('ai config and runtime', () => { }); expect(result.provider).toBe('zhipu'); - expect(result.model).toBe('glm-5'); + expect(result.model).toBe('glm-4.6'); expect(result.text).toBe('{"summary":"ok"}'); expect(createModel).toHaveBeenCalledTimes(1); expect(generate).toHaveBeenCalledTimes(1); diff --git a/lib/server/ai.ts b/lib/server/ai.ts index 9297f7b..39fc4db 100644 --- a/lib/server/ai.ts +++ b/lib/server/ai.ts @@ -155,7 +155,7 @@ export function getReportAiConfig(options?: GetAiConfigOptions) { provider: 'zhipu', apiKey: envValue('ZHIPU_API_KEY', env), baseUrl: CODING_API_BASE_URL, - model: envValue('ZHIPU_MODEL', env) ?? 'glm-5', + model: envValue('ZHIPU_MODEL', env) ?? 'glm-4.6', temperature: parseTemperature(envValue('AI_TEMPERATURE', env)) } satisfies AiConfig; }