-- Name: oc_circles_remote oc_circles_remote_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_circles_remote
    ADD CONSTRAINT oc_circles_remote_pkey PRIMARY KEY (id);


--
-- Name: oc_circles_share_lock oc_circles_share_lock_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_circles_share_lock
    ADD CONSTRAINT oc_circles_share_lock_pkey PRIMARY KEY (id);


--
-- Name: oc_circles_token oc_circles_token_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_circles_token
    ADD CONSTRAINT oc_circles_token_pkey PRIMARY KEY (id);


--
-- Name: oc_collres_accesscache oc_collres_accesscache_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_collres_accesscache
    ADD CONSTRAINT oc_collres_accesscache_pkey PRIMARY KEY (user_id, collection_id, resource_type, resource_id);


--
-- Name: oc_collres_collections oc_collres_collections_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_collres_collections
    ADD CONSTRAINT oc_collres_collections_pkey PRIMARY KEY (id);


--
-- Name: oc_collres_resources oc_collres_resources_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_collres_resources
    ADD CONSTRAINT oc_collres_resources_pkey PRIMARY KEY (collection_id, resource_type, resource_id);


--
-- Name: oc_comments oc_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_comments
    ADD CONSTRAINT oc_comments_pkey PRIMARY KEY (id);


--
-- Name: oc_comments_read_markers oc_comments_read_markers_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_comments_read_markers
    ADD CONSTRAINT oc_comments_read_markers_pkey PRIMARY KEY (user_id, object_type, object_id);


--
-- Name: oc_dav_absence oc_dav_absence_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_dav_absence
    ADD CONSTRAINT oc_dav_absence_pkey PRIMARY KEY (id);


--
-- Name: oc_dav_cal_proxy oc_dav_cal_proxy_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_dav_cal_proxy
    ADD CONSTRAINT oc_dav_cal_proxy_pkey PRIMARY KEY (id);


--
-- Name: oc_dav_shares oc_dav_shares_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_dav_shares
    ADD CONSTRAINT oc_dav_shares_pkey PRIMARY KEY (id);


--
-- Name: oc_direct_edit oc_direct_edit_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_direct_edit
    ADD CONSTRAINT oc_direct_edit_pkey PRIMARY KEY (id);


--
-- Name: oc_directlink oc_directlink_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_directlink
    ADD CONSTRAINT oc_directlink_pkey PRIMARY KEY (id);


--
-- Name: oc_ex_apps_daemons oc_ex_apps_daemons_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_ex_apps_daemons
    ADD CONSTRAINT oc_ex_apps_daemons_pkey PRIMARY KEY (id);


--
-- Name: oc_ex_apps oc_ex_apps_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_ex_apps
    ADD CONSTRAINT oc_ex_apps_pkey PRIMARY KEY (id);


--
-- Name: oc_ex_apps_routes oc_ex_apps_routes_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_ex_apps_routes
    ADD CONSTRAINT oc_ex_apps_routes_pkey PRIMARY KEY (id);


--
-- Name: oc_ex_deploy_options oc_ex_deploy_options_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_ex_deploy_options
    ADD CONSTRAINT oc_ex_deploy_options_pkey PRIMARY KEY (id);


--
-- Name: oc_ex_occ_commands oc_ex_occ_commands_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_ex_occ_commands
    ADD CONSTRAINT oc_ex_occ_commands_pkey PRIMARY KEY (id);


--
-- Name: oc_ex_settings_forms oc_ex_settings_forms_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_ex_settings_forms
    ADD CONSTRAINT oc_ex_settings_forms_pkey PRIMARY KEY (id);


--
-- Name: oc_ex_task_processing oc_ex_task_processing_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_ex_task_processing
    ADD CONSTRAINT oc_ex_task_processing_pkey PRIMARY KEY (id);


--
-- Name: oc_ex_ui_files_actions oc_ex_ui_files_actions_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_ex_ui_files_actions
    ADD CONSTRAINT oc_ex_ui_files_actions_pkey PRIMARY KEY (id);


--
-- Name: oc_ex_ui_scripts oc_ex_ui_scripts_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_ex_ui_scripts
    ADD CONSTRAINT oc_ex_ui_scripts_pkey PRIMARY KEY (id);


--
-- Name: oc_ex_ui_states oc_ex_ui_states_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_ex_ui_states
    ADD CONSTRAINT oc_ex_ui_states_pkey PRIMARY KEY (id);


--
-- Name: oc_ex_ui_styles oc_ex_ui_styles_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_ex_ui_styles
    ADD CONSTRAINT oc_ex_ui_styles_pkey PRIMARY KEY (id);


--
-- Name: oc_ex_ui_top_menu oc_ex_ui_top_menu_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_ex_ui_top_menu
    ADD CONSTRAINT oc_ex_ui_top_menu_pkey PRIMARY KEY (id);


--
-- Name: oc_federated_invites oc_federated_invites_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_federated_invites
    ADD CONSTRAINT oc_federated_invites_pkey PRIMARY KEY (id);


--
-- Name: oc_federated_reshares oc_federated_reshares_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_federated_reshares
    ADD CONSTRAINT oc_federated_reshares_pkey PRIMARY KEY (share_id);


--
-- Name: oc_file_locks oc_file_locks_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_file_locks
    ADD CONSTRAINT oc_file_locks_pkey PRIMARY KEY (id);


--
-- Name: oc_filecache_extended oc_filecache_extended_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_filecache_extended
    ADD CONSTRAINT oc_filecache_extended_pkey PRIMARY KEY (fileid);


--
-- Name: oc_filecache oc_filecache_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_filecache
    ADD CONSTRAINT oc_filecache_pkey PRIMARY KEY (fileid);


--
-- Name: oc_files_metadata_index oc_files_metadata_index_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_files_metadata_index
    ADD CONSTRAINT oc_files_metadata_index_pkey PRIMARY KEY (id);


--
-- Name: oc_files_metadata oc_files_metadata_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_files_metadata
    ADD CONSTRAINT oc_files_metadata_pkey PRIMARY KEY (id);


--
-- Name: oc_files_reminders oc_files_reminders_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_files_reminders
    ADD CONSTRAINT oc_files_reminders_pkey PRIMARY KEY (id);


--
-- Name: oc_files_trash oc_files_trash_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_files_trash
    ADD CONSTRAINT oc_files_trash_pkey PRIMARY KEY (auto_id);


--
-- Name: oc_files_versions oc_files_versions_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_files_versions
    ADD CONSTRAINT oc_files_versions_pkey PRIMARY KEY (id);


--
-- Name: oc_flow_checks oc_flow_checks_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_flow_checks
    ADD CONSTRAINT oc_flow_checks_pkey PRIMARY KEY (id);


--
-- Name: oc_flow_operations oc_flow_operations_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_flow_operations
    ADD CONSTRAINT oc_flow_operations_pkey PRIMARY KEY (id);


--
-- Name: oc_flow_operations_scope oc_flow_operations_scope_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_flow_operations_scope
    ADD CONSTRAINT oc_flow_operations_scope_pkey PRIMARY KEY (id);


--
-- Name: oc_group_admin oc_group_admin_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_group_admin
    ADD CONSTRAINT oc_group_admin_pkey PRIMARY KEY (gid, uid);


--
-- Name: oc_group_user oc_group_user_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_group_user
    ADD CONSTRAINT oc_group_user_pkey PRIMARY KEY (gid, uid);


--
-- Name: oc_groups oc_groups_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_groups
    ADD CONSTRAINT oc_groups_pkey PRIMARY KEY (gid);


--
-- Name: oc_jobs oc_jobs_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_jobs
    ADD CONSTRAINT oc_jobs_pkey PRIMARY KEY (id);


--
-- Name: oc_known_users oc_known_users_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_known_users
    ADD CONSTRAINT oc_known_users_pkey PRIMARY KEY (id);


--
-- Name: oc_login_flow_v2 oc_login_flow_v2_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_login_flow_v2
    ADD CONSTRAINT oc_login_flow_v2_pkey PRIMARY KEY (id);


--
-- Name: oc_migrations oc_migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_migrations
    ADD CONSTRAINT oc_migrations_pkey PRIMARY KEY (app, version);


--
-- Name: oc_mimetypes oc_mimetypes_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_mimetypes
    ADD CONSTRAINT oc_mimetypes_pkey PRIMARY KEY (id);


--
-- Name: oc_mounts oc_mounts_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_mounts
    ADD CONSTRAINT oc_mounts_pkey PRIMARY KEY (id);


--
-- Name: oc_notifications oc_notifications_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_notifications
    ADD CONSTRAINT oc_notifications_pkey PRIMARY KEY (notification_id);


--
-- Name: oc_notifications_pushhash oc_notifications_pushhash_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_notifications_pushhash
    ADD CONSTRAINT oc_notifications_pushhash_pkey PRIMARY KEY (id);


--
-- Name: oc_notifications_settings oc_notifications_settings_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_notifications_settings
    ADD CONSTRAINT oc_notifications_settings_pkey PRIMARY KEY (id);


--
-- Name: oc_oauth2_access_tokens oc_oauth2_access_tokens_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_oauth2_access_tokens
    ADD CONSTRAINT oc_oauth2_access_tokens_pkey PRIMARY KEY (id);


--
-- Name: oc_oauth2_clients oc_oauth2_clients_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_oauth2_clients
    ADD CONSTRAINT oc_oauth2_clients_pkey PRIMARY KEY (id);


--
-- Name: oc_open_local_editor oc_open_local_editor_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_open_local_editor
    ADD CONSTRAINT oc_open_local_editor_pkey PRIMARY KEY (id);


--
-- Name: oc_photos_albums_collabs oc_photos_albums_collabs_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_photos_albums_collabs
    ADD CONSTRAINT oc_photos_albums_collabs_pkey PRIMARY KEY (id);


--
-- Name: oc_photos_albums_files oc_photos_albums_files_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_photos_albums_files
    ADD CONSTRAINT oc_photos_albums_files_pkey PRIMARY KEY (album_file_id);


--
-- Name: oc_photos_albums oc_photos_albums_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_photos_albums
    ADD CONSTRAINT oc_photos_albums_pkey PRIMARY KEY (album_id);


--
-- Name: oc_preferences_ex oc_preferences_ex_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_preferences_ex
    ADD CONSTRAINT oc_preferences_ex_pkey PRIMARY KEY (id);


--
-- Name: oc_preferences oc_preferences_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_preferences
    ADD CONSTRAINT oc_preferences_pkey PRIMARY KEY (userid, appid, configkey);


--
-- Name: oc_privacy_admins oc_privacy_admins_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_privacy_admins
    ADD CONSTRAINT oc_privacy_admins_pkey PRIMARY KEY (id);


--
-- Name: oc_profile_config oc_profile_config_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_profile_config
    ADD CONSTRAINT oc_profile_config_pkey PRIMARY KEY (id);


--
-- Name: oc_properties oc_properties_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_properties
    ADD CONSTRAINT oc_properties_pkey PRIMARY KEY (id);


--
-- Name: oc_ratelimit_entries oc_ratelimit_entries_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_ratelimit_entries
    ADD CONSTRAINT oc_ratelimit_entries_pkey PRIMARY KEY (id);


--
-- Name: oc_reactions oc_reactions_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_reactions
    ADD CONSTRAINT oc_reactions_pkey PRIMARY KEY (id);


--
-- Name: oc_recent_contact oc_recent_contact_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_recent_contact
    ADD CONSTRAINT oc_recent_contact_pkey PRIMARY KEY (id);


--
-- Name: oc_schedulingobjects oc_schedulingobjects_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_schedulingobjects
    ADD CONSTRAINT oc_schedulingobjects_pkey PRIMARY KEY (id);


--
-- Name: oc_sec_signatory oc_sec_signatory_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_sec_signatory
    ADD CONSTRAINT oc_sec_signatory_pkey PRIMARY KEY (id);


--
-- Name: oc_share_external oc_share_external_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_share_external
    ADD CONSTRAINT oc_share_external_pkey PRIMARY KEY (id);


--
-- Name: oc_share oc_share_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_share
    ADD CONSTRAINT oc_share_pkey PRIMARY KEY (id);


--
-- Name: oc_shares_limits oc_shares_limits_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_shares_limits
    ADD CONSTRAINT oc_shares_limits_pkey PRIMARY KEY (id);


--
-- Name: oc_storages_credentials oc_storages_credentials_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_storages_credentials
    ADD CONSTRAINT oc_storages_credentials_pkey PRIMARY KEY (id);


--
-- Name: oc_storages oc_storages_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_storages
    ADD CONSTRAINT oc_storages_pkey PRIMARY KEY (numeric_id);


--
-- Name: oc_systemtag_group oc_systemtag_group_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_systemtag_group
    ADD CONSTRAINT oc_systemtag_group_pkey PRIMARY KEY (gid, systemtagid);


--
-- Name: oc_systemtag_object_mapping oc_systemtag_object_mapping_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_systemtag_object_mapping
    ADD CONSTRAINT oc_systemtag_object_mapping_pkey PRIMARY KEY (objecttype, objectid, systemtagid);


--
-- Name: oc_systemtag oc_systemtag_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_systemtag
    ADD CONSTRAINT oc_systemtag_pkey PRIMARY KEY (id);


--
-- Name: oc_taskprocessing_tasks oc_taskprocessing_tasks_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_taskprocessing_tasks
    ADD CONSTRAINT oc_taskprocessing_tasks_pkey PRIMARY KEY (id);


--
-- Name: oc_text2image_tasks oc_text2image_tasks_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_text2image_tasks
    ADD CONSTRAINT oc_text2image_tasks_pkey PRIMARY KEY (id);


--
-- Name: oc_text_documents oc_text_documents_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_text_documents
    ADD CONSTRAINT oc_text_documents_pkey PRIMARY KEY (id);


--
-- Name: oc_text_sessions oc_text_sessions_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_text_sessions
    ADD CONSTRAINT oc_text_sessions_pkey PRIMARY KEY (id);


--
-- Name: oc_text_steps oc_text_steps_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_text_steps
    ADD CONSTRAINT oc_text_steps_pkey PRIMARY KEY (id);


--
-- Name: oc_textprocessing_tasks oc_textprocessing_tasks_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_textprocessing_tasks
    ADD CONSTRAINT oc_textprocessing_tasks_pkey PRIMARY KEY (id);


--
-- Name: oc_trusted_servers oc_trusted_servers_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_trusted_servers
    ADD CONSTRAINT oc_trusted_servers_pkey PRIMARY KEY (id);


--
-- Name: oc_twofactor_backupcodes oc_twofactor_backupcodes_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_twofactor_backupcodes
    ADD CONSTRAINT oc_twofactor_backupcodes_pkey PRIMARY KEY (id);


--
-- Name: oc_twofactor_providers oc_twofactor_providers_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_twofactor_providers
    ADD CONSTRAINT oc_twofactor_providers_pkey PRIMARY KEY (provider_id, uid);


--
-- Name: oc_user_status oc_user_status_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_user_status
    ADD CONSTRAINT oc_user_status_pkey PRIMARY KEY (id);


--
-- Name: oc_user_transfer_owner oc_user_transfer_owner_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_user_transfer_owner
    ADD CONSTRAINT oc_user_transfer_owner_pkey PRIMARY KEY (id);


--
-- Name: oc_users oc_users_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_users
    ADD CONSTRAINT oc_users_pkey PRIMARY KEY (uid);


--
-- Name: oc_vcategory oc_vcategory_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_vcategory
    ADD CONSTRAINT oc_vcategory_pkey PRIMARY KEY (id);


--
-- Name: oc_vcategory_to_object oc_vcategory_to_object_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_vcategory_to_object
    ADD CONSTRAINT oc_vcategory_to_object_pkey PRIMARY KEY (categoryid, objid, type);


--
-- Name: oc_webauthn oc_webauthn_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_webauthn
    ADD CONSTRAINT oc_webauthn_pkey PRIMARY KEY (id);


--
-- Name: oc_webhook_listeners oc_webhook_listeners_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_webhook_listeners
    ADD CONSTRAINT oc_webhook_listeners_pkey PRIMARY KEY (id);


--
-- Name: oc_whats_new oc_whats_new_pkey; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_whats_new
    ADD CONSTRAINT oc_whats_new_pkey PRIMARY KEY (id);


--
-- Name: oc_federated_invites uniq_a2c17d5a5f37a13b; Type: CONSTRAINT; Schema: public; Owner: oc_admin
--

ALTER TABLE ONLY public.oc_federated_invites
    ADD CONSTRAINT uniq_a2c17d5a5f37a13b UNIQUE (token);


--
-- Name: ac_lazy_i; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX ac_lazy_i ON public.oc_appconfig USING btree (lazy);


--
-- Name: accounts_data_name; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX accounts_data_name ON public.oc_accounts_data USING btree (name);


--
-- Name: accounts_data_uid; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX accounts_data_uid ON public.oc_accounts_data USING btree (uid);


--
-- Name: accounts_data_value; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX accounts_data_value ON public.oc_accounts_data USING btree (value);


--
-- Name: activity_filter; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX activity_filter ON public.oc_activity USING btree (affecteduser, type, app, "timestamp");


--
-- Name: activity_filter_by; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX activity_filter_by ON public.oc_activity USING btree (affecteduser, "user", "timestamp");


--
-- Name: activity_object; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX activity_object ON public.oc_activity USING btree (object_type, object_id);


--
-- Name: activity_user_time; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX activity_user_time ON public.oc_activity USING btree (affecteduser, "timestamp");


--
-- Name: addressbook_index; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE UNIQUE INDEX addressbook_index ON public.oc_addressbooks USING btree (principaluri, uri);


--
-- Name: addressbookid_synctoken; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX addressbookid_synctoken ON public.oc_addressbookchanges USING btree (addressbookid, synctoken);


--
-- Name: admindel_groupid_idx; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX admindel_groupid_idx ON public.oc_authorized_groups USING btree (group_id);


--
-- Name: album_collabs_uniq_collab; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE UNIQUE INDEX album_collabs_uniq_collab ON public.oc_photos_albums_collabs USING btree (album_id, collaborator_id, collaborator_type);


--
-- Name: amp_latest_send_time; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX amp_latest_send_time ON public.oc_activity_mq USING btree (amq_latest_send);


--
-- Name: amp_timestamp_time; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX amp_timestamp_time ON public.oc_activity_mq USING btree (amq_timestamp);


--
-- Name: amp_user; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX amp_user ON public.oc_activity_mq USING btree (amq_affecteduser);


--
-- Name: appconfig_ex__configkey; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX appconfig_ex__configkey ON public.oc_appconfig_ex USING btree (configkey);


--
-- Name: appconfig_ex__idx; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE UNIQUE INDEX appconfig_ex__idx ON public.oc_appconfig_ex USING btree (appid, configkey);


--
-- Name: authtoken_last_activity_idx; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX authtoken_last_activity_idx ON public.oc_authtoken USING btree (last_activity);


--
-- Name: authtoken_token_index; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE UNIQUE INDEX authtoken_token_index ON public.oc_authtoken USING btree (token);


--
-- Name: authtoken_uid_index; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX authtoken_uid_index ON public.oc_authtoken USING btree (uid);


--
-- Name: bruteforce_attempts_ip; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX bruteforce_attempts_ip ON public.oc_bruteforce_attempts USING btree (ip);


--
-- Name: bruteforce_attempts_subnet; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX bruteforce_attempts_subnet ON public.oc_bruteforce_attempts USING btree (subnet);


--
-- Name: calendar_invitation_tokens; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX calendar_invitation_tokens ON public.oc_calendar_invitations USING btree (token);


--
-- Name: calendar_reminder_objid; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX calendar_reminder_objid ON public.oc_calendar_reminders USING btree (object_id);


--
-- Name: calendar_reminder_uidrec; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX calendar_reminder_uidrec ON public.oc_calendar_reminders USING btree (uid, recurrence_id);


--
-- Name: calendar_resources_bkdrsc; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX calendar_resources_bkdrsc ON public.oc_calendar_resources USING btree (backend_id, resource_id);


--
-- Name: calendar_resources_email; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX calendar_resources_email ON public.oc_calendar_resources USING btree (email);


--
-- Name: calendar_resources_md_idk; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX calendar_resources_md_idk ON public.oc_calendar_resources_md USING btree (resource_id, key);


--
-- Name: calendar_resources_name; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX calendar_resources_name ON public.oc_calendar_resources USING btree (displayname);


--
-- Name: calendar_rooms_bkdrsc; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX calendar_rooms_bkdrsc ON public.oc_calendar_rooms USING btree (backend_id, resource_id);


--
-- Name: calendar_rooms_email; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX calendar_rooms_email ON public.oc_calendar_rooms USING btree (email);


--
-- Name: calendar_rooms_md_idk; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX calendar_rooms_md_idk ON public.oc_calendar_rooms_md USING btree (room_id, key);


--
-- Name: calendar_rooms_name; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX calendar_rooms_name ON public.oc_calendar_rooms USING btree (displayname);


--
-- Name: calendarobject_calid_index; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX calendarobject_calid_index ON public.oc_calendarobjects_props USING btree (calendarid, calendartype);


--
-- Name: calendarobject_index; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX calendarobject_index ON public.oc_calendarobjects_props USING btree (objectid, calendartype);


--
-- Name: calendarobject_name_index; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX calendarobject_name_index ON public.oc_calendarobjects_props USING btree (name, calendartype);


--
-- Name: calendarobject_value_index; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX calendarobject_value_index ON public.oc_calendarobjects_props USING btree (value, calendartype);


--
-- Name: calendars_index; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE UNIQUE INDEX calendars_index ON public.oc_calendars USING btree (principaluri, uri);


--
-- Name: calid_type_synctoken; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX calid_type_synctoken ON public.oc_calendarchanges USING btree (calendarid, calendartype, synctoken);


--
-- Name: calobj_clssfction_index; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX calobj_clssfction_index ON public.oc_calendarobjects USING btree (classification);


--
-- Name: calobjects_by_uid_index; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE UNIQUE INDEX calobjects_by_uid_index ON public.oc_calendarobjects USING btree (calendarid, calendartype, uid);


--
-- Name: calobjects_index; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE UNIQUE INDEX calobjects_index ON public.oc_calendarobjects USING btree (calendarid, calendartype, uri);


--
-- Name: cals_princ_del_idx; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX cals_princ_del_idx ON public.oc_calendars USING btree (principaluri, deleted_at);


--
-- Name: calsub_index; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE UNIQUE INDEX calsub_index ON public.oc_calendarsubscriptions USING btree (principaluri, uri);


--
-- Name: card_contactid_index; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX card_contactid_index ON public.oc_cards_properties USING btree (cardid);


--
-- Name: card_name_index; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX card_name_index ON public.oc_cards_properties USING btree (name);


--
-- Name: card_value_index; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX card_value_index ON public.oc_cards_properties USING btree (value);


--
-- Name: cards_abiduri; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX cards_abiduri ON public.oc_cards USING btree (addressbookid, uri);


--
-- Name: cards_prop_abid_name_value; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX cards_prop_abid_name_value ON public.oc_cards_properties USING btree (addressbookid, name, value);


--
-- Name: category_index; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX category_index ON public.oc_vcategory USING btree (category);


--
-- Name: circles_member_cisi; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX circles_member_cisi ON public.oc_circles_member USING btree (circle_id, single_id);


--
-- Name: circles_member_cisiuiutil; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX circles_member_cisiuiutil ON public.oc_circles_member USING btree (circle_id, single_id, user_id, user_type, instance, level);


--
-- Name: circles_membership_ifilci; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX circles_membership_ifilci ON public.oc_circles_membership USING btree (inheritance_first, inheritance_last, circle_id);


--
-- Name: circles_mount_cimipt; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX circles_mount_cimipt ON public.oc_circles_mount USING btree (circle_id, mount_id, parent, token);


--
-- Name: circles_mountpoint_ms; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX circles_mountpoint_ms ON public.oc_circles_mountpoint USING btree (mount_id, single_id);


--
-- Name: collres_user_res; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX collres_user_res ON public.oc_collres_accesscache USING btree (user_id, resource_type, resource_id);


--
-- Name: comment_reaction; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX comment_reaction ON public.oc_reactions USING btree (reaction);


--
-- Name: comment_reaction_parent_id; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX comment_reaction_parent_id ON public.oc_reactions USING btree (parent_id);


--
-- Name: comment_reaction_unique; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE UNIQUE INDEX comment_reaction_unique ON public.oc_reactions USING btree (parent_id, actor_type, actor_id, reaction);


--
-- Name: comments_actor_index; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX comments_actor_index ON public.oc_comments USING btree (actor_type, actor_id);


--
-- Name: comments_marker_object_index; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX comments_marker_object_index ON public.oc_comments_read_markers USING btree (object_type, object_id);


--
-- Name: comments_object_index; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX comments_object_index ON public.oc_comments USING btree (object_type, object_id, creation_timestamp);


--
-- Name: comments_parent_id_index; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX comments_parent_id_index ON public.oc_comments USING btree (parent_id);


--
-- Name: comments_topmost_parent_id_idx; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX comments_topmost_parent_id_idx ON public.oc_comments USING btree (topmost_parent_id);


--
-- Name: dav_absence_uid_idx; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE UNIQUE INDEX dav_absence_uid_idx ON public.oc_dav_absence USING btree (user_id);


--
-- Name: dav_cal_proxy_ipid; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX dav_cal_proxy_ipid ON public.oc_dav_cal_proxy USING btree (proxy_id);


--
-- Name: dav_cal_proxy_uidx; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE UNIQUE INDEX dav_cal_proxy_uidx ON public.oc_dav_cal_proxy USING btree (owner_id, proxy_id, permissions);


--
-- Name: dav_shares_index; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE UNIQUE INDEX dav_shares_index ON public.oc_dav_shares USING btree (principaluri, resourceid, type, publicuri);


--
-- Name: dav_shares_resourceid_access; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX dav_shares_resourceid_access ON public.oc_dav_shares USING btree (resourceid, access);


--
-- Name: dav_shares_resourceid_type; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX dav_shares_resourceid_type ON public.oc_dav_shares USING btree (resourceid, type);


--
-- Name: deploy_options__idx; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE UNIQUE INDEX deploy_options__idx ON public.oc_ex_deploy_options USING btree (appid, type);


--
-- Name: direct_edit_timestamp; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX direct_edit_timestamp ON public.oc_direct_edit USING btree ("timestamp");


--
-- Name: directlink_expiration_idx; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX directlink_expiration_idx ON public.oc_directlink USING btree (expiration);


--
-- Name: directlink_token_idx; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX directlink_token_idx ON public.oc_directlink USING btree (token);


--
-- Name: dname; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX dname ON public.oc_circles_circle USING btree (display_name);


--
-- Name: ex_apps__appid; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE UNIQUE INDEX ex_apps__appid ON public.oc_ex_apps USING btree (appid);


--
-- Name: ex_apps_c_port__idx; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE UNIQUE INDEX ex_apps_c_port__idx ON public.oc_ex_apps USING btree (daemon_config_name, port);


--
-- Name: ex_apps_daemons__name; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE UNIQUE INDEX ex_apps_daemons__name ON public.oc_ex_apps_daemons USING btree (name);


--
-- Name: ex_apps_routes_appid; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX ex_apps_routes_appid ON public.oc_ex_apps_routes USING btree (appid);


--
-- Name: ex_occ_commands__idx; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE UNIQUE INDEX ex_occ_commands__idx ON public.oc_ex_occ_commands USING btree (appid, name);


--
-- Name: ex_settings_forms__idx; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE UNIQUE INDEX ex_settings_forms__idx ON public.oc_ex_settings_forms USING btree (appid, formid);


--
-- Name: ex_ui_files_actions__idx; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE UNIQUE INDEX ex_ui_files_actions__idx ON public.oc_ex_ui_files_actions USING btree (appid, name);


--
-- Name: expire_date; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX expire_date ON public.oc_comments USING btree (expire_date);


--
-- Name: f_meta_index; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX f_meta_index ON public.oc_files_metadata_index USING btree (file_id, meta_key, meta_value_string);


--
-- Name: f_meta_index_i; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX f_meta_index_i ON public.oc_files_metadata_index USING btree (file_id, meta_key, meta_value_int);


--
-- Name: fce_ctime_idx; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX fce_ctime_idx ON public.oc_filecache_extended USING btree (creation_time);


--
-- Name: fce_utime_idx; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX fce_utime_idx ON public.oc_filecache_extended USING btree (upload_time);


--
-- Name: fedcals_last_sync_index; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX fedcals_last_sync_index ON public.oc_calendars_federated USING btree (last_sync);


--
-- Name: fedcals_uris_index; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX fedcals_uris_index ON public.oc_calendars_federated USING btree (principaluri, uri);


--
-- Name: file_source_index; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX file_source_index ON public.oc_share USING btree (file_source);


--
-- Name: files_meta_fileid; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE UNIQUE INDEX files_meta_fileid ON public.oc_files_metadata USING btree (file_id);


--
-- Name: files_versions_uniq_index; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE UNIQUE INDEX files_versions_uniq_index ON public.oc_files_versions USING btree (file_id, "timestamp");


--
-- Name: flow_unique_hash; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE UNIQUE INDEX flow_unique_hash ON public.oc_flow_checks USING btree (hash);


--
-- Name: flow_unique_scope; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE UNIQUE INDEX flow_unique_scope ON public.oc_flow_operations_scope USING btree (operation_id, type, value);


--
-- Name: fs_mtime; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX fs_mtime ON public.oc_filecache USING btree (mtime);


--
-- Name: fs_name_hash; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX fs_name_hash ON public.oc_filecache USING btree (name);


--
-- Name: fs_parent; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX fs_parent ON public.oc_filecache USING btree (parent);


--
-- Name: fs_parent_name_hash; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX fs_parent_name_hash ON public.oc_filecache USING btree (parent, name);


--
-- Name: fs_size; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX fs_size ON public.oc_filecache USING btree (size);


--
-- Name: fs_storage_mimepart; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX fs_storage_mimepart ON public.oc_filecache USING btree (storage, mimepart);


--
-- Name: fs_storage_mimetype; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX fs_storage_mimetype ON public.oc_filecache USING btree (storage, mimetype);


--
-- Name: fs_storage_path_hash; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE UNIQUE INDEX fs_storage_path_hash ON public.oc_filecache USING btree (storage, path_hash);


--
-- Name: fs_storage_path_prefix; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX fs_storage_path_prefix ON public.oc_filecache USING btree (storage, path);


--
-- Name: fs_storage_size; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX fs_storage_size ON public.oc_filecache USING btree (storage, size, fileid);


--
-- Name: group_admin_uid; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX group_admin_uid ON public.oc_group_admin USING btree (uid);


--
-- Name: gu_uid_index; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX gu_uid_index ON public.oc_group_user USING btree (uid);


--
-- Name: id_index; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX id_index ON public.oc_files_trash USING btree (id);


--
-- Name: idx_25c66a49e7a1254a; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX idx_25c66a49e7a1254a ON public.oc_circles_member USING btree (contact_id);


--
-- Name: idx_4d5afeca5f37a13b; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX idx_4d5afeca5f37a13b ON public.oc_direct_edit USING btree (token);


--
-- Name: idx_8195f5484230b1de; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX idx_8195f5484230b1de ON public.oc_circles_circle USING btree (instance);


--
-- Name: idx_8195f5485f8a7f73; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX idx_8195f5485f8a7f73 ON public.oc_circles_circle USING btree (source);


--
-- Name: idx_8195f548c317b362; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX idx_8195f548c317b362 ON public.oc_circles_circle USING btree (sanitized_name);


--
-- Name: idx_8195f548d48a2f7c; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX idx_8195f548d48a2f7c ON public.oc_circles_circle USING btree (config);


--
-- Name: idx_8fc816eae7c1d92b; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX idx_8fc816eae7c1d92b ON public.oc_circles_membership USING btree (single_id);


--
-- Name: idx_f94ef8334f8e741; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX idx_f94ef8334f8e741 ON public.oc_circles_remote USING btree (href);


--
-- Name: idx_f94ef83539b0606; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX idx_f94ef83539b0606 ON public.oc_circles_remote USING btree (uid);


--
-- Name: initiator_index; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX initiator_index ON public.oc_share USING btree (uid_initiator);


--
-- Name: item_share_type_index; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX item_share_type_index ON public.oc_share USING btree (item_type, share_type);


--
-- Name: job_argument_hash; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX job_argument_hash ON public.oc_jobs USING btree (class, argument_hash);


--
-- Name: job_class_index; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX job_class_index ON public.oc_jobs USING btree (class);


--
-- Name: job_lastcheck_reserved; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX job_lastcheck_reserved ON public.oc_jobs USING btree (last_checked, reserved_at);


--
-- Name: jobs_time_sensitive; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX jobs_time_sensitive ON public.oc_jobs USING btree (time_sensitive);


--
-- Name: ku_known_to; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX ku_known_to ON public.oc_known_users USING btree (known_to);


--
-- Name: ku_known_user; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX ku_known_user ON public.oc_known_users USING btree (known_user);


--
-- Name: lock_key_index; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE UNIQUE INDEX lock_key_index ON public.oc_file_locks USING btree (key);


--
-- Name: lock_ttl_index; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX lock_ttl_index ON public.oc_file_locks USING btree (ttl);


--
-- Name: login_token; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE UNIQUE INDEX login_token ON public.oc_login_flow_v2 USING btree (login_token);


--
-- Name: m_sid_rmt_rid; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX m_sid_rmt_rid ON public.oc_circles_mount USING btree (circle_id, remote, remote_id);


--
-- Name: mimetype_id_index; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE UNIQUE INDEX mimetype_id_index ON public.oc_mimetypes USING btree (mimetype);


--
-- Name: mount_user_storage; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX mount_user_storage ON public.oc_mounts USING btree (storage_id, user_id);


--
-- Name: mounts_class_index; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX mounts_class_index ON public.oc_mounts USING btree (mount_provider_class);


--
-- Name: mounts_mount_id_index; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX mounts_mount_id_index ON public.oc_mounts USING btree (mount_id);


--
-- Name: mounts_root_index; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX mounts_root_index ON public.oc_mounts USING btree (root_id);


--
-- Name: mounts_storage_index; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX mounts_storage_index ON public.oc_mounts USING btree (storage_id);


--
-- Name: mounts_user_root_path_index; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE UNIQUE INDEX mounts_user_root_path_index ON public.oc_mounts USING btree (user_id, root_id, mount_point_hash);


--
-- Name: mp_sid_hash; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE UNIQUE INDEX mp_sid_hash ON public.oc_circles_mountpoint USING btree (single_id, mountpoint_hash);


--
-- Name: notset_nextsend; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX notset_nextsend ON public.oc_notifications_settings USING btree (next_send_time);


--
-- Name: notset_user; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE UNIQUE INDEX notset_user ON public.oc_notifications_settings USING btree (user_id);


--
-- Name: oauth2_access_client_id_idx; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX oauth2_access_client_id_idx ON public.oc_oauth2_access_tokens USING btree (client_id);


--
-- Name: oauth2_access_hash_idx; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE UNIQUE INDEX oauth2_access_hash_idx ON public.oc_oauth2_access_tokens USING btree (hashed_code);


--
-- Name: oauth2_client_id_idx; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE UNIQUE INDEX oauth2_client_id_idx ON public.oc_oauth2_clients USING btree (client_identifier);


--
-- Name: oauth2_tk_c_created_idx; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX oauth2_tk_c_created_idx ON public.oc_oauth2_access_tokens USING btree (token_count, code_created_at);


--
-- Name: oc_notifications_app; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX oc_notifications_app ON public.oc_notifications USING btree (app);


--
-- Name: oc_notifications_object; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX oc_notifications_object ON public.oc_notifications USING btree (object_type, object_id);


--
-- Name: oc_notifications_timestamp; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX oc_notifications_timestamp ON public.oc_notifications USING btree ("timestamp");


--
-- Name: oc_notifications_user; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX oc_notifications_user ON public.oc_notifications USING btree ("user");


--
-- Name: oc_npushhash_di; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX oc_npushhash_di ON public.oc_notifications_pushhash USING btree (deviceidentifier);


--
-- Name: oc_npushhash_uid; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE UNIQUE INDEX oc_npushhash_uid ON public.oc_notifications_pushhash USING btree (uid, token);


--
-- Name: openlocal_user_path_token; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE UNIQUE INDEX openlocal_user_path_token ON public.oc_open_local_editor USING btree (user_id, path_hash, token);


--
-- Name: owner_index; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX owner_index ON public.oc_share USING btree (uid_owner);


--
-- Name: pa_user; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX pa_user ON public.oc_photos_albums USING btree ("user");


--
-- Name: paf_album_file; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE UNIQUE INDEX paf_album_file ON public.oc_photos_albums_files USING btree (album_id, file_id);


--
-- Name: paf_folder; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX paf_folder ON public.oc_photos_albums_files USING btree (album_id);


--
-- Name: parent_index; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX parent_index ON public.oc_share USING btree (parent);


--
-- Name: poll_token; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE UNIQUE INDEX poll_token ON public.oc_login_flow_v2 USING btree (poll_token);


--
-- Name: preferences_ex__configkey; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX preferences_ex__configkey ON public.oc_preferences_ex USING btree (configkey);


--
-- Name: preferences_ex__idx; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE UNIQUE INDEX preferences_ex__idx ON public.oc_preferences_ex USING btree (userid, appid, configkey);


--
-- Name: prefs_app_key_ind_fl_i; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX prefs_app_key_ind_fl_i ON public.oc_preferences USING btree (appid, configkey, indexed, flags);


--
-- Name: prefs_uid_lazy_i; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX prefs_uid_lazy_i ON public.oc_preferences USING btree (userid, lazy);


--
-- Name: profile_config_user_id_idx; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE UNIQUE INDEX profile_config_user_id_idx ON public.oc_profile_config USING btree (user_id);


--
-- Name: properties_name_path_user; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX properties_name_path_user ON public.oc_properties USING btree (propertyname, propertypath, userid);


--
-- Name: properties_path_index; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX properties_path_index ON public.oc_properties USING btree (userid, propertypath);


--
-- Name: properties_pathonly_index; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX properties_pathonly_index ON public.oc_properties USING btree (propertypath);


--
-- Name: ratelimit_delete_after; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX ratelimit_delete_after ON public.oc_ratelimit_entries USING btree (delete_after);


--
-- Name: ratelimit_hash; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX ratelimit_hash ON public.oc_ratelimit_entries USING btree (hash);


--
-- Name: rd_session_token_idx; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX rd_session_token_idx ON public.oc_text_sessions USING btree (token);


--
-- Name: rd_steps_did_idx; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX rd_steps_did_idx ON public.oc_text_steps USING btree (document_id);


--
-- Name: rd_steps_version_idx; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX rd_steps_version_idx ON public.oc_text_steps USING btree (version);


--
-- Name: recent_contact_actor_uid; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX recent_contact_actor_uid ON public.oc_recent_contact USING btree (actor_uid);


--
-- Name: recent_contact_email; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX recent_contact_email ON public.oc_recent_contact USING btree (email);


--
-- Name: recent_contact_fed_id; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX recent_contact_fed_id ON public.oc_recent_contact USING btree (federated_cloud_id);


--
-- Name: recent_contact_id_uid; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX recent_contact_id_uid ON public.oc_recent_contact USING btree (id, actor_uid);


--
-- Name: recent_contact_last_contact; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX recent_contact_last_contact ON public.oc_recent_contact USING btree (last_contact);


--
-- Name: recent_contact_uid; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX recent_contact_uid ON public.oc_recent_contact USING btree (uid);


--
-- Name: reminders_uniq_idx; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE UNIQUE INDEX reminders_uniq_idx ON public.oc_files_reminders USING btree (user_id, file_id, due_date);


--
-- Name: schedulobj_lastmodified_idx; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX schedulobj_lastmodified_idx ON public.oc_schedulingobjects USING btree (lastmodified);


--
-- Name: schedulobj_principuri_index; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX schedulobj_principuri_index ON public.oc_schedulingobjects USING btree (principaluri);


--
-- Name: sec_sig_key; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX sec_sig_key ON public.oc_sec_signatory USING btree (key_id_sum, provider_id);


--
-- Name: sec_sig_unic; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE UNIQUE INDEX sec_sig_unic ON public.oc_sec_signatory USING btree (provider_id, host, account);


--
-- Name: sh_external_mp; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE UNIQUE INDEX sh_external_mp ON public.oc_share_external USING btree ("user", mountpoint_hash);


--
-- Name: share_with_index; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX share_with_index ON public.oc_share USING btree (share_with);


--
-- Name: sicisimit; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE UNIQUE INDEX sicisimit ON public.oc_circles_token USING btree (share_id, circle_id, single_id, member_id, token);


--
-- Name: stocred_ui; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE UNIQUE INDEX stocred_ui ON public.oc_storages_credentials USING btree ("user", identifier);


--
-- Name: stocred_user; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX stocred_user ON public.oc_storages_credentials USING btree ("user");


--
-- Name: storages_id_index; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE UNIQUE INDEX storages_id_index ON public.oc_storages USING btree (id);


--
-- Name: systag_by_objectid; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX systag_by_objectid ON public.oc_systemtag_object_mapping USING btree (objectid);


--
-- Name: systag_by_tagid; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX systag_by_tagid ON public.oc_systemtag_object_mapping USING btree (systemtagid, objecttype);


--
-- Name: systag_objecttype; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX systag_objecttype ON public.oc_systemtag_object_mapping USING btree (objecttype);


--
-- Name: t2i_tasks_status; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX t2i_tasks_status ON public.oc_text2image_tasks USING btree (status);


--
-- Name: t2i_tasks_uid_appid_ident; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX t2i_tasks_uid_appid_ident ON public.oc_text2image_tasks USING btree (user_id, app_id, identifier);


--
-- Name: t2i_tasks_updated; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX t2i_tasks_updated ON public.oc_text2image_tasks USING btree (last_updated);


--
-- Name: tag_ident; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE UNIQUE INDEX tag_ident ON public.oc_systemtag USING btree (name, visibility, editable);


--
-- Name: task_processing_idx; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE UNIQUE INDEX task_processing_idx ON public.oc_ex_task_processing USING btree (app_id, name, task_type);


--
-- Name: taskp_tasks_status_type; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX taskp_tasks_status_type ON public.oc_taskprocessing_tasks USING btree (status, type);


--
-- Name: taskp_tasks_uid_appid_cid; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX taskp_tasks_uid_appid_cid ON public.oc_taskprocessing_tasks USING btree (user_id, app_id, custom_id);


--
-- Name: taskp_tasks_updated; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX taskp_tasks_updated ON public.oc_taskprocessing_tasks USING btree (last_updated);


--
-- Name: textstep_session; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX textstep_session ON public.oc_text_steps USING btree (session_id);


--
-- Name: timestamp; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX "timestamp" ON public.oc_login_flow_v2 USING btree ("timestamp");


--
-- Name: timestamp_index; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX timestamp_index ON public.oc_files_trash USING btree ("timestamp");


--
-- Name: token_index; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX token_index ON public.oc_share USING btree (token);


--
-- Name: tp_tasks_status_type_nonunique; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX tp_tasks_status_type_nonunique ON public.oc_textprocessing_tasks USING btree (status, type);


--
-- Name: tp_tasks_uid_appid_ident; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX tp_tasks_uid_appid_ident ON public.oc_textprocessing_tasks USING btree (user_id, app_id, identifier);


--
-- Name: tp_tasks_updated; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX tp_tasks_updated ON public.oc_textprocessing_tasks USING btree (last_updated);


--
-- Name: ts_docid_lastcontact; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX ts_docid_lastcontact ON public.oc_text_sessions USING btree (document_id, last_contact);


--
-- Name: ts_lastcontact; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX ts_lastcontact ON public.oc_text_sessions USING btree (last_contact);


--
-- Name: twofactor_backupcodes_uid; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX twofactor_backupcodes_uid ON public.oc_twofactor_backupcodes USING btree (user_id);


--
-- Name: twofactor_providers_uid; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX twofactor_providers_uid ON public.oc_twofactor_providers USING btree (uid);


--
-- Name: type_index; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX type_index ON public.oc_vcategory USING btree (type);


--
-- Name: ui_script__idx; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE UNIQUE INDEX ui_script__idx ON public.oc_ex_ui_scripts USING btree (appid, type, name, path);


--
-- Name: ui_state__idx; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE UNIQUE INDEX ui_state__idx ON public.oc_ex_ui_states USING btree (appid, type, name, key);


--
-- Name: ui_style__idx; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE UNIQUE INDEX ui_style__idx ON public.oc_ex_ui_styles USING btree (appid, type, name, path);


--
-- Name: ui_top_menu__idx; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE UNIQUE INDEX ui_top_menu__idx ON public.oc_ex_ui_top_menu USING btree (appid, name);


--
-- Name: uid_index; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX uid_index ON public.oc_vcategory USING btree (uid);


--
-- Name: uniq_337f52f8126f525e70ee2ff6; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE UNIQUE INDEX uniq_337f52f8126f525e70ee2ff6 ON public.oc_circles_share_lock USING btree (item_id, circle_id);


--
-- Name: uniq_8195f548e3c68343; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE UNIQUE INDEX uniq_8195f548e3c68343 ON public.oc_circles_circle USING btree (unique_id);


--
-- Name: uniq_f94ef834230b1de; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE UNIQUE INDEX uniq_f94ef834230b1de ON public.oc_circles_remote USING btree (instance);


--
-- Name: unique_category_per_user; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE UNIQUE INDEX unique_category_per_user ON public.oc_vcategory USING btree (uid, type, category);


--
-- Name: url_hash; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE UNIQUE INDEX url_hash ON public.oc_trusted_servers USING btree (url_hash);


--
-- Name: user_index; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX user_index ON public.oc_files_trash USING btree ("user");


--
-- Name: user_status_clr_ix; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX user_status_clr_ix ON public.oc_user_status USING btree (clear_at);


--
-- Name: user_status_iud_ix; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX user_status_iud_ix ON public.oc_user_status USING btree (is_user_defined, status);


--
-- Name: user_status_mtstmp_ix; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX user_status_mtstmp_ix ON public.oc_user_status USING btree (status_message_timestamp);


--
-- Name: user_status_tstmp_ix; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX user_status_tstmp_ix ON public.oc_user_status USING btree (status_timestamp);


--
-- Name: user_status_uid_ix; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE UNIQUE INDEX user_status_uid_ix ON public.oc_user_status USING btree (user_id);


--
-- Name: user_uid_lower; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX user_uid_lower ON public.oc_users USING btree (uid_lower);


--
-- Name: vcategory_objectd_index; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX vcategory_objectd_index ON public.oc_vcategory_to_object USING btree (objid, type);


--
-- Name: version; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE UNIQUE INDEX version ON public.oc_whats_new USING btree (version);


--
-- Name: version_etag_idx; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX version_etag_idx ON public.oc_whats_new USING btree (version, etag);


--
-- Name: webauthn_publickeycredentialid; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX webauthn_publickeycredentialid ON public.oc_webauthn USING btree (public_key_credential_id);


--
-- Name: webauthn_uid; Type: INDEX; Schema: public; Owner: oc_admin
--

CREATE INDEX webauthn_uid ON public.oc_webauthn USING btree (uid);


--
-- Name: SCHEMA public; Type: ACL; Schema: -; Owner: pg_database_owner
--

REVOKE USAGE ON SCHEMA public FROM PUBLIC;
GRANT ALL ON SCHEMA public TO oc_admin;
GRANT ALL ON SCHEMA public TO PUBLIC;


--
--

\unrestrict a7tmqH0Y47vKkFmoDBik6JjSCMar3gJKmdRvqy3W6v6jaD0QbhGUTb3aG1tJUhb

--
-- Database "postgres" dump
--

\connect postgres

--
--

\restrict Xk9GUfGz77j8FQgsd9KfqVmzbeWwYtsyC4El94C3ORGXDjgvmr8Jo1VboRoeQTa


SELECT pg_catalog.set_config('search_path', '', false);

--
-- Name: cto; Type: SCHEMA; Schema: -; Owner: postgres
--

CREATE SCHEMA cto;


ALTER SCHEMA cto OWNER TO postgres;

--
-- Name: log; Type: SCHEMA; Schema: -; Owner: postgres
--

CREATE SCHEMA log;


ALTER SCHEMA log OWNER TO postgres;

--
-- Name: block_hash(text, character); Type: FUNCTION; Schema: cto; Owner: postgres
--

CREATE FUNCTION cto.block_hash(content text, thread_hash character DEFAULT NULL::bpchar) RETURNS character
    LANGUAGE plpgsql
    AS $$
BEGIN
    RETURN cto.sha256(COALESCE(thread_hash, '') || content || NOW()::TEXT);
END;
$$;


ALTER FUNCTION cto.block_hash(content text, thread_hash character) OWNER TO postgres;

--
-- Name: get_active_blocks(character varying, character varying, character varying); Type: FUNCTION; Schema: cto; Owner: postgres
--

CREATE FUNCTION cto.get_active_blocks(p_scope character varying DEFAULT 'global'::character varying, p_server_code character varying DEFAULT NULL::character varying, p_agent_code character varying DEFAULT NULL::character varying) RETURNS TABLE(code character varying, name character varying, content text, category character varying, priority integer, token_count integer)
    LANGUAGE plpgsql STABLE
    AS $$
BEGIN
    RETURN QUERY
    SELECT b.code, b.name, b.content, b.category, b.priority, b.token_count
    FROM cto.blocks b
    WHERE b.status = 'active' AND (b.scope = 'global' OR (b.scope = 'server' AND b.server_code = p_server_code) OR (b.scope = 'agent' AND b.agent_code = p_agent_code))
    ORDER BY b.priority DESC NULLS LAST, b.created_at ASC;
END;
$$;


ALTER FUNCTION cto.get_active_blocks(p_scope character varying, p_server_code character varying, p_agent_code character varying) OWNER TO postgres;

--
-- Name: get_active_context(character, integer); Type: FUNCTION; Schema: cto; Owner: postgres
--

CREATE FUNCTION cto.get_active_context(p_thread_hash character, p_max_tokens integer DEFAULT 100000) RETURNS TABLE(block_hash character, block_type text, block_content text, block_priority numeric, block_tokens integer)
    LANGUAGE plpgsql
    AS $$
DECLARE
    v_active_index_hash CHAR(64);
    v_includes JSONB;
BEGIN
    SELECT active_index_hash INTO v_active_index_hash
    FROM cto.ctx_threads WHERE hash = p_thread_hash;

    IF v_active_index_hash IS NULL THEN
        RETURN QUERY
        SELECT m.hash::CHAR(64), 'message'::TEXT, m.content::TEXT, 0.50::NUMERIC,
               COALESCE(length(m.content) / 4, 100)::INT
        FROM log.messages m
        WHERE m.session_hash = p_thread_hash
        ORDER BY m.created_at DESC LIMIT 50;
        RETURN;
    END IF;

    SELECT i.includes INTO v_includes FROM cto.ctx_indexes i WHERE i.hash = v_active_index_hash;

    RETURN QUERY
    SELECT m.hash::CHAR(64), 'message'::TEXT, m.content::TEXT,
           COALESCE((v_includes->>m.hash)::NUMERIC, 0.50), COALESCE(length(m.content) / 4, 100)::INT
    FROM log.messages m WHERE m.hash = ANY(ARRAY(SELECT jsonb_object_keys(v_includes)))
    UNION ALL
    SELECT s.hash::CHAR(64), 'synthetic'::TEXT, s.content::TEXT, s.priority,
           COALESCE(s.token_count, length(s.content) / 4)::INT
    FROM cto.ctx_synthetics s WHERE s.thread_hash = p_thread_hash
    UNION ALL
    SELECT r.orphan_hash::CHAR(64), 'resurrection'::TEXT, lm.content::TEXT, r.priority, 100::INT
    FROM cto.ctx_resurrections r LEFT JOIN log.messages lm ON lm.hash = r.orphan_hash
    WHERE r.thread_hash = p_thread_hash
    ORDER BY 4 DESC LIMIT p_max_tokens / 100;
END;
$$;


ALTER FUNCTION cto.get_active_context(p_thread_hash character, p_max_tokens integer) OWNER TO postgres;

--
-- Name: get_context_v3(character, integer); Type: FUNCTION; Schema: cto; Owner: postgres
--

CREATE FUNCTION cto.get_context_v3(p_thread_hash character, p_max_tokens integer DEFAULT 100000) RETURNS TABLE(block_hash character, block_type text, block_content text, block_priority numeric, block_tokens integer)
    LANGUAGE plpgsql
    AS $$
DECLARE
    v_active_index CHAR(64);
    v_includes JSONB;
BEGIN
    SELECT active_index INTO v_active_index
    FROM cto.threads_v3 WHERE hash = p_thread_hash;

    IF v_active_index IS NULL THEN
        RETURN QUERY
        SELECT m.hash, 'message'::TEXT, m.content,
               0.50::NUMERIC, (length(m.content) / 4)::INT
        FROM cto.messages_v3 m
        WHERE m.thread_hash = p_thread_hash
        ORDER BY m.created_at DESC LIMIT 50;
        RETURN;
    END IF;

    SELECT b.includes INTO v_includes
    FROM cto.blocks_v3 b
    WHERE b.hash = v_active_index AND b.block_type = 'index';

    RETURN QUERY
    SELECT m.hash, 'message'::TEXT, m.content,
           COALESCE((v_includes->>m.hash)::NUMERIC, 0.50),
           (length(m.content) / 4)::INT
    FROM cto.messages_v3 m
    WHERE m.hash = ANY(ARRAY(SELECT jsonb_object_keys(v_includes)))

    UNION ALL

    SELECT b.hash, 'synthetic'::TEXT, b.content, b.priority,
           COALESCE((b.metadata->>'token_count')::INT, length(b.content) / 4)
    FROM cto.blocks_v3 b
    WHERE b.thread_hash = p_thread_hash AND b.block_type = 'synthetic'

    UNION ALL

    SELECT b.target_hash, 'resurrection'::TEXT, m.content, b.priority,
           (length(m.content) / 4)::INT
    FROM cto.blocks_v3 b
    LEFT JOIN cto.messages_v3 m ON m.hash = b.target_hash
    WHERE b.thread_hash = p_thread_hash AND b.block_type = 'resurrection'

    ORDER BY 4 DESC
    LIMIT p_max_tokens / 100;
END;
$$;


ALTER FUNCTION cto.get_context_v3(p_thread_hash character, p_max_tokens integer) OWNER TO postgres;

--
-- Name: prevent_delete(); Type: FUNCTION; Schema: cto; Owner: postgres
--

CREATE FUNCTION cto.prevent_delete() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
    RAISE EXCEPTION 'DELETE no permitido en tabla inmutable %', TG_TABLE_NAME;
END;
$$;


ALTER FUNCTION cto.prevent_delete() OWNER TO postgres;

--
-- Name: prevent_modify_v3(); Type: FUNCTION; Schema: cto; Owner: postgres
--

CREATE FUNCTION cto.prevent_modify_v3() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
    RAISE EXCEPTION '% no permitido en tabla inmutable', TG_OP;
END;
$$;


ALTER FUNCTION cto.prevent_modify_v3() OWNER TO postgres;

--
-- Name: prevent_update(); Type: FUNCTION; Schema: cto; Owner: postgres
--

CREATE FUNCTION cto.prevent_update() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
    RAISE EXCEPTION 'UPDATE no permitido en tabla inmutable %', TG_TABLE_NAME;
END;
$$;


ALTER FUNCTION cto.prevent_update() OWNER TO postgres;

--
-- Name: sha256(text); Type: FUNCTION; Schema: cto; Owner: postgres
--

CREATE FUNCTION cto.sha256(data text) RETURNS character
    LANGUAGE plpgsql IMMUTABLE
    AS $$
BEGIN
    RETURN encode(digest(data, 'sha256'), 'hex');
END;
$$;


ALTER FUNCTION cto.sha256(data text) OWNER TO postgres;

--
-- Name: update_timestamp(); Type: FUNCTION; Schema: cto; Owner: postgres
--

CREATE FUNCTION cto.update_timestamp() RETURNS trigger
    LANGUAGE plpgsql
    AS $$ BEGIN NEW.updated_at = NOW(); RETURN NEW; END; $$;


ALTER FUNCTION cto.update_timestamp() OWNER TO postgres;

--
-- Name: prevent_modification(); Type: FUNCTION; Schema: log; Owner: postgres
--

CREATE FUNCTION log.prevent_modification() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
    RAISE EXCEPTION 'Log is immutable';
END;
$$;


ALTER FUNCTION log.prevent_modification() OWNER TO postgres;

--
-- Name: cleanup_expired_contexts(); Type: FUNCTION; Schema: public; Owner: postgres
--

CREATE FUNCTION public.cleanup_expired_contexts() RETURNS integer
    LANGUAGE plpgsql
    AS $$
DECLARE
    deleted_count INTEGER;
BEGIN
    DELETE FROM ai_context
    WHERE expires_at IS NOT NULL
    AND expires_at < CURRENT_TIMESTAMP;

    GET DIAGNOSTICS deleted_count = ROW_COUNT;
    RETURN deleted_count;
END;
$$;


ALTER FUNCTION public.cleanup_expired_contexts() OWNER TO postgres;

--
-- Name: update_updated_at_column(); Type: FUNCTION; Schema: public; Owner: postgres
--

CREATE FUNCTION public.update_updated_at_column() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
    NEW.updated_at = CURRENT_TIMESTAMP;
    RETURN NEW;
END;
$$;


ALTER FUNCTION public.update_updated_at_column() OWNER TO postgres;



--
-- Name: algorithms; Type: TABLE; Schema: cto; Owner: postgres
--

CREATE TABLE cto.algorithms (
    id integer NOT NULL,
    name text NOT NULL,
    version text DEFAULT '1.0'::text NOT NULL,
    description text,
    config jsonb DEFAULT '{}'::jsonb NOT NULL,
    enabled boolean DEFAULT true,
    created_at timestamp with time zone DEFAULT now(),
    updated_at timestamp with time zone DEFAULT now(),
    code character varying(50),
    status character varying(20) DEFAULT 'active'::character varying,
    parent_id integer,
    metrics jsonb DEFAULT '{}'::jsonb,
    activated_at timestamp with time zone,
    deprecated_at timestamp with time zone
);


ALTER TABLE cto.algorithms OWNER TO postgres;

--
-- Name: algorithms_id_seq; Type: SEQUENCE; Schema: cto; Owner: postgres
--

CREATE SEQUENCE cto.algorithms_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE cto.algorithms_id_seq OWNER TO postgres;

--
-- Name: algorithms_id_seq; Type: SEQUENCE OWNED BY; Schema: cto; Owner: postgres
--

ALTER SEQUENCE cto.algorithms_id_seq OWNED BY cto.algorithms.id;


--
-- Name: blocks_id_seq; Type: SEQUENCE; Schema: cto; Owner: postgres
--

CREATE SEQUENCE cto.blocks_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE cto.blocks_id_seq OWNER TO postgres;

--
-- Name: blocks_v3; Type: TABLE; Schema: cto; Owner: postgres
--

CREATE TABLE cto.blocks_v3 (
    hash character(64) NOT NULL,
    thread_hash character(64) NOT NULL,
    block_type character varying(20) NOT NULL,
    content text,
    includes jsonb,
    sources character(64)[],
    target_hash character(64),
    priority numeric(3,2) DEFAULT 0.50,
    metadata jsonb DEFAULT '{}'::jsonb,
    created_at timestamp with time zone DEFAULT now()
);


ALTER TABLE cto.blocks_v3 OWNER TO postgres;

--
-- Name: ctx_feedback; Type: TABLE; Schema: cto; Owner: postgres
--

CREATE TABLE cto.ctx_feedback (
    id bigint NOT NULL,
    hash character(64) NOT NULL,
    thread_hash character(64) NOT NULL,
    message_hash character(64) NOT NULL,
    model_id character varying(100),
    weights jsonb NOT NULL,
    created_at timestamp with time zone DEFAULT now()
);


ALTER TABLE cto.ctx_feedback OWNER TO postgres;

--
-- Name: ctx_feedback_id_seq; Type: SEQUENCE; Schema: cto; Owner: postgres
--

CREATE SEQUENCE cto.ctx_feedback_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE cto.ctx_feedback_id_seq OWNER TO postgres;

--
-- Name: ctx_feedback_id_seq; Type: SEQUENCE OWNED BY; Schema: cto; Owner: postgres
--

ALTER SEQUENCE cto.ctx_feedback_id_seq OWNED BY cto.ctx_feedback.id;


--
-- Name: ctx_indexes; Type: TABLE; Schema: cto; Owner: postgres
--

CREATE TABLE cto.ctx_indexes (
    id bigint NOT NULL,
    hash character(64) NOT NULL,
    thread_hash character(64) NOT NULL,
    inherits_from character(64),
    includes jsonb DEFAULT '{}'::jsonb NOT NULL,
    obsoletes character(64)[] DEFAULT '{}'::bpchar[],
    is_squash boolean DEFAULT false,
    created_at timestamp with time zone DEFAULT now()
);


ALTER TABLE cto.ctx_indexes OWNER TO postgres;

--
-- Name: ctx_indexes_id_seq; Type: SEQUENCE; Schema: cto; Owner: postgres
--

CREATE SEQUENCE cto.ctx_indexes_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE cto.ctx_indexes_id_seq OWNER TO postgres;

--
-- Name: ctx_indexes_id_seq; Type: SEQUENCE OWNED BY; Schema: cto; Owner: postgres
--

ALTER SEQUENCE cto.ctx_indexes_id_seq OWNED BY cto.ctx_indexes.id;


--
-- Name: ctx_resurrections; Type: TABLE; Schema: cto; Owner: postgres
--

CREATE TABLE cto.ctx_resurrections (
    id bigint NOT NULL,
    hash character(64) NOT NULL,
    thread_hash character(64) NOT NULL,
    orphan_hash character(64) NOT NULL,
    reason text,
    priority numeric(3,2) DEFAULT 0.50,
    created_at timestamp with time zone DEFAULT now()
);


ALTER TABLE cto.ctx_resurrections OWNER TO postgres;

--
-- Name: ctx_resurrections_id_seq; Type: SEQUENCE; Schema: cto; Owner: postgres
--

CREATE SEQUENCE cto.ctx_resurrections_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE cto.ctx_resurrections_id_seq OWNER TO postgres;

--
-- Name: ctx_resurrections_id_seq; Type: SEQUENCE OWNED BY; Schema: cto; Owner: postgres
--

ALTER SEQUENCE cto.ctx_resurrections_id_seq OWNED BY cto.ctx_resurrections.id;


--
-- Name: ctx_synthetics; Type: TABLE; Schema: cto; Owner: postgres
--

CREATE TABLE cto.ctx_synthetics (
    id bigint NOT NULL,
    hash character(64) NOT NULL,
    thread_hash character(64) NOT NULL,
    sources character(64)[] NOT NULL,
    content text NOT NULL,
    priority numeric(3,2) DEFAULT 0.80,
    absorbs character(64)[] DEFAULT '{}'::bpchar[],
    token_count integer,
    created_at timestamp with time zone DEFAULT now()
);


ALTER TABLE cto.ctx_synthetics OWNER TO postgres;

--
-- Name: ctx_synthetics_id_seq; Type: SEQUENCE; Schema: cto; Owner: postgres
--

CREATE SEQUENCE cto.ctx_synthetics_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE cto.ctx_synthetics_id_seq OWNER TO postgres;

--
-- Name: ctx_synthetics_id_seq; Type: SEQUENCE OWNED BY; Schema: cto; Owner: postgres
--

ALTER SEQUENCE cto.ctx_synthetics_id_seq OWNED BY cto.ctx_synthetics.id;


--
-- Name: ctx_threads; Type: TABLE; Schema: cto; Owner: postgres
--

CREATE TABLE cto.ctx_threads (
    id bigint NOT NULL,
    hash character(64) NOT NULL,
    owner_id character(64) NOT NULL,
    name character varying(255),
    hashtags character(64)[] DEFAULT '{}'::bpchar[],
    active_index_hash character(64),
    status character varying(20) DEFAULT 'active'::character varying,
    created_at timestamp with time zone DEFAULT now()
);


ALTER TABLE cto.ctx_threads OWNER TO postgres;

--
-- Name: ctx_threads_id_seq; Type: SEQUENCE; Schema: cto; Owner: postgres
--

CREATE SEQUENCE cto.ctx_threads_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE cto.ctx_threads_id_seq OWNER TO postgres;

--
-- Name: ctx_threads_id_seq; Type: SEQUENCE OWNED BY; Schema: cto; Owner: postgres
--

ALTER SEQUENCE cto.ctx_threads_id_seq OWNED BY cto.ctx_threads.id;


--
-- Name: flg; Type: TABLE; Schema: cto; Owner: postgres
--

CREATE TABLE cto.flg (
    id bigint NOT NULL,
    hash character(64) NOT NULL,
    name text,
    value jsonb DEFAULT '{}'::jsonb,
    created_at timestamp with time zone DEFAULT now()
);


ALTER TABLE cto.flg OWNER TO postgres;

--
-- Name: flg_id_seq; Type: SEQUENCE; Schema: cto; Owner: postgres
--

CREATE SEQUENCE cto.flg_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE cto.flg_id_seq OWNER TO postgres;

--
-- Name: flg_id_seq; Type: SEQUENCE OWNED BY; Schema: cto; Owner: postgres
--

ALTER SEQUENCE cto.flg_id_seq OWNED BY cto.flg.id;


--
-- Name: hst; Type: TABLE; Schema: cto; Owner: postgres
--

CREATE TABLE cto.hst (
    id bigint NOT NULL,
    hash character(64) NOT NULL,
    tag text,
    category text,
    created_at timestamp with time zone DEFAULT now()
);


ALTER TABLE cto.hst OWNER TO postgres;

--
-- Name: hst_id_seq; Type: SEQUENCE; Schema: cto; Owner: postgres
--

CREATE SEQUENCE cto.hst_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE cto.hst_id_seq OWNER TO postgres;

--
-- Name: hst_id_seq; Type: SEQUENCE OWNED BY; Schema: cto; Owner: postgres
--

ALTER SEQUENCE cto.hst_id_seq OWNED BY cto.hst.id;


--
-- Name: itm; Type: TABLE; Schema: cto; Owner: postgres
--

CREATE TABLE cto.itm (
    id bigint NOT NULL,
    hash character(64) NOT NULL,
    name text,
    item_type text,
    metadata jsonb DEFAULT '{}'::jsonb,
    created_at timestamp with time zone DEFAULT now()
);


ALTER TABLE cto.itm OWNER TO postgres;

--
-- Name: itm_id_seq; Type: SEQUENCE; Schema: cto; Owner: postgres
--

CREATE SEQUENCE cto.itm_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE cto.itm_id_seq OWNER TO postgres;

--
-- Name: itm_id_seq; Type: SEQUENCE OWNED BY; Schema: cto; Owner: postgres
--

ALTER SEQUENCE cto.itm_id_seq OWNED BY cto.itm.id;


--
-- Name: loc; Type: TABLE; Schema: cto; Owner: postgres
--

CREATE TABLE cto.loc (
    id bigint NOT NULL,
    hash character(64) NOT NULL,
    name text,
    coordinates jsonb DEFAULT '{}'::jsonb,
    metadata jsonb DEFAULT '{}'::jsonb,
    created_at timestamp with time zone DEFAULT now()
);


ALTER TABLE cto.loc OWNER TO postgres;

--
-- Name: loc_id_seq; Type: SEQUENCE; Schema: cto; Owner: postgres
--

CREATE SEQUENCE cto.loc_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE cto.loc_id_seq OWNER TO postgres;

--
-- Name: loc_id_seq; Type: SEQUENCE OWNED BY; Schema: cto; Owner: postgres
--

ALTER SEQUENCE cto.loc_id_seq OWNED BY cto.loc.id;


--
-- Name: memory_id_seq; Type: SEQUENCE; Schema: cto; Owner: postgres
--

CREATE SEQUENCE cto.memory_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE cto.memory_id_seq OWNER TO postgres;

--
-- Name: messages_v3; Type: TABLE; Schema: cto; Owner: postgres
--

CREATE TABLE cto.messages_v3 (
    hash character(64) NOT NULL,
    thread_hash character(64) NOT NULL,
    role character varying(20) NOT NULL,
    content text NOT NULL,
    prev_hash character(64),
    feedback jsonb,
    created_at timestamp with time zone DEFAULT now()
);


ALTER TABLE cto.messages_v3 OWNER TO postgres;

--
-- Name: ply; Type: TABLE; Schema: cto; Owner: postgres
--

CREATE TABLE cto.ply (
    id bigint NOT NULL,
    hash character(64) NOT NULL,
    name text,
    metadata jsonb DEFAULT '{}'::jsonb,
    created_at timestamp with time zone DEFAULT now()
);


ALTER TABLE cto.ply OWNER TO postgres;

--
-- Name: ply_id_seq; Type: SEQUENCE; Schema: cto; Owner: postgres
--

CREATE SEQUENCE cto.ply_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE cto.ply_id_seq OWNER TO postgres;

--
-- Name: ply_id_seq; Type: SEQUENCE OWNED BY; Schema: cto; Owner: postgres
--

ALTER SEQUENCE cto.ply_id_seq OWNED BY cto.ply.id;


--
-- Name: threads_v3; Type: TABLE; Schema: cto; Owner: postgres
--

CREATE TABLE cto.threads_v3 (
    hash character(64) NOT NULL,
    owner_id character(64) NOT NULL,
    name character varying(255),
    active_index character(64),
    created_at timestamp with time zone DEFAULT now()
);


ALTER TABLE cto.threads_v3 OWNER TO postgres;

--
-- Name: message_refs; Type: TABLE; Schema: log; Owner: postgres
--

CREATE TABLE log.message_refs (
    id bigint NOT NULL,
    message_hash character(64) NOT NULL,
    ref_hash character(64) NOT NULL,
    ref_type character varying(20) NOT NULL,
    "position" integer,
    thread_hash character(64)
);


ALTER TABLE log.message_refs OWNER TO postgres;

--
-- Name: message_refs_id_seq; Type: SEQUENCE; Schema: log; Owner: postgres
--

CREATE SEQUENCE log.message_refs_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE log.message_refs_id_seq OWNER TO postgres;

--
-- Name: message_refs_id_seq; Type: SEQUENCE OWNED BY; Schema: log; Owner: postgres
--

ALTER SEQUENCE log.message_refs_id_seq OWNED BY log.message_refs.id;


--
-- Name: messages; Type: TABLE; Schema: log; Owner: postgres
--

CREATE TABLE log.messages (
    id bigint NOT NULL,
    hash character(64) NOT NULL,
    session_hash character(64) NOT NULL,
    thread_hash character(64),
    owner_id character(64),
    players_id character(64)[],
    master_player character(64),
    role text NOT NULL,
    content text NOT NULL,
    attachments jsonb DEFAULT '{}'::jsonb,
    prev_hash character(64),
    hashtags character(64)[],
    flag_id character(64),
    master_item_id character(64),
    item_id character(64)[],
    loc_id character(64),
    ambient jsonb,
    created_at timestamp with time zone DEFAULT now()
);


ALTER TABLE log.messages OWNER TO postgres;

--
-- Name: messages_id_seq; Type: SEQUENCE; Schema: log; Owner: postgres
--

CREATE SEQUENCE log.messages_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE log.messages_id_seq OWNER TO postgres;

--
-- Name: messages_id_seq; Type: SEQUENCE OWNED BY; Schema: log; Owner: postgres
--

ALTER SEQUENCE log.messages_id_seq OWNED BY log.messages.id;


--
-- Name: ai_context; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.ai_context (
    id integer NOT NULL,
    context_type character varying(50) NOT NULL,
    context_key character varying(255) NOT NULL,
    context_value jsonb NOT NULL,
    agent_name character varying(100),
    priority integer DEFAULT 0,
    expires_at timestamp without time zone,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


ALTER TABLE public.ai_context OWNER TO postgres;

--
-- Name: TABLE ai_context; Type: COMMENT; Schema: public; Owner: postgres
--

COMMENT ON TABLE public.ai_context IS 'Contexto compartido entre agentes IA del sistema TZZR';


--
-- Name: ai_context_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE public.ai_context_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.ai_context_id_seq OWNER TO postgres;

--
-- Name: ai_context_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.ai_context_id_seq OWNED BY public.ai_context.id;


--
-- Name: ai_conversations; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.ai_conversations (
    id integer NOT NULL,
    conversation_id uuid DEFAULT gen_random_uuid() NOT NULL,
    agent_name character varying(100) NOT NULL,
    role character varying(20) NOT NULL,
    message text NOT NULL,
    metadata jsonb,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    CONSTRAINT ai_conversations_role_check CHECK (((role)::text = ANY (ARRAY[('user'::character varying)::text, ('assistant'::character varying)::text, ('system'::character varying)::text])))
);


ALTER TABLE public.ai_conversations OWNER TO postgres;

--
-- Name: TABLE ai_conversations; Type: COMMENT; Schema: public; Owner: postgres
--

COMMENT ON TABLE public.ai_conversations IS 'Historial de conversaciones de los agentes IA';


--
-- Name: ai_conversations_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE public.ai_conversations_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.ai_conversations_id_seq OWNER TO postgres;

--
-- Name: ai_conversations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.ai_conversations_id_seq OWNED BY public.ai_conversations.id;


--
-- Name: ai_learnings; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.ai_learnings (
    id integer NOT NULL,
    learning_type character varying(50) NOT NULL,
    title character varying(255) NOT NULL,
    description text,
    context jsonb NOT NULL,
    confidence numeric(3,2) DEFAULT 0.50,
    usage_count integer DEFAULT 0,
    success_rate numeric(3,2) DEFAULT 0.00,
    agent_name character varying(100),
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP,
    updated_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


ALTER TABLE public.ai_learnings OWNER TO postgres;

--
-- Name: TABLE ai_learnings; Type: COMMENT; Schema: public; Owner: postgres
--

COMMENT ON TABLE public.ai_learnings IS 'Patrones y aprendizajes del sistema IA';


--
-- Name: ai_learnings_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE public.ai_learnings_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.ai_learnings_id_seq OWNER TO postgres;

--
-- Name: ai_learnings_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.ai_learnings_id_seq OWNED BY public.ai_learnings.id;


--
-- Name: ai_tasks; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.ai_tasks (
    id integer NOT NULL,
    task_id uuid DEFAULT gen_random_uuid() NOT NULL,
    agent_name character varying(100) NOT NULL,
    task_type character varying(50) NOT NULL,
    task_status character varying(20) DEFAULT 'pending'::character varying NOT NULL,
    task_data jsonb NOT NULL,
    result jsonb,
    error_message text,
    started_at timestamp without time zone,
    completed_at timestamp without time zone,
    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


ALTER TABLE public.ai_tasks OWNER TO postgres;

--
-- Name: TABLE ai_tasks; Type: COMMENT; Schema: public; Owner: postgres
--

COMMENT ON TABLE public.ai_tasks IS 'Tareas ejecutadas por los agentes IA';


--
-- Name: ai_tasks_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE public.ai_tasks_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.ai_tasks_id_seq OWNER TO postgres;

--
-- Name: ai_tasks_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.ai_tasks_id_seq OWNED BY public.ai_tasks.id;


--
-- Name: algorithms id; Type: DEFAULT; Schema: cto; Owner: postgres
--

ALTER TABLE ONLY cto.algorithms ALTER COLUMN id SET DEFAULT nextval('cto.algorithms_id_seq'::regclass);


--
-- Name: ctx_feedback id; Type: DEFAULT; Schema: cto; Owner: postgres
--

ALTER TABLE ONLY cto.ctx_feedback ALTER COLUMN id SET DEFAULT nextval('cto.ctx_feedback_id_seq'::regclass);


--
-- Name: ctx_indexes id; Type: DEFAULT; Schema: cto; Owner: postgres
--

ALTER TABLE ONLY cto.ctx_indexes ALTER COLUMN id SET DEFAULT nextval('cto.ctx_indexes_id_seq'::regclass);


--
-- Name: ctx_resurrections id; Type: DEFAULT; Schema: cto; Owner: postgres
--

ALTER TABLE ONLY cto.ctx_resurrections ALTER COLUMN id SET DEFAULT nextval('cto.ctx_resurrections_id_seq'::regclass);


--
-- Name: ctx_synthetics id; Type: DEFAULT; Schema: cto; Owner: postgres
--

ALTER TABLE ONLY cto.ctx_synthetics ALTER COLUMN id SET DEFAULT nextval('cto.ctx_synthetics_id_seq'::regclass);


--
-- Name: ctx_threads id; Type: DEFAULT; Schema: cto; Owner: postgres
--

ALTER TABLE ONLY cto.ctx_threads ALTER COLUMN id SET DEFAULT nextval('cto.ctx_threads_id_seq'::regclass);


--
-- Name: flg id; Type: DEFAULT; Schema: cto; Owner: postgres
--

ALTER TABLE ONLY cto.flg ALTER COLUMN id SET DEFAULT nextval('cto.flg_id_seq'::regclass);


--
-- Name: hst id; Type: DEFAULT; Schema: cto; Owner: postgres
--

ALTER TABLE ONLY cto.hst ALTER COLUMN id SET DEFAULT nextval('cto.hst_id_seq'::regclass);


--
-- Name: itm id; Type: DEFAULT; Schema: cto; Owner: postgres
--

ALTER TABLE ONLY cto.itm ALTER COLUMN id SET DEFAULT nextval('cto.itm_id_seq'::regclass);


--
-- Name: loc id; Type: DEFAULT; Schema: cto; Owner: postgres
--

ALTER TABLE ONLY cto.loc ALTER COLUMN id SET DEFAULT nextval('cto.loc_id_seq'::regclass);


--
-- Name: ply id; Type: DEFAULT; Schema: cto; Owner: postgres
--

ALTER TABLE ONLY cto.ply ALTER COLUMN id SET DEFAULT nextval('cto.ply_id_seq'::regclass);


--
-- Name: message_refs id; Type: DEFAULT; Schema: log; Owner: postgres
--

ALTER TABLE ONLY log.message_refs ALTER COLUMN id SET DEFAULT nextval('log.message_refs_id_seq'::regclass);


--
-- Name: messages id; Type: DEFAULT; Schema: log; Owner: postgres
--

ALTER TABLE ONLY log.messages ALTER COLUMN id SET DEFAULT nextval('log.messages_id_seq'::regclass);


--
-- Name: ai_context id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.ai_context ALTER COLUMN id SET DEFAULT nextval('public.ai_context_id_seq'::regclass);


--
-- Name: ai_conversations id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.ai_conversations ALTER COLUMN id SET DEFAULT nextval('public.ai_conversations_id_seq'::regclass);


--
-- Name: ai_learnings id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.ai_learnings ALTER COLUMN id SET DEFAULT nextval('public.ai_learnings_id_seq'::regclass);


--
-- Name: ai_tasks id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.ai_tasks ALTER COLUMN id SET DEFAULT nextval('public.ai_tasks_id_seq'::regclass);


--
-- Data for Name: algorithms; Type: TABLE DATA; Schema: cto; Owner: postgres
--

COPY cto.algorithms (id, name, version, description, config, enabled, created_at, updated_at, code, status, parent_id, metrics, activated_at, deprecated_at) FROM stdin;
2	scorer	1.0	Calcula relevancia	{"weights": {"recency": 0.3, "frequency": 0.2, "importance": 0.3, "similarity": 0.2}, "decay_factor": 0.95}	t	2026-01-01 15:12:18.105+00	2026-01-01 15:55:33.279391+00	scorer	active	\N	{}	\N	\N
3	selector	1.0	Selecciona bloques	{"strategy": "greedy", "min_score": 0.1, "max_blocks": 50, "budget_tokens": 8000}	t	2026-01-01 15:12:18.105+00	2026-01-01 15:55:33.279391+00	selector	active	\N	{}	\N	\N
4	consolidator	1.0	Consolida bloques	{"merge_strategy": "newest", "compression_ratio": 0.7, "similarity_threshold": 0.85}	t	2026-01-01 15:12:18.105+00	2026-01-01 15:55:33.279391+00	consolidator	active	\N	{}	\N	\N
1	extractor	2.0.0	Extrae bloques	{"name": "TZZR Context Manager v2", "scoring": {"weights": {"recency": 0.20, "frequency": 0.10, "relevance": 0.30, "importance": 0.40}}, "version": "2.0.0", "embedding": {"model": "text-embedding-3-small", "provider": "openai", "dimension": 1536}, "selection": {"strategy": "priority", "token_budget": 8000}, "extraction": {"async": true, "enabled": true, "batch_size": 10}, "compression": {"strategy": "progressive", "keep_last": 10, "keep_first": 3}, "consolidation": {"strategy": "heuristic_first", "duplicate_threshold": 0.95}}	t	2026-01-01 15:12:18.105+00	2026-01-01 15:55:33.279391+00	extractor	active	\N	{}	2026-01-01 15:55:33.279391+00	\N
\.


--
-- Data for Name: blocks_v3; Type: TABLE DATA; Schema: cto; Owner: postgres
--

COPY cto.blocks_v3 (hash, thread_hash, block_type, content, includes, sources, target_hash, priority, metadata, created_at) FROM stdin;
\.


--
-- Data for Name: ctx_feedback; Type: TABLE DATA; Schema: cto; Owner: postgres
--

COPY cto.ctx_feedback (id, hash, thread_hash, message_hash, model_id, weights, created_at) FROM stdin;
\.


--
-- Data for Name: ctx_indexes; Type: TABLE DATA; Schema: cto; Owner: postgres
--

COPY cto.ctx_indexes (id, hash, thread_hash, inherits_from, includes, obsoletes, is_squash, created_at) FROM stdin;
\.


--
-- Data for Name: ctx_resurrections; Type: TABLE DATA; Schema: cto; Owner: postgres
--

COPY cto.ctx_resurrections (id, hash, thread_hash, orphan_hash, reason, priority, created_at) FROM stdin;
\.


--
-- Data for Name: ctx_synthetics; Type: TABLE DATA; Schema: cto; Owner: postgres
--

COPY cto.ctx_synthetics (id, hash, thread_hash, sources, content, priority, absorbs, token_count, created_at) FROM stdin;
1	84428f7f37d35cf85eca2df81d9dc4abd358ad7dede751f0bcb74da574a35360	fc439606418565f39a2f64d20f06adabf6449083c3ca5651c6a3142f3b15ee9d	{b7fa919f1b8b7827c07289be40d58878608b5736d4caa82d149c48f596c90acb,af225978569428af9fa69172d9d0e17497065f9293a0cd7d5ee9d8bda11238cb}	Resumen: Intercambio de saludos en prueba.	0.85	{}	10	2026-01-09 02:34:50.357902+00
2	b7bb3d1bc652a4e868c03d81b5ceadcdfe3df1fcd6da59e346955df62d9f7a4e	244310f8bd4a417a1dec7828d3d6bd599d06926757592b66e216c4cc26d134c5	{8d0e2987fd29a5edaa619b4cd30fe0ee9d2ea6fed80b6198c89a29ccf7d1c04b,70b30066cfb070757b05eb6f4499bf3a96ee9fbb1043d79c819a75c75c008274}	Resumen: Intercambio de saludos en prueba.	0.85	{}	10	2026-01-09 02:37:52.068345+00
3	c6b6cf75fa2808a55c38c8b3fbf25ca9d1410f7b68816b9b13b233653e030f27	3d77e9ce3d02a1ecc1f78908af4424f9a85d610ce9a6e7acdd3377a9bb17de5a	{446f82df108852b4bcf942b506df0ff483abe8e7a92c1894f8e735bd1f700597,c520052b9607efd847c0b5a906a392726b28aa77b342714ec7d24e0720374b1b}	Resumen: Intercambio de saludos en prueba.	0.85	{}	10	2026-01-09 09:35:32.967864+00
4	6db12ea9ed745e237fe3a4b4677e7a339442d683518971723bc95f0b3c8c7336	a3f93c1c4cd117333eca69b304ef508719e5127be1f816cf8c135ce426ecb061	{ec66f4e71b9a3b3c054ec6bd5df23a5b0223458e1fb43d17dbd9ced63abe5400,ed1b2464264a5a7edb2e94b8b354f34b76a41b46f3310d74b38685a2d59c8bdd}	Resumen: Prueba exitosa del context manager MCP	0.80	{}	11	2026-01-09 09:36:22.05878+00
5	3b1766fe0daf35aac9f94cd9b886f5cdb36264f44614b3fa5d794637c37e5a74	7f40cc77b412c2b3ddc6adf5e0f61b368dbe8f634dbd05c731659e9f00ad3a84	{08ec73e9f120e70e998cc2a8df86daf37c9e6f84d4b80b2e6f0d790477f336f5,b78cb0b2467f3fcb7c8a97cddc3888a4cdfa2fb245294aff85f20af65ab6de80}	Resumen de la conversación	0.80	{}	6	2026-01-09 09:36:35.036029+00
\.


--
-- Data for Name: ctx_threads; Type: TABLE DATA; Schema: cto; Owner: postgres
--

COPY cto.ctx_threads (id, hash, owner_id, name, hashtags, active_index_hash, status, created_at) FROM stdin;
1	7f3309468bdf935875d8e86e8e476f2a9d9455f9d44453944122e75497f1b1a4	1160130875fda0812c99c5e3f1a03516471a6370c4f97129b221938eb4763e63	Hilo de prueba	{}	\N	active	2026-01-09 02:34:12.03502+00
2	ada4c4fb5c27a4ecec4aa4fe2c569c509a9ebf2fb09c1c0a4a4e78e35f8786c3	1160130875fda0812c99c5e3f1a03516471a6370c4f97129b221938eb4763e63	Hilo de prueba	{}	\N	active	2026-01-09 02:34:32.51651+00
3	fc439606418565f39a2f64d20f06adabf6449083c3ca5651c6a3142f3b15ee9d	1160130875fda0812c99c5e3f1a03516471a6370c4f97129b221938eb4763e63	Hilo de prueba	{}	e79c2ec77c2fa2be07e95c7e762cfa2036742b24e2465c8aae50cf1b46a965d9	active	2026-01-09 02:34:50.329864+00
4	244310f8bd4a417a1dec7828d3d6bd599d06926757592b66e216c4cc26d134c5	1160130875fda0812c99c5e3f1a03516471a6370c4f97129b221938eb4763e63	Hilo de prueba	{}	cbe4bab5e9fdc92b53419049c7b848efbb4d30b90931d9438d32ef832de82d19	active	2026-01-09 02:37:52.036555+00
5	3d77e9ce3d02a1ecc1f78908af4424f9a85d610ce9a6e7acdd3377a9bb17de5a	1160130875fda0812c99c5e3f1a03516471a6370c4f97129b221938eb4763e63	Hilo de prueba	{}	121a3f9fafb80eaa9fe7a143760644164a388928a1cfbfee0ce2587f4b3651da	active	2026-01-09 09:35:32.826351+00
6	a3f93c1c4cd117333eca69b304ef508719e5127be1f816cf8c135ce426ecb061	claude_code_test                                                	Prueba MCP	{}	ea15624716d7f3b677e1c1a22c63b586493952e11d8a88d1dbf1ffbe4d71946c	active	2026-01-09 09:36:21.979577+00
7	7f40cc77b412c2b3ddc6adf5e0f61b368dbe8f634dbd05c731659e9f00ad3a84	claude_code_final                                               	Test Final MCP	{}	23d289ff842024a664ca3e18fbcb0e75023a08b4a3994c53860b880d31f300d4	active	2026-01-09 09:36:34.993126+00
\.


--
-- Data for Name: flg; Type: TABLE DATA; Schema: cto; Owner: postgres
--

COPY cto.flg (id, hash, name, value, created_at) FROM stdin;
\.


--
-- Data for Name: hst; Type: TABLE DATA; Schema: cto; Owner: postgres
--

COPY cto.hst (id, hash, tag, category, created_at) FROM stdin;
\.


--
-- Data for Name: itm; Type: TABLE DATA; Schema: cto; Owner: postgres
--

COPY cto.itm (id, hash, name, item_type, metadata, created_at) FROM stdin;
\.


--
-- Data for Name: loc; Type: TABLE DATA; Schema: cto; Owner: postgres
--

COPY cto.loc (id, hash, name, coordinates, metadata, created_at) FROM stdin;
\.


--
-- Data for Name: messages_v3; Type: TABLE DATA; Schema: cto; Owner: postgres
--

COPY cto.messages_v3 (hash, thread_hash, role, content, prev_hash, feedback, created_at) FROM stdin;
8ac7dd8d257f0e88c828525d1ac2b2cb0611da1ad043b245455d2879faba430f	585d602a71d3176eacd465e5be2b48e5f4d32fa6dbac2241503cd2260f9f6acc	user	Mensaje de prueba para el thread big fields of light	\N	\N	2026-01-09 18:46:12.35536+00
\.


--
-- Data for Name: ply; Type: TABLE DATA; Schema: cto; Owner: postgres
--

COPY cto.ply (id, hash, name, metadata, created_at) FROM stdin;
\.


--
-- Data for Name: threads_v3; Type: TABLE DATA; Schema: cto; Owner: postgres
--

COPY cto.threads_v3 (hash, owner_id, name, active_index, created_at) FROM stdin;
585d602a71d3176eacd465e5be2b48e5f4d32fa6dbac2241503cd2260f9f6acc	architect                                                       	big fields of light	2e94ef94ece065189ee1646583e4ec1395b71027d101903b178e1a55f4b2fa09	2026-01-09 18:30:24.288036+00
\.


--
-- Data for Name: message_refs; Type: TABLE DATA; Schema: log; Owner: postgres
--

COPY log.message_refs (id, message_hash, ref_hash, ref_type, "position", thread_hash) FROM stdin;
\.


--
-- Data for Name: messages; Type: TABLE DATA; Schema: log; Owner: postgres
--

COPY log.messages (id, hash, session_hash, thread_hash, owner_id, players_id, master_player, role, content, attachments, prev_hash, hashtags, flag_id, master_item_id, item_id, loc_id, ambient, created_at) FROM stdin;
1	792f5a6bbf79caa888de2bcf14615c6dc3689a1b5109a0ad329a24694191b466	ada4c4fb5c27a4ecec4aa4fe2c569c509a9ebf2fb09c1c0a4a4e78e35f8786c3	\N	1160130875fda0812c99c5e3f1a03516471a6370c4f97129b221938eb4763e63	\N	\N	user	Hola, este es un mensaje de prueba	{}	\N	\N	\N	\N	\N	\N	\N	2026-01-09 02:34:32.52049+00
2	80593ba0929138938edbad0eb4e4573bc6748c0746c37b9bc0d3871d7eaa462f	ada4c4fb5c27a4ecec4aa4fe2c569c509a9ebf2fb09c1c0a4a4e78e35f8786c3	\N	a39a7ffad4a3013f29da97b84f264337f234c1cf9b3c40c7c30c677a8a18609a	\N	\N	assistant	Hola! Recibí tu mensaje de prueba.	{}	792f5a6bbf79caa888de2bcf14615c6dc3689a1b5109a0ad329a24694191b466	\N	\N	\N	\N	\N	\N	2026-01-09 02:34:32.525077+00
3	b7fa919f1b8b7827c07289be40d58878608b5736d4caa82d149c48f596c90acb	fc439606418565f39a2f64d20f06adabf6449083c3ca5651c6a3142f3b15ee9d	\N	1160130875fda0812c99c5e3f1a03516471a6370c4f97129b221938eb4763e63	\N	\N	user	Hola, este es un mensaje de prueba	{}	\N	\N	\N	\N	\N	\N	\N	2026-01-09 02:34:50.33411+00
4	af225978569428af9fa69172d9d0e17497065f9293a0cd7d5ee9d8bda11238cb	fc439606418565f39a2f64d20f06adabf6449083c3ca5651c6a3142f3b15ee9d	\N	a39a7ffad4a3013f29da97b84f264337f234c1cf9b3c40c7c30c677a8a18609a	\N	\N	assistant	Hola! Recibí tu mensaje de prueba.	{}	b7fa919f1b8b7827c07289be40d58878608b5736d4caa82d149c48f596c90acb	\N	\N	\N	\N	\N	\N	2026-01-09 02:34:50.335645+00
5	8d0e2987fd29a5edaa619b4cd30fe0ee9d2ea6fed80b6198c89a29ccf7d1c04b	244310f8bd4a417a1dec7828d3d6bd599d06926757592b66e216c4cc26d134c5	\N	1160130875fda0812c99c5e3f1a03516471a6370c4f97129b221938eb4763e63	\N	\N	user	Hola, este es un mensaje de prueba	{}	\N	\N	\N	\N	\N	\N	\N	2026-01-09 02:37:52.041723+00
6	70b30066cfb070757b05eb6f4499bf3a96ee9fbb1043d79c819a75c75c008274	244310f8bd4a417a1dec7828d3d6bd599d06926757592b66e216c4cc26d134c5	\N	a39a7ffad4a3013f29da97b84f264337f234c1cf9b3c40c7c30c677a8a18609a	\N	\N	assistant	Hola! Recibí tu mensaje de prueba.	{}	8d0e2987fd29a5edaa619b4cd30fe0ee9d2ea6fed80b6198c89a29ccf7d1c04b	\N	\N	\N	\N	\N	\N	2026-01-09 02:37:52.044107+00
7	446f82df108852b4bcf942b506df0ff483abe8e7a92c1894f8e735bd1f700597	3d77e9ce3d02a1ecc1f78908af4424f9a85d610ce9a6e7acdd3377a9bb17de5a	\N	1160130875fda0812c99c5e3f1a03516471a6370c4f97129b221938eb4763e63	\N	\N	user	Hola, este es un mensaje de prueba	{}	\N	\N	\N	\N	\N	\N	\N	2026-01-09 09:35:32.875257+00
8	c520052b9607efd847c0b5a906a392726b28aa77b342714ec7d24e0720374b1b	3d77e9ce3d02a1ecc1f78908af4424f9a85d610ce9a6e7acdd3377a9bb17de5a	\N	a39a7ffad4a3013f29da97b84f264337f234c1cf9b3c40c7c30c677a8a18609a	\N	\N	assistant	Hola! Recibí tu mensaje de prueba.	{}	446f82df108852b4bcf942b506df0ff483abe8e7a92c1894f8e735bd1f700597	\N	\N	\N	\N	\N	\N	2026-01-09 09:35:32.884915+00
9	ec66f4e71b9a3b3c054ec6bd5df23a5b0223458e1fb43d17dbd9ced63abe5400	a3f93c1c4cd117333eca69b304ef508719e5127be1f816cf8c135ce426ecb061	\N	claude_code_test                                                	\N	\N	user	Hola, probando context manager desde Claude Code	{}	\N	\N	\N	\N	\N	\N	\N	2026-01-09 09:36:22.006304+00
10	ed1b2464264a5a7edb2e94b8b354f34b76a41b46f3310d74b38685a2d59c8bdd	a3f93c1c4cd117333eca69b304ef508719e5127be1f816cf8c135ce426ecb061	\N	claude_code_test                                                	\N	\N	assistant	Recibido! El context manager está funcionando.	{}	\N	\N	\N	\N	\N	\N	\N	2026-01-09 09:36:22.010245+00
11	08ec73e9f120e70e998cc2a8df86daf37c9e6f84d4b80b2e6f0d790477f336f5	7f40cc77b412c2b3ddc6adf5e0f61b368dbe8f634dbd05c731659e9f00ad3a84	\N	user1                                                           	\N	\N	user	Pregunta de prueba	{}	\N	\N	\N	\N	\N	\N	\N	2026-01-09 09:36:35.017082+00
12	b78cb0b2467f3fcb7c8a97cddc3888a4cdfa2fb245294aff85f20af65ab6de80	7f40cc77b412c2b3ddc6adf5e0f61b368dbe8f634dbd05c731659e9f00ad3a84	\N	user1                                                           	\N	\N	assistant	Respuesta de prueba	{}	\N	\N	\N	\N	\N	\N	\N	2026-01-09 09:36:35.018243+00
\.


--
-- Data for Name: ai_context; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.ai_context (id, context_type, context_key, context_value, agent_name, priority, expires_at, created_at, updated_at) FROM stdin;
1	system	architecture	{"servers": {"hst": "72.62.2.84", "corp": "92.112.181.188", "deck": "72.62.1.113", "architect": "69.62.126.110"}, "services": {"hst": ["postgresql:5432"], "corp": ["postgresql:5432"], "deck": ["clara:5000"], "architect": ["flask_api:5050", "gitea:3000", "postgresql:5432", "portainer:9443"]}}	architect	100	\N	2025-12-24 00:47:18.451933	2025-12-24 00:48:53.530338
2	system	agents	{"clara": {"role": "legal", "capabilities": ["contract_generation", "legal_analysis"]}, "mason": {"role": "reports", "capabilities": ["report_generation", "data_analysis"]}, "feldman": {"role": "analysis", "capabilities": ["code_analysis", "security_audit"]}, "architect": {"role": "coordinator", "capabilities": ["gitea_write", "infrastructure", "coordination"]}}	architect	100	\N	2025-12-24 00:47:18.451933	2025-12-24 00:48:53.530338
3	system	gitea	{"org": "tzzr", "url": "https://git.tzzr.me", "repos": ["system", "contratos-comunes", "clara", "mason", "feldman", "credentials"]}	architect	100	\N	2025-12-24 00:47:18.451933	2025-12-24 00:48:53.530338
\.


--
-- Data for Name: ai_conversations; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.ai_conversations (id, conversation_id, agent_name, role, message, metadata, created_at) FROM stdin;
\.


--
-- Data for Name: ai_learnings; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.ai_learnings (id, learning_type, title, description, context, confidence, usage_count, success_rate, agent_name, created_at, updated_at) FROM stdin;
\.


--
-- Data for Name: ai_tasks; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.ai_tasks (id, task_id, agent_name, task_type, task_status, task_data, result, error_message, started_at, completed_at, created_at) FROM stdin;
\.


--
-- Name: algorithms_id_seq; Type: SEQUENCE SET; Schema: cto; Owner: postgres
--

SELECT pg_catalog.setval('cto.algorithms_id_seq', 4, true);


--
-- Name: blocks_id_seq; Type: SEQUENCE SET; Schema: cto; Owner: postgres
--

SELECT pg_catalog.setval('cto.blocks_id_seq', 6, true);


--
-- Name: ctx_feedback_id_seq; Type: SEQUENCE SET; Schema: cto; Owner: postgres
--

SELECT pg_catalog.setval('cto.ctx_feedback_id_seq', 4, true);


--
-- Name: ctx_indexes_id_seq; Type: SEQUENCE SET; Schema: cto; Owner: postgres
--

SELECT pg_catalog.setval('cto.ctx_indexes_id_seq', 6, true);


--
-- Name: ctx_resurrections_id_seq; Type: SEQUENCE SET; Schema: cto; Owner: postgres
--

SELECT pg_catalog.setval('cto.ctx_resurrections_id_seq', 1, false);


--
-- Name: ctx_synthetics_id_seq; Type: SEQUENCE SET; Schema: cto; Owner: postgres
--

SELECT pg_catalog.setval('cto.ctx_synthetics_id_seq', 5, true);


--
-- Name: ctx_threads_id_seq; Type: SEQUENCE SET; Schema: cto; Owner: postgres
--

SELECT pg_catalog.setval('cto.ctx_threads_id_seq', 7, true);


--
-- Name: flg_id_seq; Type: SEQUENCE SET; Schema: cto; Owner: postgres
--

SELECT pg_catalog.setval('cto.flg_id_seq', 1, false);


--
-- Name: hst_id_seq; Type: SEQUENCE SET; Schema: cto; Owner: postgres
--

SELECT pg_catalog.setval('cto.hst_id_seq', 1, false);


--
-- Name: itm_id_seq; Type: SEQUENCE SET; Schema: cto; Owner: postgres
--

SELECT pg_catalog.setval('cto.itm_id_seq', 1, false);


--
-- Name: loc_id_seq; Type: SEQUENCE SET; Schema: cto; Owner: postgres
--

SELECT pg_catalog.setval('cto.loc_id_seq', 1, false);


--
-- Name: memory_id_seq; Type: SEQUENCE SET; Schema: cto; Owner: postgres
--

SELECT pg_catalog.setval('cto.memory_id_seq', 1, false);


--
-- Name: ply_id_seq; Type: SEQUENCE SET; Schema: cto; Owner: postgres
--

SELECT pg_catalog.setval('cto.ply_id_seq', 1, false);


--
-- Name: message_refs_id_seq; Type: SEQUENCE SET; Schema: log; Owner: postgres
--

SELECT pg_catalog.setval('log.message_refs_id_seq', 1, false);


--
-- Name: messages_id_seq; Type: SEQUENCE SET; Schema: log; Owner: postgres
--

SELECT pg_catalog.setval('log.messages_id_seq', 12, true);


--
-- Name: ai_context_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('public.ai_context_id_seq', 9, true);


--
-- Name: ai_conversations_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('public.ai_conversations_id_seq', 1, false);


--
-- Name: ai_learnings_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('public.ai_learnings_id_seq', 1, false);


--
-- Name: ai_tasks_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('public.ai_tasks_id_seq', 1, false);


--
-- Name: algorithms algorithms_code_key; Type: CONSTRAINT; Schema: cto; Owner: postgres
--

ALTER TABLE ONLY cto.algorithms
    ADD CONSTRAINT algorithms_code_key UNIQUE (code);


--
-- Name: algorithms algorithms_name_key; Type: CONSTRAINT; Schema: cto; Owner: postgres
--

ALTER TABLE ONLY cto.algorithms
    ADD CONSTRAINT algorithms_name_key UNIQUE (name);


--
-- Name: algorithms algorithms_pkey; Type: CONSTRAINT; Schema: cto; Owner: postgres
--

ALTER TABLE ONLY cto.algorithms
    ADD CONSTRAINT algorithms_pkey PRIMARY KEY (id);


--
-- Name: blocks_v3 blocks_v3_pkey; Type: CONSTRAINT; Schema: cto; Owner: postgres
--

ALTER TABLE ONLY cto.blocks_v3
    ADD CONSTRAINT blocks_v3_pkey PRIMARY KEY (hash);


--
-- Name: ctx_feedback ctx_feedback_hash_key; Type: CONSTRAINT; Schema: cto; Owner: postgres
--

ALTER TABLE ONLY cto.ctx_feedback
    ADD CONSTRAINT ctx_feedback_hash_key UNIQUE (hash);


--
-- Name: ctx_feedback ctx_feedback_pkey; Type: CONSTRAINT; Schema: cto; Owner: postgres
--

ALTER TABLE ONLY cto.ctx_feedback
    ADD CONSTRAINT ctx_feedback_pkey PRIMARY KEY (id);


--
-- Name: ctx_indexes ctx_indexes_hash_key; Type: CONSTRAINT; Schema: cto; Owner: postgres
--

ALTER TABLE ONLY cto.ctx_indexes
    ADD CONSTRAINT ctx_indexes_hash_key UNIQUE (hash);


--
-- Name: ctx_indexes ctx_indexes_pkey; Type: CONSTRAINT; Schema: cto; Owner: postgres
--

ALTER TABLE ONLY cto.ctx_indexes
    ADD CONSTRAINT ctx_indexes_pkey PRIMARY KEY (id);


--
-- Name: ctx_resurrections ctx_resurrections_hash_key; Type: CONSTRAINT; Schema: cto; Owner: postgres
--

ALTER TABLE ONLY cto.ctx_resurrections
    ADD CONSTRAINT ctx_resurrections_hash_key UNIQUE (hash);


--
-- Name: ctx_resurrections ctx_resurrections_pkey; Type: CONSTRAINT; Schema: cto; Owner: postgres
--

ALTER TABLE ONLY cto.ctx_resurrections
    ADD CONSTRAINT ctx_resurrections_pkey PRIMARY KEY (id);


--
-- Name: ctx_synthetics ctx_synthetics_hash_key; Type: CONSTRAINT; Schema: cto; Owner: postgres
--

ALTER TABLE ONLY cto.ctx_synthetics
    ADD CONSTRAINT ctx_synthetics_hash_key UNIQUE (hash);


--
-- Name: ctx_synthetics ctx_synthetics_pkey; Type: CONSTRAINT; Schema: cto; Owner: postgres
--

ALTER TABLE ONLY cto.ctx_synthetics
    ADD CONSTRAINT ctx_synthetics_pkey PRIMARY KEY (id);


--
-- Name: ctx_threads ctx_threads_hash_key; Type: CONSTRAINT; Schema: cto; Owner: postgres
--

ALTER TABLE ONLY cto.ctx_threads
    ADD CONSTRAINT ctx_threads_hash_key UNIQUE (hash);


--
-- Name: ctx_threads ctx_threads_pkey; Type: CONSTRAINT; Schema: cto; Owner: postgres
--

ALTER TABLE ONLY cto.ctx_threads
    ADD CONSTRAINT ctx_threads_pkey PRIMARY KEY (id);


--
-- Name: flg flg_hash_key; Type: CONSTRAINT; Schema: cto; Owner: postgres
--

ALTER TABLE ONLY cto.flg
    ADD CONSTRAINT flg_hash_key UNIQUE (hash);


--
-- Name: flg flg_pkey; Type: CONSTRAINT; Schema: cto; Owner: postgres
--

ALTER TABLE ONLY cto.flg
    ADD CONSTRAINT flg_pkey PRIMARY KEY (id);


--
-- Name: hst hst_hash_key; Type: CONSTRAINT; Schema: cto; Owner: postgres
--

ALTER TABLE ONLY cto.hst
    ADD CONSTRAINT hst_hash_key UNIQUE (hash);


--
-- Name: hst hst_pkey; Type: CONSTRAINT; Schema: cto; Owner: postgres
--

ALTER TABLE ONLY cto.hst
    ADD CONSTRAINT hst_pkey PRIMARY KEY (id);


--
-- Name: hst hst_tag_key; Type: CONSTRAINT; Schema: cto; Owner: postgres
--

ALTER TABLE ONLY cto.hst
    ADD CONSTRAINT hst_tag_key UNIQUE (tag);


--
-- Name: itm itm_hash_key; Type: CONSTRAINT; Schema: cto; Owner: postgres
--

ALTER TABLE ONLY cto.itm
    ADD CONSTRAINT itm_hash_key UNIQUE (hash);


--
-- Name: itm itm_pkey; Type: CONSTRAINT; Schema: cto; Owner: postgres
--

ALTER TABLE ONLY cto.itm
    ADD CONSTRAINT itm_pkey PRIMARY KEY (id);


--
-- Name: loc loc_hash_key; Type: CONSTRAINT; Schema: cto; Owner: postgres
--

ALTER TABLE ONLY cto.loc
    ADD CONSTRAINT loc_hash_key UNIQUE (hash);


--
-- Name: loc loc_pkey; Type: CONSTRAINT; Schema: cto; Owner: postgres
--

ALTER TABLE ONLY cto.loc
    ADD CONSTRAINT loc_pkey PRIMARY KEY (id);


--
-- Name: messages_v3 messages_v3_pkey; Type: CONSTRAINT; Schema: cto; Owner: postgres
--

ALTER TABLE ONLY cto.messages_v3
    ADD CONSTRAINT messages_v3_pkey PRIMARY KEY (hash);


--
-- Name: ply ply_hash_key; Type: CONSTRAINT; Schema: cto; Owner: postgres
--

ALTER TABLE ONLY cto.ply
    ADD CONSTRAINT ply_hash_key UNIQUE (hash);


--
-- Name: ply ply_pkey; Type: CONSTRAINT; Schema: cto; Owner: postgres
--

ALTER TABLE ONLY cto.ply
    ADD CONSTRAINT ply_pkey PRIMARY KEY (id);


--
-- Name: threads_v3 threads_v3_pkey; Type: CONSTRAINT; Schema: cto; Owner: postgres
--

ALTER TABLE ONLY cto.threads_v3
    ADD CONSTRAINT threads_v3_pkey PRIMARY KEY (hash);


--
-- Name: message_refs message_refs_pkey; Type: CONSTRAINT; Schema: log; Owner: postgres
--

ALTER TABLE ONLY log.message_refs
    ADD CONSTRAINT message_refs_pkey PRIMARY KEY (id);


--
-- Name: messages messages_hash_key; Type: CONSTRAINT; Schema: log; Owner: postgres
--

ALTER TABLE ONLY log.messages
    ADD CONSTRAINT messages_hash_key UNIQUE (hash);


--
-- Name: messages messages_pkey; Type: CONSTRAINT; Schema: log; Owner: postgres
--

ALTER TABLE ONLY log.messages
    ADD CONSTRAINT messages_pkey PRIMARY KEY (id);


--
-- Name: ai_context ai_context_context_type_context_key_key; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.ai_context
    ADD CONSTRAINT ai_context_context_type_context_key_key UNIQUE (context_type, context_key);


--
-- Name: ai_context ai_context_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.ai_context
    ADD CONSTRAINT ai_context_pkey PRIMARY KEY (id);


--
-- Name: ai_conversations ai_conversations_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.ai_conversations
    ADD CONSTRAINT ai_conversations_pkey PRIMARY KEY (id);


--
-- Name: ai_learnings ai_learnings_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.ai_learnings
    ADD CONSTRAINT ai_learnings_pkey PRIMARY KEY (id);


--
-- Name: ai_tasks ai_tasks_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.ai_tasks
    ADD CONSTRAINT ai_tasks_pkey PRIMARY KEY (id);


--
-- Name: idx_algorithms_code; Type: INDEX; Schema: cto; Owner: postgres
--

CREATE INDEX idx_algorithms_code ON cto.algorithms USING btree (code);


--
-- Name: idx_algorithms_parent; Type: INDEX; Schema: cto; Owner: postgres
--

CREATE INDEX idx_algorithms_parent ON cto.algorithms USING btree (parent_id) WHERE (parent_id IS NOT NULL);


--
-- Name: idx_algorithms_status; Type: INDEX; Schema: cto; Owner: postgres
--

CREATE INDEX idx_algorithms_status ON cto.algorithms USING btree (status);


--
-- Name: idx_blocks_v3_created; Type: INDEX; Schema: cto; Owner: postgres
--

CREATE INDEX idx_blocks_v3_created ON cto.blocks_v3 USING btree (created_at DESC);


--
-- Name: idx_blocks_v3_thread; Type: INDEX; Schema: cto; Owner: postgres
--

CREATE INDEX idx_blocks_v3_thread ON cto.blocks_v3 USING btree (thread_hash);


--
-- Name: idx_blocks_v3_type; Type: INDEX; Schema: cto; Owner: postgres
--

CREATE INDEX idx_blocks_v3_type ON cto.blocks_v3 USING btree (block_type);


--
-- Name: idx_ctx_feedback_created; Type: INDEX; Schema: cto; Owner: postgres
--

CREATE INDEX idx_ctx_feedback_created ON cto.ctx_feedback USING btree (created_at DESC);


--
-- Name: idx_ctx_feedback_thread; Type: INDEX; Schema: cto; Owner: postgres
--

CREATE INDEX idx_ctx_feedback_thread ON cto.ctx_feedback USING btree (thread_hash);


--
-- Name: idx_ctx_indexes_created; Type: INDEX; Schema: cto; Owner: postgres
--

CREATE INDEX idx_ctx_indexes_created ON cto.ctx_indexes USING btree (created_at DESC);


--
-- Name: idx_ctx_indexes_thread; Type: INDEX; Schema: cto; Owner: postgres
--

CREATE INDEX idx_ctx_indexes_thread ON cto.ctx_indexes USING btree (thread_hash);


--
-- Name: idx_ctx_resurrections_thread; Type: INDEX; Schema: cto; Owner: postgres
--

CREATE INDEX idx_ctx_resurrections_thread ON cto.ctx_resurrections USING btree (thread_hash);


--
-- Name: idx_ctx_synthetics_thread; Type: INDEX; Schema: cto; Owner: postgres
--

CREATE INDEX idx_ctx_synthetics_thread ON cto.ctx_synthetics USING btree (thread_hash);


--
-- Name: idx_ctx_threads_owner; Type: INDEX; Schema: cto; Owner: postgres
--

CREATE INDEX idx_ctx_threads_owner ON cto.ctx_threads USING btree (owner_id);


--
-- Name: idx_ctx_threads_status; Type: INDEX; Schema: cto; Owner: postgres
--

CREATE INDEX idx_ctx_threads_status ON cto.ctx_threads USING btree (status);


--
-- Name: idx_flg_name; Type: INDEX; Schema: cto; Owner: postgres
--

CREATE INDEX idx_flg_name ON cto.flg USING btree (name);


--
-- Name: idx_hst_category; Type: INDEX; Schema: cto; Owner: postgres
--

CREATE INDEX idx_hst_category ON cto.hst USING btree (category);


--
-- Name: idx_hst_tag; Type: INDEX; Schema: cto; Owner: postgres
--

CREATE INDEX idx_hst_tag ON cto.hst USING btree (tag);


--
-- Name: idx_itm_name; Type: INDEX; Schema: cto; Owner: postgres
--

CREATE INDEX idx_itm_name ON cto.itm USING btree (name);


--
-- Name: idx_itm_type; Type: INDEX; Schema: cto; Owner: postgres
--

CREATE INDEX idx_itm_type ON cto.itm USING btree (item_type);


--
-- Name: idx_loc_name; Type: INDEX; Schema: cto; Owner: postgres
--

CREATE INDEX idx_loc_name ON cto.loc USING btree (name);


--
-- Name: idx_messages_v3_created; Type: INDEX; Schema: cto; Owner: postgres
--

CREATE INDEX idx_messages_v3_created ON cto.messages_v3 USING btree (created_at DESC);


--
-- Name: idx_messages_v3_thread; Type: INDEX; Schema: cto; Owner: postgres
--

CREATE INDEX idx_messages_v3_thread ON cto.messages_v3 USING btree (thread_hash);


--
-- Name: idx_ply_name; Type: INDEX; Schema: cto; Owner: postgres
--

CREATE INDEX idx_ply_name ON cto.ply USING btree (name);


--
-- Name: idx_threads_v3_owner; Type: INDEX; Schema: cto; Owner: postgres
--

CREATE INDEX idx_threads_v3_owner ON cto.threads_v3 USING btree (owner_id);


--
-- Name: idx_log_created; Type: INDEX; Schema: log; Owner: postgres
--

CREATE INDEX idx_log_created ON log.messages USING btree (created_at);


--
-- Name: idx_log_owner; Type: INDEX; Schema: log; Owner: postgres
--

CREATE INDEX idx_log_owner ON log.messages USING btree (owner_id);


--
-- Name: idx_log_prev; Type: INDEX; Schema: log; Owner: postgres
--

CREATE INDEX idx_log_prev ON log.messages USING btree (prev_hash);


--
-- Name: idx_log_session; Type: INDEX; Schema: log; Owner: postgres
--

CREATE INDEX idx_log_session ON log.messages USING btree (session_hash);


--
-- Name: idx_log_thread; Type: INDEX; Schema: log; Owner: postgres
--

CREATE INDEX idx_log_thread ON log.messages USING btree (thread_hash);


--
-- Name: idx_refs_message; Type: INDEX; Schema: log; Owner: postgres
--

CREATE INDEX idx_refs_message ON log.message_refs USING btree (message_hash);


--
-- Name: idx_refs_ref; Type: INDEX; Schema: log; Owner: postgres
--

CREATE INDEX idx_refs_ref ON log.message_refs USING btree (ref_hash);


--
-- Name: idx_ai_context_agent; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_ai_context_agent ON public.ai_context USING btree (agent_name);


--
-- Name: idx_ai_context_expires; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_ai_context_expires ON public.ai_context USING btree (expires_at) WHERE (expires_at IS NOT NULL);


--
-- Name: idx_ai_context_key; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_ai_context_key ON public.ai_context USING btree (context_key);


--
-- Name: idx_ai_context_priority; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_ai_context_priority ON public.ai_context USING btree (priority DESC);


--
-- Name: idx_ai_context_type; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_ai_context_type ON public.ai_context USING btree (context_type);


--
-- Name: idx_ai_conv_agent; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_ai_conv_agent ON public.ai_conversations USING btree (agent_name);


--
-- Name: idx_ai_conv_created; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_ai_conv_created ON public.ai_conversations USING btree (created_at DESC);


--
-- Name: idx_ai_conv_id; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_ai_conv_id ON public.ai_conversations USING btree (conversation_id);


--
-- Name: idx_ai_learning_agent; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_ai_learning_agent ON public.ai_learnings USING btree (agent_name);


--
-- Name: idx_ai_learning_confidence; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_ai_learning_confidence ON public.ai_learnings USING btree (confidence DESC);


--
-- Name: idx_ai_learning_type; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_ai_learning_type ON public.ai_learnings USING btree (learning_type);


--
-- Name: idx_ai_task_agent; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_ai_task_agent ON public.ai_tasks USING btree (agent_name);


--
-- Name: idx_ai_task_id; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_ai_task_id ON public.ai_tasks USING btree (task_id);


--
-- Name: idx_ai_task_status; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_ai_task_status ON public.ai_tasks USING btree (task_status);


--
-- Name: idx_ai_task_type; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_ai_task_type ON public.ai_tasks USING btree (task_type);


--
-- Name: algorithms algorithms_updated; Type: TRIGGER; Schema: cto; Owner: postgres
--

CREATE TRIGGER algorithms_updated BEFORE UPDATE ON cto.algorithms FOR EACH ROW EXECUTE FUNCTION cto.update_timestamp();


--
-- Name: blocks_v3 protect_blocks_v3_delete; Type: TRIGGER; Schema: cto; Owner: postgres
--

CREATE TRIGGER protect_blocks_v3_delete BEFORE DELETE ON cto.blocks_v3 FOR EACH ROW EXECUTE FUNCTION cto.prevent_modify_v3();


--
-- Name: blocks_v3 protect_blocks_v3_update; Type: TRIGGER; Schema: cto; Owner: postgres
--

CREATE TRIGGER protect_blocks_v3_update BEFORE UPDATE ON cto.blocks_v3 FOR EACH ROW EXECUTE FUNCTION cto.prevent_modify_v3();


--
-- Name: ctx_feedback protect_ctx_feedback_delete; Type: TRIGGER; Schema: cto; Owner: postgres
--

CREATE TRIGGER protect_ctx_feedback_delete BEFORE DELETE ON cto.ctx_feedback FOR EACH ROW EXECUTE FUNCTION cto.prevent_delete();


--
-- Name: ctx_feedback protect_ctx_feedback_update; Type: TRIGGER; Schema: cto; Owner: postgres
--

CREATE TRIGGER protect_ctx_feedback_update BEFORE UPDATE ON cto.ctx_feedback FOR EACH ROW EXECUTE FUNCTION cto.prevent_update();


--
-- Name: ctx_indexes protect_ctx_indexes_delete; Type: TRIGGER; Schema: cto; Owner: postgres
--

CREATE TRIGGER protect_ctx_indexes_delete BEFORE DELETE ON cto.ctx_indexes FOR EACH ROW EXECUTE FUNCTION cto.prevent_delete();


--
-- Name: ctx_indexes protect_ctx_indexes_update; Type: TRIGGER; Schema: cto; Owner: postgres
--

CREATE TRIGGER protect_ctx_indexes_update BEFORE UPDATE ON cto.ctx_indexes FOR EACH ROW EXECUTE FUNCTION cto.prevent_update();


--
-- Name: ctx_resurrections protect_ctx_resurrections_delete; Type: TRIGGER; Schema: cto; Owner: postgres
--

CREATE TRIGGER protect_ctx_resurrections_delete BEFORE DELETE ON cto.ctx_resurrections FOR EACH ROW EXECUTE FUNCTION cto.prevent_delete();


--
-- Name: ctx_resurrections protect_ctx_resurrections_update; Type: TRIGGER; Schema: cto; Owner: postgres
--

CREATE TRIGGER protect_ctx_resurrections_update BEFORE UPDATE ON cto.ctx_resurrections FOR EACH ROW EXECUTE FUNCTION cto.prevent_update();


--
-- Name: ctx_synthetics protect_ctx_synthetics_delete; Type: TRIGGER; Schema: cto; Owner: postgres
--

CREATE TRIGGER protect_ctx_synthetics_delete BEFORE DELETE ON cto.ctx_synthetics FOR EACH ROW EXECUTE FUNCTION cto.prevent_delete();


--
-- Name: ctx_synthetics protect_ctx_synthetics_update; Type: TRIGGER; Schema: cto; Owner: postgres
--

CREATE TRIGGER protect_ctx_synthetics_update BEFORE UPDATE ON cto.ctx_synthetics FOR EACH ROW EXECUTE FUNCTION cto.prevent_update();


--
-- Name: messages_v3 protect_messages_v3_delete; Type: TRIGGER; Schema: cto; Owner: postgres
--

CREATE TRIGGER protect_messages_v3_delete BEFORE DELETE ON cto.messages_v3 FOR EACH ROW EXECUTE FUNCTION cto.prevent_modify_v3();


--
-- Name: messages_v3 protect_messages_v3_update; Type: TRIGGER; Schema: cto; Owner: postgres
--

CREATE TRIGGER protect_messages_v3_update BEFORE UPDATE ON cto.messages_v3 FOR EACH ROW WHEN ((NOT (new.feedback IS DISTINCT FROM old.feedback))) EXECUTE FUNCTION cto.prevent_modify_v3();


--
-- Name: messages no_delete_messages; Type: TRIGGER; Schema: log; Owner: postgres
--

CREATE TRIGGER no_delete_messages BEFORE DELETE ON log.messages FOR EACH ROW EXECUTE FUNCTION log.prevent_modification();


--
-- Name: message_refs no_delete_refs; Type: TRIGGER; Schema: log; Owner: postgres
--

CREATE TRIGGER no_delete_refs BEFORE DELETE ON log.message_refs FOR EACH ROW EXECUTE FUNCTION log.prevent_modification();


--
-- Name: messages no_update_messages; Type: TRIGGER; Schema: log; Owner: postgres
--

CREATE TRIGGER no_update_messages BEFORE UPDATE ON log.messages FOR EACH ROW EXECUTE FUNCTION log.prevent_modification();


--
-- Name: message_refs no_update_refs; Type: TRIGGER; Schema: log; Owner: postgres
--

CREATE TRIGGER no_update_refs BEFORE UPDATE ON log.message_refs FOR EACH ROW EXECUTE FUNCTION log.prevent_modification();


--
-- Name: ai_context update_ai_context_updated_at; Type: TRIGGER; Schema: public; Owner: postgres
--

CREATE TRIGGER update_ai_context_updated_at BEFORE UPDATE ON public.ai_context FOR EACH ROW EXECUTE FUNCTION public.update_updated_at_column();


--
-- Name: ai_learnings update_ai_learnings_updated_at; Type: TRIGGER; Schema: public; Owner: postgres
--

CREATE TRIGGER update_ai_learnings_updated_at BEFORE UPDATE ON public.ai_learnings FOR EACH ROW EXECUTE FUNCTION public.update_updated_at_column();


--
-- Name: algorithms algorithms_parent_fkey; Type: FK CONSTRAINT; Schema: cto; Owner: postgres
--

ALTER TABLE ONLY cto.algorithms
    ADD CONSTRAINT algorithms_parent_fkey FOREIGN KEY (parent_id) REFERENCES cto.algorithms(id);


--
-- Name: blocks_v3 blocks_v3_thread_hash_fkey; Type: FK CONSTRAINT; Schema: cto; Owner: postgres
--

ALTER TABLE ONLY cto.blocks_v3
    ADD CONSTRAINT blocks_v3_thread_hash_fkey FOREIGN KEY (thread_hash) REFERENCES cto.threads_v3(hash);


--
-- Name: ctx_feedback ctx_feedback_thread_hash_fkey; Type: FK CONSTRAINT; Schema: cto; Owner: postgres
--

ALTER TABLE ONLY cto.ctx_feedback
    ADD CONSTRAINT ctx_feedback_thread_hash_fkey FOREIGN KEY (thread_hash) REFERENCES cto.ctx_threads(hash);


--
-- Name: ctx_indexes ctx_indexes_thread_hash_fkey; Type: FK CONSTRAINT; Schema: cto; Owner: postgres
--

ALTER TABLE ONLY cto.ctx_indexes
    ADD CONSTRAINT ctx_indexes_thread_hash_fkey FOREIGN KEY (thread_hash) REFERENCES cto.ctx_threads(hash);


--
-- Name: ctx_resurrections ctx_resurrections_thread_hash_fkey; Type: FK CONSTRAINT; Schema: cto; Owner: postgres
--

ALTER TABLE ONLY cto.ctx_resurrections
    ADD CONSTRAINT ctx_resurrections_thread_hash_fkey FOREIGN KEY (thread_hash) REFERENCES cto.ctx_threads(hash);


--
-- Name: ctx_synthetics ctx_synthetics_thread_hash_fkey; Type: FK CONSTRAINT; Schema: cto; Owner: postgres
--

ALTER TABLE ONLY cto.ctx_synthetics
    ADD CONSTRAINT ctx_synthetics_thread_hash_fkey FOREIGN KEY (thread_hash) REFERENCES cto.ctx_threads(hash);


--
-- Name: messages_v3 messages_v3_thread_hash_fkey; Type: FK CONSTRAINT; Schema: cto; Owner: postgres
--

ALTER TABLE ONLY cto.messages_v3
    ADD CONSTRAINT messages_v3_thread_hash_fkey FOREIGN KEY (thread_hash) REFERENCES cto.threads_v3(hash);


--
-- Name: SCHEMA cto; Type: ACL; Schema: -; Owner: postgres
--

GRANT USAGE ON SCHEMA cto TO PUBLIC;
GRANT USAGE ON SCHEMA cto TO tzzr;


--
-- Name: SCHEMA log; Type: ACL; Schema: -; Owner: postgres
--

GRANT USAGE ON SCHEMA log TO tzzr;


--
-- Name: TABLE algorithms; Type: ACL; Schema: cto; Owner: postgres
--

GRANT SELECT,INSERT ON TABLE cto.algorithms TO PUBLIC;
GRANT SELECT,INSERT ON TABLE cto.algorithms TO tzzr;


--
-- Name: SEQUENCE algorithms_id_seq; Type: ACL; Schema: cto; Owner: postgres
--

GRANT USAGE ON SEQUENCE cto.algorithms_id_seq TO PUBLIC;
GRANT USAGE ON SEQUENCE cto.algorithms_id_seq TO tzzr;


--
-- Name: SEQUENCE blocks_id_seq; Type: ACL; Schema: cto; Owner: postgres
--

GRANT USAGE ON SEQUENCE cto.blocks_id_seq TO PUBLIC;
GRANT USAGE ON SEQUENCE cto.blocks_id_seq TO tzzr;


--
-- Name: TABLE blocks_v3; Type: ACL; Schema: cto; Owner: postgres
--

GRANT SELECT,INSERT ON TABLE cto.blocks_v3 TO tzzr;


--
-- Name: TABLE ctx_feedback; Type: ACL; Schema: cto; Owner: postgres
--

GRANT SELECT,INSERT ON TABLE cto.ctx_feedback TO PUBLIC;
GRANT SELECT,INSERT ON TABLE cto.ctx_feedback TO tzzr;


--
-- Name: SEQUENCE ctx_feedback_id_seq; Type: ACL; Schema: cto; Owner: postgres
--

GRANT USAGE ON SEQUENCE cto.ctx_feedback_id_seq TO PUBLIC;
GRANT USAGE ON SEQUENCE cto.ctx_feedback_id_seq TO tzzr;


--
-- Name: TABLE ctx_indexes; Type: ACL; Schema: cto; Owner: postgres
--

GRANT SELECT,INSERT ON TABLE cto.ctx_indexes TO PUBLIC;
GRANT SELECT,INSERT ON TABLE cto.ctx_indexes TO tzzr;


--
-- Name: SEQUENCE ctx_indexes_id_seq; Type: ACL; Schema: cto; Owner: postgres
--

GRANT USAGE ON SEQUENCE cto.ctx_indexes_id_seq TO PUBLIC;
GRANT USAGE ON SEQUENCE cto.ctx_indexes_id_seq TO tzzr;


--
-- Name: TABLE ctx_resurrections; Type: ACL; Schema: cto; Owner: postgres
--

GRANT SELECT,INSERT ON TABLE cto.ctx_resurrections TO PUBLIC;
GRANT SELECT,INSERT ON TABLE cto.ctx_resurrections TO tzzr;


--
-- Name: SEQUENCE ctx_resurrections_id_seq; Type: ACL; Schema: cto; Owner: postgres
--

GRANT USAGE ON SEQUENCE cto.ctx_resurrections_id_seq TO PUBLIC;
GRANT USAGE ON SEQUENCE cto.ctx_resurrections_id_seq TO tzzr;


--
-- Name: TABLE ctx_synthetics; Type: ACL; Schema: cto; Owner: postgres
--

GRANT SELECT,INSERT ON TABLE cto.ctx_synthetics TO PUBLIC;
GRANT SELECT,INSERT ON TABLE cto.ctx_synthetics TO tzzr;


--
-- Name: SEQUENCE ctx_synthetics_id_seq; Type: ACL; Schema: cto; Owner: postgres
--

GRANT USAGE ON SEQUENCE cto.ctx_synthetics_id_seq TO PUBLIC;
GRANT USAGE ON SEQUENCE cto.ctx_synthetics_id_seq TO tzzr;


--
-- Name: TABLE ctx_threads; Type: ACL; Schema: cto; Owner: postgres
--

GRANT SELECT,INSERT ON TABLE cto.ctx_threads TO PUBLIC;
GRANT SELECT,INSERT,UPDATE ON TABLE cto.ctx_threads TO tzzr;


--
-- Name: SEQUENCE ctx_threads_id_seq; Type: ACL; Schema: cto; Owner: postgres
--

GRANT USAGE ON SEQUENCE cto.ctx_threads_id_seq TO PUBLIC;
GRANT USAGE ON SEQUENCE cto.ctx_threads_id_seq TO tzzr;


--
-- Name: TABLE flg; Type: ACL; Schema: cto; Owner: postgres
--

GRANT SELECT,INSERT ON TABLE cto.flg TO PUBLIC;
GRANT SELECT,INSERT ON TABLE cto.flg TO tzzr;


--
-- Name: SEQUENCE flg_id_seq; Type: ACL; Schema: cto; Owner: postgres
--

GRANT USAGE ON SEQUENCE cto.flg_id_seq TO PUBLIC;
GRANT USAGE ON SEQUENCE cto.flg_id_seq TO tzzr;


--
-- Name: TABLE hst; Type: ACL; Schema: cto; Owner: postgres
--

GRANT SELECT,INSERT ON TABLE cto.hst TO PUBLIC;
GRANT SELECT,INSERT ON TABLE cto.hst TO tzzr;


--
-- Name: SEQUENCE hst_id_seq; Type: ACL; Schema: cto; Owner: postgres
--

GRANT USAGE ON SEQUENCE cto.hst_id_seq TO PUBLIC;
GRANT USAGE ON SEQUENCE cto.hst_id_seq TO tzzr;


--
-- Name: TABLE itm; Type: ACL; Schema: cto; Owner: postgres
--

GRANT SELECT,INSERT ON TABLE cto.itm TO PUBLIC;
GRANT SELECT,INSERT ON TABLE cto.itm TO tzzr;


--
-- Name: SEQUENCE itm_id_seq; Type: ACL; Schema: cto; Owner: postgres
--

GRANT USAGE ON SEQUENCE cto.itm_id_seq TO PUBLIC;
GRANT USAGE ON SEQUENCE cto.itm_id_seq TO tzzr;


--
-- Name: TABLE loc; Type: ACL; Schema: cto; Owner: postgres
--

GRANT SELECT,INSERT ON TABLE cto.loc TO PUBLIC;
GRANT SELECT,INSERT ON TABLE cto.loc TO tzzr;


--
-- Name: SEQUENCE loc_id_seq; Type: ACL; Schema: cto; Owner: postgres
--

GRANT USAGE ON SEQUENCE cto.loc_id_seq TO PUBLIC;
GRANT USAGE ON SEQUENCE cto.loc_id_seq TO tzzr;


--
-- Name: SEQUENCE memory_id_seq; Type: ACL; Schema: cto; Owner: postgres
--

GRANT USAGE ON SEQUENCE cto.memory_id_seq TO PUBLIC;
GRANT USAGE ON SEQUENCE cto.memory_id_seq TO tzzr;


--
-- Name: TABLE messages_v3; Type: ACL; Schema: cto; Owner: postgres
--

GRANT SELECT,INSERT ON TABLE cto.messages_v3 TO tzzr;


--
-- Name: COLUMN messages_v3.feedback; Type: ACL; Schema: cto; Owner: postgres
--

GRANT UPDATE(feedback) ON TABLE cto.messages_v3 TO tzzr;


--
-- Name: TABLE ply; Type: ACL; Schema: cto; Owner: postgres
--

GRANT SELECT,INSERT ON TABLE cto.ply TO PUBLIC;
GRANT SELECT,INSERT ON TABLE cto.ply TO tzzr;


--
-- Name: SEQUENCE ply_id_seq; Type: ACL; Schema: cto; Owner: postgres
--

GRANT USAGE ON SEQUENCE cto.ply_id_seq TO PUBLIC;
GRANT USAGE ON SEQUENCE cto.ply_id_seq TO tzzr;


--
-- Name: TABLE threads_v3; Type: ACL; Schema: cto; Owner: postgres
--

GRANT SELECT,INSERT ON TABLE cto.threads_v3 TO tzzr;


--
-- Name: COLUMN threads_v3.active_index; Type: ACL; Schema: cto; Owner: postgres
--

GRANT UPDATE(active_index) ON TABLE cto.threads_v3 TO tzzr;


--
-- Name: TABLE message_refs; Type: ACL; Schema: log; Owner: postgres
--

GRANT SELECT,INSERT ON TABLE log.message_refs TO tzzr;


--
-- Name: SEQUENCE message_refs_id_seq; Type: ACL; Schema: log; Owner: postgres
--

GRANT USAGE ON SEQUENCE log.message_refs_id_seq TO tzzr;


--
-- Name: TABLE messages; Type: ACL; Schema: log; Owner: postgres
--

GRANT SELECT,INSERT ON TABLE log.messages TO tzzr;


--
-- Name: SEQUENCE messages_id_seq; Type: ACL; Schema: log; Owner: postgres
--

GRANT USAGE ON SEQUENCE log.messages_id_seq TO tzzr;


--
--

\unrestrict Xk9GUfGz77j8FQgsd9KfqVmzbeWwYtsyC4El94C3ORGXDjgvmr8Jo1VboRoeQTa

--
-- Database "shlink" dump
--

--
--

\restrict 30JjzYeDC4yFh3ATEGQzMcCXdREnQy6LPJ82fFntWe3dYufbcf7HW3wccnTozeq


SELECT pg_catalog.set_config('search_path', '', false);

--
-- Name: shlink; Type: DATABASE; Schema: -; Owner: tzzr
--

CREATE DATABASE shlink WITH TEMPLATE = template0 ENCODING = 'UTF8' LOCALE_PROVIDER = libc LC_COLLATE = 'C' LC_CTYPE = 'C.UTF-8';


ALTER DATABASE shlink OWNER TO tzzr;

\unrestrict 30JjzYeDC4yFh3ATEGQzMcCXdREnQy6LPJ82fFntWe3dYufbcf7HW3wccnTozeq
\connect shlink
\restrict 30JjzYeDC4yFh3ATEGQzMcCXdREnQy6LPJ82fFntWe3dYufbcf7HW3wccnTozeq

SELECT pg_catalog.set_config('search_path', '', false);



--
-- Name: api_key_roles; Type: TABLE; Schema: public; Owner: tzzr
--

CREATE TABLE public.api_key_roles (
    id bigint NOT NULL,
    role_name character varying(255) NOT NULL,
    meta json NOT NULL,
    api_key_id bigint NOT NULL
);


ALTER TABLE public.api_key_roles OWNER TO tzzr;

--
-- Name: api_key_roles_id_seq; Type: SEQUENCE; Schema: public; Owner: tzzr
--

ALTER TABLE public.api_key_roles ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.api_key_roles_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: api_keys; Type: TABLE; Schema: public; Owner: tzzr
--

CREATE TABLE public.api_keys (
    id bigint NOT NULL,
    key character varying(255) NOT NULL,
    name character varying(255) DEFAULT NULL::character varying,
    expiration_date timestamp(0) without time zone DEFAULT NULL::timestamp without time zone,
    enabled boolean NOT NULL
);


ALTER TABLE public.api_keys OWNER TO tzzr;

--
-- Name: api_keys_id_seq; Type: SEQUENCE; Schema: public; Owner: tzzr
--

ALTER TABLE public.api_keys ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.api_keys_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: domains; Type: TABLE; Schema: public; Owner: tzzr
--

CREATE TABLE public.domains (
    id bigint NOT NULL,
    authority character varying(255) NOT NULL,
    base_url_redirect text,
    regular_not_found_redirect text,
    invalid_short_url_redirect text
);


ALTER TABLE public.domains OWNER TO tzzr;

--
-- Name: domains_id_seq; Type: SEQUENCE; Schema: public; Owner: tzzr
--

ALTER TABLE public.domains ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.domains_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: geolocation_db_updates; Type: TABLE; Schema: public; Owner: tzzr
--

CREATE TABLE public.geolocation_db_updates (
    id bigint NOT NULL,
    date_created timestamp(0) without time zone NOT NULL,
    date_updated timestamp(0) without time zone DEFAULT NULL::timestamp without time zone,
    status character varying(128) NOT NULL,
    error character varying(1024) DEFAULT NULL::character varying,
    reason character varying(1024) NOT NULL,
    filesystem_id character varying(512) NOT NULL
);


ALTER TABLE public.geolocation_db_updates OWNER TO tzzr;

--
-- Name: geolocation_db_updates_id_seq; Type: SEQUENCE; Schema: public; Owner: tzzr
--

ALTER TABLE public.geolocation_db_updates ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.geolocation_db_updates_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: migrations; Type: TABLE; Schema: public; Owner: tzzr
--

CREATE TABLE public.migrations (
    version character varying(191) NOT NULL,
    executed_at timestamp(0) without time zone DEFAULT NULL::timestamp without time zone,
    execution_time integer
);


ALTER TABLE public.migrations OWNER TO tzzr;

--
-- Name: orphan_visits_counts; Type: TABLE; Schema: public; Owner: tzzr
--

CREATE TABLE public.orphan_visits_counts (
    id bigint NOT NULL,
    potential_bot boolean DEFAULT false NOT NULL,
    count bigint DEFAULT 1 NOT NULL,
    slot_id integer NOT NULL
);


ALTER TABLE public.orphan_visits_counts OWNER TO tzzr;

--
-- Name: orphan_visits_counts_id_seq; Type: SEQUENCE; Schema: public; Owner: tzzr
--

ALTER TABLE public.orphan_visits_counts ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.orphan_visits_counts_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: redirect_conditions; Type: TABLE; Schema: public; Owner: tzzr
--

CREATE TABLE public.redirect_conditions (
    id bigint NOT NULL,
    type character varying(255) NOT NULL,
    match_key character varying(512) DEFAULT NULL::character varying,
    match_value character varying(512) DEFAULT NULL::character varying
);


ALTER TABLE public.redirect_conditions OWNER TO tzzr;

--
-- Name: redirect_conditions_id_seq; Type: SEQUENCE; Schema: public; Owner: tzzr
--

ALTER TABLE public.redirect_conditions ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.redirect_conditions_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: redirect_conditions_in_short_url_redirect_rules; Type: TABLE; Schema: public; Owner: tzzr
--

CREATE TABLE public.redirect_conditions_in_short_url_redirect_rules (
    short_url_redirect_rule_id bigint NOT NULL,
    redirect_condition_id bigint NOT NULL
);


ALTER TABLE public.redirect_conditions_in_short_url_redirect_rules OWNER TO tzzr;

--
-- Name: short_url_redirect_rules; Type: TABLE; Schema: public; Owner: tzzr
--

CREATE TABLE public.short_url_redirect_rules (
    id bigint NOT NULL,
    priority integer NOT NULL,
    long_url text NOT NULL,
    short_url_id bigint NOT NULL
);


ALTER TABLE public.short_url_redirect_rules OWNER TO tzzr;

--
-- Name: short_url_redirect_rules_id_seq; Type: SEQUENCE; Schema: public; Owner: tzzr
--

ALTER TABLE public.short_url_redirect_rules ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.short_url_redirect_rules_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: short_url_visits_counts; Type: TABLE; Schema: public; Owner: tzzr
--

CREATE TABLE public.short_url_visits_counts (
    id bigint NOT NULL,
    potential_bot boolean DEFAULT false NOT NULL,
    count bigint DEFAULT 1 NOT NULL,
    slot_id integer NOT NULL,
    short_url_id bigint
);


ALTER TABLE public.short_url_visits_counts OWNER TO tzzr;

--
-- Name: short_url_visits_counts_id_seq; Type: SEQUENCE; Schema: public; Owner: tzzr
--

ALTER TABLE public.short_url_visits_counts ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.short_url_visits_counts_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: short_urls; Type: TABLE; Schema: public; Owner: tzzr
--

CREATE TABLE public.short_urls (
    id bigint NOT NULL,
    original_url text NOT NULL,
    short_code character varying(255) NOT NULL,
    date_created timestamp(0) without time zone NOT NULL,
    valid_since timestamp(0) without time zone DEFAULT NULL::timestamp without time zone,
    valid_until timestamp(0) without time zone DEFAULT NULL::timestamp without time zone,
    max_visits integer,
    import_source character varying(255) DEFAULT NULL::character varying,
    import_original_short_code character varying(255) DEFAULT NULL::character varying,
    title character varying(512) DEFAULT NULL::character varying,
    title_was_auto_resolved boolean DEFAULT false NOT NULL,
    crawlable boolean DEFAULT false NOT NULL,
    forward_query boolean DEFAULT true NOT NULL,
    domain_id bigint,
    author_api_key_id bigint
);


ALTER TABLE public.short_urls OWNER TO tzzr;

--
-- Name: short_urls_id_seq; Type: SEQUENCE; Schema: public; Owner: tzzr
--

ALTER TABLE public.short_urls ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.short_urls_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: short_urls_in_tags; Type: TABLE; Schema: public; Owner: tzzr
--

CREATE TABLE public.short_urls_in_tags (
    short_url_id bigint NOT NULL,
    tag_id bigint NOT NULL
);


ALTER TABLE public.short_urls_in_tags OWNER TO tzzr;

--
-- Name: tags; Type: TABLE; Schema: public; Owner: tzzr
--

CREATE TABLE public.tags (
    id bigint NOT NULL,
    name character varying(255) NOT NULL
);


ALTER TABLE public.tags OWNER TO tzzr;

--
-- Name: tags_id_seq; Type: SEQUENCE; Schema: public; Owner: tzzr
--

ALTER TABLE public.tags ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.tags_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: visit_locations; Type: TABLE; Schema: public; Owner: tzzr
--

CREATE TABLE public.visit_locations (
    id bigint NOT NULL,
    country_code character varying(255) DEFAULT NULL::character varying,
    country_name character varying(255) DEFAULT NULL::character varying,
    region_name character varying(255) DEFAULT NULL::character varying,
    city_name character varying(255) DEFAULT NULL::character varying,
    timezone character varying(255) DEFAULT NULL::character varying,
    lat double precision NOT NULL,
    lon double precision NOT NULL,
    is_empty boolean DEFAULT false NOT NULL
);


ALTER TABLE public.visit_locations OWNER TO tzzr;

--
-- Name: visit_locations_id_seq; Type: SEQUENCE; Schema: public; Owner: tzzr
--

ALTER TABLE public.visit_locations ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.visit_locations_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Name: visits; Type: TABLE; Schema: public; Owner: tzzr
--

CREATE TABLE public.visits (
    id bigint NOT NULL,
    referer character varying(1024) DEFAULT NULL::character varying,
    date timestamp(0) without time zone NOT NULL,
    remote_addr character varying(256) DEFAULT NULL::character varying,
    user_agent character varying(512) DEFAULT NULL::character varying,
    visited_url character varying(2048) DEFAULT NULL::character varying,
    type character varying(255) NOT NULL,
    potential_bot boolean DEFAULT false NOT NULL,
    redirect_url character varying(2048) DEFAULT NULL::character varying,
    short_url_id bigint,
    visit_location_id bigint
);


ALTER TABLE public.visits OWNER TO tzzr;

--
-- Name: visits_id_seq; Type: SEQUENCE; Schema: public; Owner: tzzr
--

ALTER TABLE public.visits ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
    SEQUENCE NAME public.visits_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1
);


--
-- Data for Name: api_key_roles; Type: TABLE DATA; Schema: public; Owner: tzzr
--

COPY public.api_key_roles (id, role_name, meta, api_key_id) FROM stdin;
\.


--
-- Data for Name: api_keys; Type: TABLE DATA; Schema: public; Owner: tzzr
--

COPY public.api_keys (id, key, name, expiration_date, enabled) FROM stdin;
1	0e8564f207257ae0008bd2d6258d53c6f4219c000b207bea29a9c40e7af06cea	Admin Key	\N	t
\.


--
-- Data for Name: domains; Type: TABLE DATA; Schema: public; Owner: tzzr
--

COPY public.domains (id, authority, base_url_redirect, regular_not_found_redirect, invalid_short_url_redirect) FROM stdin;
\.


--
-- Data for Name: geolocation_db_updates; Type: TABLE DATA; Schema: public; Owner: tzzr
--

COPY public.geolocation_db_updates (id, date_created, date_updated, status, error, reason, filesystem_id) FROM stdin;
\.


--
-- Data for Name: migrations; Type: TABLE DATA; Schema: public; Owner: tzzr
--

COPY public.migrations (version, executed_at, execution_time) FROM stdin;
ShlinkMigrations\\Version20230211171904	2026-01-11 05:22:40	82
ShlinkMigrations\\Version20230303164233	2026-01-11 05:22:40	35
ShlinkMigrations\\Version20240220214031	2026-01-11 05:22:40	38
ShlinkMigrations\\Version20240318084804	2026-01-11 05:22:40	4
ShlinkMigrations\\Version20240331111447	2026-01-11 05:22:40	9
ShlinkMigrations\\Version20241105094747	2026-01-11 05:22:40	1
ShlinkMigrations\\Version20241105215309	2026-01-11 05:22:40	0
ShlinkMigrations\\Version20250722060208	2026-01-11 05:22:41	45
\.


--
-- Data for Name: orphan_visits_counts; Type: TABLE DATA; Schema: public; Owner: tzzr
--

COPY public.orphan_visits_counts (id, potential_bot, count, slot_id) FROM stdin;
4	f	1	82
6	t	1	35
8	t	1	55
12	f	2	80
11	f	2	7
18	f	1	60
20	f	1	91
21	f	1	42
123	t	1	84
32	t	1	69
36	f	1	27
1	f	2	31
98	f	2	19
42	f	1	59
14	f	2	93
88	f	2	38
49	t	1	33
178	t	2	51
53	f	1	48
3	t	2	10
55	f	1	45
164	f	2	73
63	f	1	95
29	f	3	98
24	f	2	97
66	f	1	85
22	f	3	90
73	f	1	86
76	t	1	25
77	t	1	66
130	t	1	54
2	f	5	50
82	t	1	57
83	t	1	86
84	f	1	57
131	t	1	43
86	f	1	10
56	f	2	24
19	f	3	83
91	f	1	32
59	f	3	81
173	f	1	39
79	f	3	84
26	f	2	21
110	f	2	72
52	f	3	92
102	f	1	17
124	t	2	16
58	f	2	61
106	f	1	11
107	f	1	35
44	f	2	55
68	f	2	79
113	t	1	17
23	f	2	25
109	f	2	51
35	f	2	29
118	f	1	20
27	f	2	89
120	f	1	58
121	f	1	13
132	t	1	52
134	t	1	22
135	t	1	93
127	t	2	29
31	t	2	53
138	t	1	60
140	t	1	42
141	t	1	2
142	t	1	49
129	t	2	8
144	t	1	32
145	t	1	27
147	t	1	45
125	t	2	47
139	t	2	88
150	t	1	40
152	t	1	11
146	t	2	13
156	t	1	98
126	t	2	99
75	t	2	36
160	t	1	28
161	t	1	61
25	f	2	9
163	t	1	59
34	f	3	49
7	f	2	52
9	f	4	68
151	t	2	77
5	f	3	71
96	f	2	76
47	f	5	94
81	f	3	67
128	t	2	58
45	f	2	87
38	f	3	6
95	f	2	18
115	f	2	5
186	f	1	54
187	f	1	53
87	f	2	70
43	f	4	28
10	f	3	26
192	f	1	77
70	f	2	46
195	t	1	41
39	f	3	41
197	t	1	56
30	f	2	2
133	t	2	26
201	f	1	14
202	f	1	16
183	f	2	23
108	f	3	88
206	f	1	0
62	f	3	75
100	f	2	1
155	t	2	48
217	f	1	8
219	f	1	43
17	f	5	37
222	f	1	65
16	f	5	47
61	f	5	22
41	f	4	69
105	f	4	33
153	t	2	21
33	t	2	75
157	t	3	67
228	f	1	40
231	t	1	68
232	t	1	90
235	t	1	30
236	t	1	46
241	t	1	20
242	t	1	19
243	t	1	5
244	t	1	24
233	t	2	70
249	f	1	96
\.


--
-- Data for Name: redirect_conditions; Type: TABLE DATA; Schema: public; Owner: tzzr
--

COPY public.redirect_conditions (id, type, match_key, match_value) FROM stdin;
\.


--
-- Data for Name: redirect_conditions_in_short_url_redirect_rules; Type: TABLE DATA; Schema: public; Owner: tzzr
--

COPY public.redirect_conditions_in_short_url_redirect_rules (short_url_redirect_rule_id, redirect_condition_id) FROM stdin;
\.


--
-- Data for Name: short_url_redirect_rules; Type: TABLE DATA; Schema: public; Owner: tzzr
--

COPY public.short_url_redirect_rules (id, priority, long_url, short_url_id) FROM stdin;
\.


--
-- Data for Name: short_url_visits_counts; Type: TABLE DATA; Schema: public; Owner: tzzr
--

COPY public.short_url_visits_counts (id, potential_bot, count, slot_id, short_url_id) FROM stdin;
\.


--
-- Data for Name: short_urls; Type: TABLE DATA; Schema: public; Owner: tzzr
--

COPY public.short_urls (id, original_url, short_code, date_created, valid_since, valid_until, max_visits, import_source, import_original_short_code, title, title_was_auto_resolved, crawlable, forward_query, domain_id, author_api_key_id) FROM stdin;
1	https://example.com/test-shlink	qWMe2	2026-01-21 12:37:42	\N	\N	\N	\N	\N	\N	f	f	t	\N	1
\.


--
-- Data for Name: short_urls_in_tags; Type: TABLE DATA; Schema: public; Owner: tzzr
--

COPY public.short_urls_in_tags (short_url_id, tag_id) FROM stdin;
\.


--
-- Data for Name: tags; Type: TABLE DATA; Schema: public; Owner: tzzr
--

COPY public.tags (id, name) FROM stdin;
\.


--
-- Data for Name: visit_locations; Type: TABLE DATA; Schema: public; Owner: tzzr
--

COPY public.visit_locations (id, country_code, country_name, region_name, city_name, timezone, lat, lon, is_empty) FROM stdin;
\.


--
-- Data for Name: visits; Type: TABLE DATA; Schema: public; Owner: tzzr
--

COPY public.visits (id, referer, date, remote_addr, user_agent, visited_url, type, potential_bot, redirect_url, short_url_id, visit_location_id) FROM stdin;
1		2026-01-13 05:39:49	84.254.106.0	Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Mobile Safari/537.36	http://shlink.tzzrdeck.me/	base_url	f	\N	\N	\N
2		2026-01-13 22:06:58	205.210.31.0	Hello from Palo Alto Networks, find out more about our scans in https://docs-cortex.paloaltonetworks.com/r/1/Cortex-Xpanse/Scanning-activity	http://shlink.tzzrdeck.me/	base_url	f	\N	\N	\N
3		2026-01-19 23:04:56	172.21.0.0	curl/8.14.1	http://shlink:8080/	base_url	t	\N	\N	\N
4		2026-01-19 23:13:52	\N	Mozilla/5.0 (Linux; Android 14; SM-S928B) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Mobile Safari/537.36	http://shlink.tzzrdeck.me/.git/config	regular_404	f	\N	\N	\N
5		2026-01-19 23:14:50	146.70.185.0	Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3	http://shlink.tzzrdeck.me/	base_url	f	\N	\N	\N
6		2026-01-19 23:15:13	172.21.0.0	curl/7.81.0	http://localhost:8083/	base_url	t	\N	\N	\N
7		2026-01-19 23:22:03	\N		http://shlink.tzzrdeck.me/	base_url	f	\N	\N	\N
8		2026-01-19 23:22:05	\N		http://shlink.tzzrdeck.me/	base_url	t	\N	\N	\N
9		2026-01-19 23:47:33	107.172.195.0	Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36	http://shlink.tzzrdeck.me/	base_url	f	\N	\N	\N
10		2026-01-19 23:47:33	104.252.191.0	Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36	http://shlink.tzzrdeck.me/	base_url	f	\N	\N	\N
11		2026-01-19 23:47:43	103.4.251.0	Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36	http://shlink.tzzrdeck.me/	base_url	f	\N	\N	\N
12		2026-01-19 23:52:31	107.172.195.0	Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36	http://shlink.tzzrdeck.me/	base_url	f	\N	\N	\N
13		2026-01-19 23:52:33	103.196.9.0	Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36	http://shlink.tzzrdeck.me/	base_url	f	\N	\N	\N
14		2026-01-19 23:52:42	103.4.251.0	Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36	http://shlink.tzzrdeck.me/	base_url	f	\N	\N	\N
15		2026-01-20 00:02:07	213.136.82.0	Mozilla/5.0	http://shlink.tzzrdeck.me/	base_url	f	\N	\N	\N
16		2026-01-20 00:02:09	213.136.82.0	Mozilla/5.0	http://shlink.tzzrdeck.me/	base_url	f	\N	\N	\N
17		2026-01-20 00:02:44	103.196.9.0	Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36	http://shlink.tzzrdeck.me/	base_url	f	\N	\N	\N
18		2026-01-20 00:02:46	104.164.126.0	Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36	http://shlink.tzzrdeck.me/	base_url	f	\N	\N	\N
19		2026-01-20 00:02:56	103.4.251.0	Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36	http://shlink.tzzrdeck.me/	base_url	f	\N	\N	\N
20		2026-01-20 00:03:44	147.93.155.0	Mozilla/5.0 (Linux; Android 14; Pixel 8 Pro) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.6478.107 Mobile Safari/537.36	http://shlink.tzzrdeck.me/	base_url	f	\N	\N	\N
21		2026-01-20 00:03:55	185.196.8.0	Mozilla/5.0 (X11; Linux x86_64; rv:134.0) Gecko/20100101 Firefox/134.0	http://shlink.tzzrdeck.me/.git/config	regular_404	f	\N	\N	\N
22		2026-01-20 00:21:22	104.252.191.0	Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36	http://shlink.tzzrdeck.me/	base_url	f	\N	\N	\N
23		2026-01-20 00:21:23	107.172.195.0	Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36	http://shlink.tzzrdeck.me/	base_url	f	\N	\N	\N
24		2026-01-20 00:21:24	107.172.195.0	Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36	http://shlink.tzzrdeck.me/	base_url	f	\N	\N	\N
25		2026-01-20 00:34:19	195.250.31.0		http://shlink.tzzrdeck.me/.env	invalid_short_url	f	\N	\N	\N
26		2026-01-20 00:47:55	103.4.251.0	Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36	http://shlink.tzzrdeck.me/	base_url	f	\N	\N	\N
27		2026-01-20 00:47:55	104.164.126.0	Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36	http://shlink.tzzrdeck.me/	base_url	f	\N	\N	\N
28		2026-01-20 00:48:02	104.164.126.0	Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36	http://shlink.tzzrdeck.me/	base_url	f	\N	\N	\N
29	https://www.youtube.com/	2026-01-20 01:00:52	194.163.149.0	Mozilla/5.0 (Macintosh; Intel Mac OS X 14_2_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36	http://shlink.tzzrdeck.me/.git/config	regular_404	f	\N	\N	\N
30		2026-01-20 01:01:22	195.178.110.0	Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36	http://shlink.tzzrdeck.me/	base_url	f	\N	\N	\N
31		2026-01-20 01:28:11	66.115.182.0	req/v3 (https://github.com/imroc/req)	http://shlink.tzzrdeck.me/	base_url	t	\N	\N	\N
32		2026-01-20 01:28:13	81.53.36.0	req/v3 (https://github.com/imroc/req)	http://shlink.tzzrdeck.me/	base_url	t	\N	\N	\N
33		2026-01-20 01:29:10	81.53.36.0	req/v3 (https://github.com/imroc/req)	http://shlink.tzzrdeck.me/	base_url	t	\N	\N	\N
34	http://shlink.tzzrdeck.me/	2026-01-20 01:33:51	81.53.36.0	Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.5112.79 Safari/537.36	http://shlink.tzzrdeck.me/	base_url	f	\N	\N	\N
35	http://shlink.tzzrdeck.me/	2026-01-20 01:33:52	81.53.36.0	Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1	http://shlink.tzzrdeck.me/	base_url	f	\N	\N	\N
36		2026-01-20 04:52:27	51.89.23.0	Mozilla/5.0	http://shlink.tzzrdeck.me/	base_url	f	\N	\N	\N
37		2026-01-20 04:52:27	51.89.23.0	Mozilla/5.0	http://shlink.tzzrdeck.me/	base_url	f	\N	\N	\N
38		2026-01-20 09:42:32	45.148.10.0	Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.157 Safari/537.36	http://shlink.tzzrdeck.me/.git/config	regular_404	f	\N	\N	\N
39		2026-01-20 21:31:46	195.178.110.0	Mozilla/5.0	http://shlink.tzzrdeck.me/	base_url	f	\N	\N	\N
40		2026-01-20 21:51:13	\N	Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.3	http://shlink.tzzrdeck.me/	base_url	f	\N	\N	\N
41		2026-01-20 23:09:12	\N	Mozilla/5.0 (X11; Linux x86_64)	http://shlink.tzzrdeck.me/.git/config	regular_404	f	\N	\N	\N
42		2026-01-21 00:22:39	34.221.21.0	Mozilla/5.0 (X11; Linux i686; rv:124.0) Gecko/20100101 Firefox/124.0	http://shlink.tzzrdeck.me/	base_url	f	\N	\N	\N
43		2026-01-21 03:48:55	161.35.221.0	Mozilla/5.0	http://shlink.tzzrdeck.me/wp-login.php	invalid_short_url	f	\N	\N	\N
44		2026-01-21 06:36:33	45.148.10.0	Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/75.0.3770.90 Chrome/75.0.3770.90 Safari/537.36	http://shlink.tzzrdeck.me/.git/config	regular_404	f	\N	\N	\N
45		2026-01-21 06:39:53	195.178.110.0	Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36	http://shlink.tzzrdeck.me/	base_url	f	\N	\N	\N
46		2026-01-21 06:44:29	195.178.110.0	Mozilla/5.0 (Linux; Android 9; SM-G950U) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.111 Mobile Safari/537.36	http://shlink.tzzrdeck.me/	base_url	f	\N	\N	\N
47		2026-01-21 11:11:15	45.148.10.0	Mozilla/5.0 (Linux; U; Android 4.0.3; en-us; KFTT Build/IML74K) AppleWebKit/535.19 (KHTML, like Gecko) Silk/2.1 Mobile Safari/535.19 Silk-Accelerated=true	http://shlink.tzzrdeck.me/.git/config	regular_404	f	\N	\N	\N
48		2026-01-21 12:29:47	80.26.90.0	Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.2 Safari/605.1.15	http://shlink.tzzrdeck.me/	base_url	f	\N	\N	\N
49		2026-01-21 12:36:08	69.62.126.0	curl/8.5.0	http://short.tzzrdeck.me/	base_url	t	\N	\N	\N
50		2026-01-21 12:36:09	104.252.191.0	Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36	http://short.tzzrdeck.me/	base_url	f	\N	\N	\N
51		2026-01-21 12:36:11	104.164.173.0	Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36	http://short.tzzrdeck.me/	base_url	f	\N	\N	\N
52		2026-01-21 12:36:18	104.164.173.0	Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36	http://short.tzzrdeck.me/	base_url	f	\N	\N	\N
53		2026-01-21 12:37:31	80.26.90.0	Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.2 Safari/605.1.15	http://short.tzzrdeck.me/	base_url	f	\N	\N	\N
54		2026-01-21 12:38:03	46.202.140.0	Mozilla/5.0 (Windows NT 11.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36 GLS/100.10.9939.127	http://short.tzzrdeck.me/	base_url	f	\N	\N	\N
55		2026-01-21 12:39:12	80.26.90.0	Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.2 Safari/605.1.15	http://short.tzzrdeck.me/	base_url	f	\N	\N	\N
56		2026-01-21 12:39:32	80.26.90.0	Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko)	http://short.tzzrdeck.me/	base_url	f	\N	\N	\N
57		2026-01-21 12:39:33	80.26.90.0	Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Safari	http://short.tzzrdeck.me/apple-touch-icon-precomposed.png	invalid_short_url	f	\N	\N	\N
58		2026-01-21 12:39:33	80.26.90.0	Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Safari	http://short.tzzrdeck.me/apple-touch-icon.png	invalid_short_url	f	\N	\N	\N
59		2026-01-21 12:39:33	80.26.90.0	Mozilla/5.0 (iPhone; CPU iPhone OS 18_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Mobile/15E148 Safari/604.1	http://short.tzzrdeck.me/	base_url	f	\N	\N	\N
60		2026-01-21 12:39:33	80.26.90.0	Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Safari	http://short.tzzrdeck.me/apple-touch-icon-precomposed.png	invalid_short_url	f	\N	\N	\N
61		2026-01-21 12:39:33	80.26.90.0	Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Safari	http://short.tzzrdeck.me/apple-touch-icon.png	invalid_short_url	f	\N	\N	\N
62		2026-01-21 12:40:21	205.169.39.0	Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36	http://short.tzzrdeck.me/	base_url	f	\N	\N	\N
63		2026-01-21 12:41:21	34.118.46.0	Mozilla/5.0 (iPhone13,2; U; CPU iPhone OS 14_0 like Mac OS X) AppleWebKit/602.1.50 (KHTML, like Gecko) Version/10.0 Mobile/15E148 Safari/602.1	http://short.tzzrdeck.me/	base_url	f	\N	\N	\N
64		2026-01-21 12:44:31	205.169.39.0	Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.5938.132 Safari/537.36	http://short.tzzrdeck.me/	base_url	f	\N	\N	\N
66		2026-01-21 12:46:44	80.26.90.0	com.apple.WebKit.Networking/21623.1.14.11.9 Network/5569.60.39.0.3 macOS/26.2	http://short.tzzrdeck.me/apple-touch-icon-precomposed.png	invalid_short_url	f	\N	\N	\N
65		2026-01-21 12:46:44	80.26.90.0	com.apple.WebKit.Networking/21623.1.14.11.9 Network/5569.60.39.0.3 macOS/26.2	http://short.tzzrdeck.me/apple-touch-icon.png	invalid_short_url	f	\N	\N	\N
67		2026-01-21 12:46:50	103.4.250.0	Mozilla/5.0 (iPhone; CPU iPhone OS 18_7_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/143.0.7499.151 Mobile/15E148 Safari/604.1	http://short.tzzrdeck.me/	base_url	f	\N	\N	\N
68		2026-01-21 12:46:51	104.232.199.0	Mozilla/5.0 (iPhone; CPU iPhone OS 18_7_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/143.0.7499.151 Mobile/15E148 Safari/604.1	http://short.tzzrdeck.me/	base_url	f	\N	\N	\N
69		2026-01-21 12:47:56	128.192.12.0	Mozilla/5.0 (compatible; UGAResearchAgent/1.0; Please visit: NISLabUGA.github.io)	http://short.tzzrdeck.me/	base_url	f	\N	\N	\N
70	http://short.tzzrdeck.me/	2026-01-21 12:48:48	192.175.111.0	Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36	http://short.tzzrdeck.me/	base_url	f	\N	\N	\N
71	http://short.tzzrdeck.me/	2026-01-21 12:48:49	192.175.111.0	Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36	http://short.tzzrdeck.me/	base_url	f	\N	\N	\N
72	http://short.tzzrdeck.me/	2026-01-21 12:48:50	192.175.111.0	Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36	http://short.tzzrdeck.me/	base_url	f	\N	\N	\N
73		2026-01-21 12:48:50	192.175.111.0	Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36	http://short.tzzrdeck.me/	base_url	f	\N	\N	\N
74	http://short.tzzrdeck.me/	2026-01-21 12:48:51	64.15.129.0	Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36	http://short.tzzrdeck.me/	base_url	f	\N	\N	\N
75		2026-01-21 12:50:18	3.87.55.0	okhttp/5.3.0	http://short.tzzrdeck.me/	base_url	t	\N	\N	\N
76		2026-01-21 12:50:19	3.87.55.0	okhttp/5.3.0	http://short.tzzrdeck.me/favicon.png	invalid_short_url	t	\N	\N	\N
77		2026-01-21 12:50:19	54.164.157.0	python-requests/2.32.5	http://short.tzzrdeck.me/	base_url	t	\N	\N	\N
78		2026-01-21 12:52:59	80.26.90.0	Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.2 Safari/605.1.15	http://short.tzzrdeck.me/	base_url	f	\N	\N	\N
79		2026-01-21 12:52:59	80.26.90.0	Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Safari	http://short.tzzrdeck.me/apple-touch-icon-precomposed.png	invalid_short_url	f	\N	\N	\N
80		2026-01-21 12:52:59	80.26.90.0	Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Safari	http://short.tzzrdeck.me/apple-touch-icon.png	invalid_short_url	f	\N	\N	\N
81		2026-01-21 12:56:35	80.26.90.0	Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.2 Safari/605.1.15	http://short.tzzrdeck.me/	base_url	f	\N	\N	\N
82		2026-01-21 13:08:31	172.21.0.0	curl/7.81.0	http://127.0.0.1:8083/	base_url	t	\N	\N	\N
83		2026-01-21 13:08:52	69.62.126.0	curl/8.5.0	http://short.tzzrdeck.me/	base_url	t	\N	\N	\N
84		2026-01-21 13:16:46	80.26.90.0	Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.2 Safari/605.1.15	http://short.tzzrdeck.me/	base_url	f	\N	\N	\N
85		2026-01-21 13:20:34	103.4.250.0	Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36	http://short.tzzrdeck.me/	base_url	f	\N	\N	\N
86		2026-01-21 13:20:45	104.164.126.0	Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36	http://short.tzzrdeck.me/	base_url	f	\N	\N	\N
87		2026-01-21 13:20:50	104.252.191.0	Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36	http://short.tzzrdeck.me/	base_url	f	\N	\N	\N
88		2026-01-21 13:55:52	35.204.159.0	Mozilla/5.0 (X11; openSUSE; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.6422.141 Safari/537.36	http://short.tzzrdeck.me/	base_url	f	\N	\N	\N
89		2026-01-21 14:06:41	34.133.27.0	Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2049.0 Safari/537.36	http://short.tzzrdeck.me/	base_url	f	\N	\N	\N
90	http://short.tzzrdeck.me	2026-01-21 14:08:17	34.212.197.0	Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36	http://short.tzzrdeck.me/	base_url	f	\N	\N	\N
91	http://short.tzzrdeck.me	2026-01-21 14:08:17	34.212.197.0	Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.4 Mobile/15E148 Safari/604.1	http://short.tzzrdeck.me/	base_url	f	\N	\N	\N
92		2026-01-21 14:08:18	34.212.197.0	Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36	http://short.tzzrdeck.me/	base_url	f	\N	\N	\N
93		2026-01-21 14:08:18	34.212.197.0	Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.4 Mobile/15E148 Safari/604.1	http://short.tzzrdeck.me/	base_url	f	\N	\N	\N
94	http://short.tzzrdeck.me	2026-01-21 14:08:19	34.212.197.0	Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.4 Mobile/15E148 Safari/604.1	http://short.tzzrdeck.me/	base_url	f	\N	\N	\N
95	http://short.tzzrdeck.me	2026-01-21 14:08:19	34.212.197.0	Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36	http://short.tzzrdeck.me/	base_url	f	\N	\N	\N
96		2026-01-21 14:08:19	34.212.197.0	Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.4 Mobile/15E148 Safari/604.1	http://short.tzzrdeck.me/	base_url	f	\N	\N	\N
97		2026-01-21 14:08:19	34.212.197.0	Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36	http://short.tzzrdeck.me/	base_url	f	\N	\N	\N
98	http://short.tzzrdeck.me	2026-01-21 14:08:20	34.212.197.0	Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.4 Mobile/15E148 Safari/604.1	http://short.tzzrdeck.me/	base_url	f	\N	\N	\N
99	http://short.tzzrdeck.me	2026-01-21 14:08:20	34.212.197.0	Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36	http://short.tzzrdeck.me/	base_url	f	\N	\N	\N
101		2026-01-21 14:08:21	34.212.197.0	Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36	http://short.tzzrdeck.me/	base_url	f	\N	\N	\N
100		2026-01-21 14:08:21	34.212.197.0	Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.4 Mobile/15E148 Safari/604.1	http://short.tzzrdeck.me/	base_url	f	\N	\N	\N
102	http://short.tzzrdeck.me	2026-01-21 14:08:22	34.212.197.0	Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36	http://short.tzzrdeck.me/	base_url	f	\N	\N	\N
103	http://short.tzzrdeck.me	2026-01-21 14:08:22	34.212.197.0	Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.4 Mobile/15E148 Safari/604.1	http://short.tzzrdeck.me/	base_url	f	\N	\N	\N
104		2026-01-21 14:08:22	34.212.197.0	Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.4 Mobile/15E148 Safari/604.1	http://short.tzzrdeck.me/	base_url	f	\N	\N	\N
105		2026-01-21 14:08:22	34.212.197.0	Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36	http://short.tzzrdeck.me/	base_url	f	\N	\N	\N
106	http://short.tzzrdeck.me	2026-01-21 14:08:23	34.212.197.0	Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.4 Mobile/15E148 Safari/604.1	http://short.tzzrdeck.me/	base_url	f	\N	\N	\N
107	http://short.tzzrdeck.me	2026-01-21 14:08:23	34.212.197.0	Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36	http://short.tzzrdeck.me/	base_url	f	\N	\N	\N
108		2026-01-21 14:08:23	34.212.197.0	Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.4 Mobile/15E148 Safari/604.1	http://short.tzzrdeck.me/	base_url	f	\N	\N	\N
109		2026-01-21 14:08:24	34.212.197.0	Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36	http://short.tzzrdeck.me/	base_url	f	\N	\N	\N
110		2026-01-21 14:29:05	149.57.180.0	Mozilla/5.0 (X11; Linux i686; rv:109.0) Gecko/20100101 Firefox/120.0	http://short.tzzrdeck.me/	base_url	f	\N	\N	\N
160		2026-01-22 02:10:33	3.101.28.0	python-httpx/0.28.1	http://short.tzzrdeck.me/store/.env	regular_404	t	\N	\N	\N
111		2026-01-21 14:56:43	54.247.57.0	Mozilla/5.0 (X11; Linux x86_64; rv:83.0) Gecko/20100101 Firefox/83.0	http://short.tzzrdeck.me/	base_url	f	\N	\N	\N
112		2026-01-21 14:56:43	54.247.57.0	Mozilla/5.0 (X11; Linux x86_64; rv:83.0) Gecko/20100101 Firefox/83.0	http://short.tzzrdeck.me/	base_url	f	\N	\N	\N
113	http://short.tzzrdeck.me	2026-01-21 16:09:24	34.125.86.0	Mozilla/5.0 (compatible; CMS-Checker/1.0; +https://example.com)	http://short.tzzrdeck.me/	base_url	t	\N	\N	\N
114		2026-01-21 18:49:07	23.27.145.0	Mozilla/5.0 (X11; Linux i686; rv:109.0) Gecko/20100101 Firefox/120.0	http://short.tzzrdeck.me/	base_url	f	\N	\N	\N
115		2026-01-21 20:48:18	84.254.106.0	Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Mobile Safari/537.36	http://short.tzzrdeck.me/	base_url	f	\N	\N	\N
116		2026-01-22 02:10:06	3.101.28.0	Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36	http://short.tzzrdeck.me/	base_url	f	\N	\N	\N
117		2026-01-22 02:10:07	3.101.28.0	Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36	http://short.tzzrdeck.me/_next/data	regular_404	f	\N	\N	\N
118		2026-01-22 02:10:07	3.101.28.0	Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36	http://short.tzzrdeck.me/api/action	regular_404	f	\N	\N	\N
119		2026-01-22 02:10:08	3.101.28.0	Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36	http://short.tzzrdeck.me/api/actions	regular_404	f	\N	\N	\N
120		2026-01-22 02:10:08	3.101.28.0	Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36	http://short.tzzrdeck.me/api/auth	regular_404	f	\N	\N	\N
121		2026-01-22 02:10:09	3.101.28.0	Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36	http://short.tzzrdeck.me/api/v1	regular_404	f	\N	\N	\N
122		2026-01-22 02:10:10	3.101.28.0	Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36	http://short.tzzrdeck.me/api/v2	regular_404	f	\N	\N	\N
123		2026-01-22 02:10:12	3.101.28.0	python-httpx/0.28.1	http://short.tzzrdeck.me/.git/config/.git/git/config/.env	regular_404	t	\N	\N	\N
124		2026-01-22 02:10:12	3.101.28.0	python-httpx/0.28.1	http://short.tzzrdeck.me/.env.local	invalid_short_url	t	\N	\N	\N
125		2026-01-22 02:10:13	3.101.28.0	python-httpx/0.28.1	http://short.tzzrdeck.me/.env.production	invalid_short_url	t	\N	\N	\N
126		2026-01-22 02:10:14	3.101.28.0	python-httpx/0.28.1	http://short.tzzrdeck.me/.env.development	invalid_short_url	t	\N	\N	\N
127		2026-01-22 02:10:14	3.101.28.0	python-httpx/0.28.1	http://short.tzzrdeck.me/.env.staging	invalid_short_url	t	\N	\N	\N
128		2026-01-22 02:10:15	3.101.28.0	python-httpx/0.28.1	http://short.tzzrdeck.me/.env.prod	invalid_short_url	t	\N	\N	\N
129		2026-01-22 02:10:15	3.101.28.0	python-httpx/0.28.1	http://short.tzzrdeck.me/.env.dev	invalid_short_url	t	\N	\N	\N
130		2026-01-22 02:10:16	3.101.28.0	python-httpx/0.28.1	http://short.tzzrdeck.me/.env.test	invalid_short_url	t	\N	\N	\N
131		2026-01-22 02:10:16	3.101.28.0	python-httpx/0.28.1	http://short.tzzrdeck.me/.env.backup	invalid_short_url	t	\N	\N	\N
132		2026-01-22 02:10:17	3.101.28.0	python-httpx/0.28.1	http://short.tzzrdeck.me/.env.old	invalid_short_url	t	\N	\N	\N
133		2026-01-22 02:10:17	3.101.28.0	python-httpx/0.28.1	http://short.tzzrdeck.me/.env.bak	invalid_short_url	t	\N	\N	\N
134		2026-01-22 02:10:18	3.101.28.0	python-httpx/0.28.1	http://short.tzzrdeck.me/.env.save	invalid_short_url	t	\N	\N	\N
135		2026-01-22 02:10:19	3.101.28.0	python-httpx/0.28.1	http://short.tzzrdeck.me/api/.env	regular_404	t	\N	\N	\N
136		2026-01-22 02:10:19	3.101.28.0	python-httpx/0.28.1	http://short.tzzrdeck.me/app/.env	regular_404	t	\N	\N	\N
137		2026-01-22 02:10:20	3.101.28.0	python-httpx/0.28.1	http://short.tzzrdeck.me/backend/.env	regular_404	t	\N	\N	\N
138		2026-01-22 02:10:20	3.101.28.0	python-httpx/0.28.1	http://short.tzzrdeck.me/frontend/.env	regular_404	t	\N	\N	\N
139		2026-01-22 02:10:21	3.101.28.0	python-httpx/0.28.1	http://short.tzzrdeck.me/server/.env	regular_404	t	\N	\N	\N
140		2026-01-22 02:10:21	3.101.28.0	python-httpx/0.28.1	http://short.tzzrdeck.me/src/.env	regular_404	t	\N	\N	\N
141		2026-01-22 02:10:22	3.101.28.0	python-httpx/0.28.1	http://short.tzzrdeck.me/config/.env	regular_404	t	\N	\N	\N
142		2026-01-22 02:10:23	3.101.28.0	python-httpx/0.28.1	http://short.tzzrdeck.me/admin/.env	regular_404	t	\N	\N	\N
143		2026-01-22 02:10:23	3.101.28.0	python-httpx/0.28.1	http://short.tzzrdeck.me/core/.env	regular_404	t	\N	\N	\N
144		2026-01-22 02:10:24	3.101.28.0	python-httpx/0.28.1	http://short.tzzrdeck.me/public/.env	regular_404	t	\N	\N	\N
145		2026-01-22 02:10:24	3.101.28.0	python-httpx/0.28.1	http://short.tzzrdeck.me/web/.env	regular_404	t	\N	\N	\N
146		2026-01-22 02:10:25	3.101.28.0	python-httpx/0.28.1	http://short.tzzrdeck.me/laravel/.env	regular_404	t	\N	\N	\N
147		2026-01-22 02:10:26	3.101.28.0	python-httpx/0.28.1	http://short.tzzrdeck.me/payment/.env	regular_404	t	\N	\N	\N
148		2026-01-22 02:10:26	3.101.28.0	python-httpx/0.28.1	http://short.tzzrdeck.me/payments/.env	regular_404	t	\N	\N	\N
149		2026-01-22 02:10:27	3.101.28.0	python-httpx/0.28.1	http://short.tzzrdeck.me/stripe/.env	regular_404	t	\N	\N	\N
150		2026-01-22 02:10:27	3.101.28.0	python-httpx/0.28.1	http://short.tzzrdeck.me/mail/.env	regular_404	t	\N	\N	\N
151		2026-01-22 02:10:28	3.101.28.0	python-httpx/0.28.1	http://short.tzzrdeck.me/mailer/.env	regular_404	t	\N	\N	\N
152		2026-01-22 02:10:28	3.101.28.0	python-httpx/0.28.1	http://short.tzzrdeck.me/sendgrid/.env	regular_404	t	\N	\N	\N
153		2026-01-22 02:10:29	3.101.28.0	python-httpx/0.28.1	http://short.tzzrdeck.me/smtp/.env	regular_404	t	\N	\N	\N
154		2026-01-22 02:10:29	3.101.28.0	python-httpx/0.28.1	http://short.tzzrdeck.me/service/.env	regular_404	t	\N	\N	\N
155		2026-01-22 02:10:30	3.101.28.0	python-httpx/0.28.1	http://short.tzzrdeck.me/services/.env	regular_404	t	\N	\N	\N
156		2026-01-22 02:10:30	3.101.28.0	python-httpx/0.28.1	http://short.tzzrdeck.me/portal/.env	regular_404	t	\N	\N	\N
157		2026-01-22 02:10:31	3.101.28.0	python-httpx/0.28.1	http://short.tzzrdeck.me/dashboard/.env	regular_404	t	\N	\N	\N
158		2026-01-22 02:10:32	3.101.28.0	python-httpx/0.28.1	http://short.tzzrdeck.me/panel/.env	regular_404	t	\N	\N	\N
159		2026-01-22 02:10:32	3.101.28.0	python-httpx/0.28.1	http://short.tzzrdeck.me/shop/.env	regular_404	t	\N	\N	\N
161		2026-01-22 02:10:33	3.101.28.0	python-httpx/0.28.1	http://short.tzzrdeck.me/	base_url	t	\N	\N	\N
162		2026-01-22 02:10:34	3.101.28.0	Mozilla/5.0 (Windows NT 10.0; Win64; x64) Chrome/120.0.0.0 Safari/537.36	http://short.tzzrdeck.me/	base_url	f	\N	\N	\N
163	http://short.tzzrdeck.me	2026-01-22 13:48:52	35.227.43.0	Mozilla/5.0 (compatible; CMS-Checker/1.0; +https://example.com)	http://short.tzzrdeck.me/	base_url	t	\N	\N	\N
164		2026-01-22 17:00:47	3.143.22.0	Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36 Assetnote/1.0.0	http://short.tzzrdeck.me/	base_url	f	\N	\N	\N
165		2026-01-22 17:00:48	3.143.22.0	Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36 Assetnote/1.0.0	http://short.tzzrdeck.me/api/action	regular_404	f	\N	\N	\N
166		2026-01-22 17:00:48	3.143.22.0	Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36 Assetnote/1.0.0	http://short.tzzrdeck.me/api/actions	regular_404	f	\N	\N	\N
167		2026-01-22 17:00:48	3.143.22.0	Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36 Assetnote/1.0.0	http://short.tzzrdeck.me/_next/data	regular_404	f	\N	\N	\N
168		2026-01-22 17:00:48	3.143.22.0	Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36 Assetnote/1.0.0	http://short.tzzrdeck.me/	base_url	f	\N	\N	\N
169		2026-01-22 20:32:39	149.57.180.0	Mozilla/5.0 (X11; Linux i686; rv:109.0) Gecko/20100101 Firefox/120.0	http://short.tzzrdeck.me/	base_url	f	\N	\N	\N
170		2026-01-23 05:07:53	45.61.151.0	Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36	http://short.tzzrdeck.me/	base_url	f	\N	\N	\N
171		2026-01-23 13:08:21	84.254.106.0	Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Mobile Safari/537.36	http://short.tzzrdeck.me/	base_url	f	\N	\N	\N
172		2026-01-23 13:08:27	84.254.106.0	Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Mobile Safari/537.36	http://short.tzzrdeck.me/css/support_parent.css	regular_404	f	\N	\N	\N
173		2026-01-23 13:08:29	84.254.106.0	Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Mobile Safari/537.36	http://short.tzzrdeck.me/js/twint_ch.js	regular_404	f	\N	\N	\N
174		2026-01-23 14:45:02	139.59.40.0	Mozilla/5.0 (X11; Linux x86_64; rv:142.0) Gecko/20100101 Firefox/142.0	http://short.tzzrdeck.me/	base_url	f	\N	\N	\N
175		2026-01-23 15:44:51	23.27.145.0	Mozilla/5.0 (X11; Linux i686; rv:109.0) Gecko/20100101 Firefox/120.0	http://short.tzzrdeck.me/	base_url	f	\N	\N	\N
176	http://short.tzzrdeck.me	2026-01-23 16:18:50	34.29.29.0	Mozilla/5.0 (compatible; CMS-Checker/1.0; +https://example.com)	http://short.tzzrdeck.me/	base_url	t	\N	\N	\N
177		2026-01-23 19:21:23	149.57.180.0	Mozilla/5.0 (X11; Linux i686; rv:109.0) Gecko/20100101 Firefox/120.0	http://short.tzzrdeck.me/	base_url	f	\N	\N	\N
178		2026-01-24 13:48:18	167.94.138.0	Mozilla/5.0 (compatible; CensysInspect/1.1; +https://about.censys.io/)	http://shlink.tzzrdeck.me/	base_url	t	\N	\N	\N
179		2026-01-25 02:56:49	69.62.126.0	curl/8.5.0	http://shlink.tzzrdeck.me/	base_url	t	\N	\N	\N
180		2026-01-26 13:12:28	43.228.125.0	Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36	http://shlink.tzzrdeck.me/	base_url	f	\N	\N	\N
181		2026-01-27 09:37:50	3.209.212.0	Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36	http://shlink.tzzrdeck.me/	base_url	f	\N	\N	\N
182		2026-01-27 09:55:02	103.77.192.0	Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.2 Safari/605.1.15	http://shlink.tzzrdeck.me/server/tzzr-shlink-short.tzzrdeck.me	regular_404	f	\N	\N	\N
183	https://shlink.tzzrdeck.me/	2026-01-27 09:55:02	103.77.192.0	Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.2 Safari/605.1.15	http://shlink.tzzrdeck.me/service-worker.js	invalid_short_url	f	\N	\N	\N
184	https://shlink.tzzrdeck.me/	2026-01-27 09:55:04	103.77.192.0	Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.2 Safari/605.1.15	http://shlink.tzzrdeck.me/service-worker.js	invalid_short_url	f	\N	\N	\N
185		2026-01-28 18:17:29	117.72.11.0	Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36	http://shlink.tzzrdeck.me/	base_url	f	\N	\N	\N
186		2026-01-28 18:17:30	117.72.11.0	Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36	http://shlink.tzzrdeck.me/wp-json/wc/v3	regular_404	f	\N	\N	\N
187		2026-01-28 18:17:30	117.72.11.0	Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36	http://shlink.tzzrdeck.me/magento_version	invalid_short_url	f	\N	\N	\N
188		2026-01-28 18:17:30	117.72.11.0	Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36	http://shlink.tzzrdeck.me/index.php?route=checkout/cart	invalid_short_url	f	\N	\N	\N
189		2026-01-28 18:17:30	117.72.11.0	Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36	http://shlink.tzzrdeck.me/index.php?route=account/register	invalid_short_url	f	\N	\N	\N
190		2026-01-28 18:17:30	117.72.11.0	Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36	http://shlink.tzzrdeck.me/index.php?route=account/login	invalid_short_url	f	\N	\N	\N
191		2026-01-28 18:17:31	117.72.11.0	Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36	http://shlink.tzzrdeck.me/index.php?route=checkout/checkout	invalid_short_url	f	\N	\N	\N
192		2026-01-28 18:17:31	117.72.11.0	Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36	http://shlink.tzzrdeck.me/admin/	regular_404	f	\N	\N	\N
193		2026-01-28 18:17:31	117.72.11.0	Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36	http://shlink.tzzrdeck.me/wp-json/	regular_404	f	\N	\N	\N
194		2026-01-29 22:31:10	198.235.24.0	Hello from Palo Alto Networks, find out more about our scans in https://docs-cortex.paloaltonetworks.com/r/1/Cortex-Xpanse/Scanning-activity	http://shlink.tzzrdeck.me/	base_url	f	\N	\N	\N
195		2026-01-31 21:59:40	167.94.138.0	Mozilla/5.0 (compatible; CensysInspect/1.1; +https://about.censys.io/)	http://shlink.tzzrdeck.me/	base_url	t	\N	\N	\N
196		2026-02-01 03:49:08	198.235.24.0	Hello from Palo Alto Networks, find out more about our scans in https://docs-cortex.paloaltonetworks.com/r/1/Cortex-Xpanse/Scanning-activity	http://shlink.tzzrdeck.me/	base_url	f	\N	\N	\N
197	http://shlink.tzzrdeck.me	2026-02-03 10:40:41	34.76.165.0	Mozilla/5.0 (compatible; CMS-Checker/1.0; +https://example.com)	http://shlink.tzzrdeck.me/	base_url	t	\N	\N	\N
198	http://shlink.tzzrdeck.me	2026-02-03 18:31:03	35.224.144.0	Mozilla/5.0 (compatible; CMS-Checker/1.0; +https://example.com)	http://shlink.tzzrdeck.me/	base_url	t	\N	\N	\N
199		2026-02-06 13:14:41	137.184.167.0	Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36	http://shlink.tzzrdeck.me/	base_url	f	\N	\N	\N
200		2026-02-08 04:36:51	162.142.125.0	Mozilla/5.0 (compatible; CensysInspect/1.1; +https://about.censys.io/)	http://shlink.tzzrdeck.me/	base_url	t	\N	\N	\N
201		2026-02-09 07:51:11	84.233.212.0	Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3	http://shlink.tzzrdeck.me/	base_url	f	\N	\N	\N
202		2026-02-09 07:51:13	84.233.212.0	Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3	http://shlink.tzzrdeck.me/phpinfo.php	invalid_short_url	f	\N	\N	\N
203		2026-02-09 07:51:15	84.233.212.0	Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3	http://shlink.tzzrdeck.me/test.php	invalid_short_url	f	\N	\N	\N
204		2026-02-09 07:51:17	84.233.212.0	Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3	http://shlink.tzzrdeck.me/_profiler/phpinfo	regular_404	f	\N	\N	\N
205		2026-02-09 07:51:19	84.233.212.0	Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3	http://shlink.tzzrdeck.me/.env	invalid_short_url	f	\N	\N	\N
206		2026-02-09 07:51:21	84.233.212.0	Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3	http://shlink.tzzrdeck.me/db.sql	invalid_short_url	f	\N	\N	\N
207		2026-02-09 07:51:22	84.233.212.0	Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3	http://shlink.tzzrdeck.me/dump.sql	invalid_short_url	f	\N	\N	\N
208		2026-02-09 07:51:24	84.233.212.0	Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3	http://shlink.tzzrdeck.me/database.sql	invalid_short_url	f	\N	\N	\N
209		2026-02-09 07:51:26	84.233.212.0	Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3	http://shlink.tzzrdeck.me/backup.sql	invalid_short_url	f	\N	\N	\N
210		2026-02-09 07:51:28	84.233.212.0	Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3	http://shlink.tzzrdeck.me/config/db.sql	regular_404	f	\N	\N	\N
211		2026-02-09 07:51:30	84.233.212.0	Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3	http://shlink.tzzrdeck.me/sql/db.sql	regular_404	f	\N	\N	\N
212		2026-02-09 07:51:32	84.233.212.0	Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3	http://shlink.tzzrdeck.me/data/dump.sql	regular_404	f	\N	\N	\N
213		2026-02-09 07:51:33	84.233.212.0	Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3	http://shlink.tzzrdeck.me/backups/database.sql	regular_404	f	\N	\N	\N
214		2026-02-09 07:51:35	84.233.212.0	Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3	http://shlink.tzzrdeck.me/mysql.sql	invalid_short_url	f	\N	\N	\N
215		2026-02-09 07:51:37	84.233.212.0	Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3	http://shlink.tzzrdeck.me/db_backup.sql	invalid_short_url	f	\N	\N	\N
216		2026-02-09 10:22:06	84.233.212.0	Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3	http://shlink.tzzrdeck.me/	base_url	f	\N	\N	\N
217		2026-02-09 10:22:08	84.233.212.0	Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3	http://shlink.tzzrdeck.me/phpinfo.php	invalid_short_url	f	\N	\N	\N
218		2026-02-09 10:22:11	84.233.212.0	Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3	http://shlink.tzzrdeck.me/test.php	invalid_short_url	f	\N	\N	\N
219		2026-02-09 10:22:13	84.233.212.0	Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3	http://shlink.tzzrdeck.me/_profiler/phpinfo	regular_404	f	\N	\N	\N
220		2026-02-09 10:22:15	84.233.212.0	Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3	http://shlink.tzzrdeck.me/.env	invalid_short_url	f	\N	\N	\N
221		2026-02-09 10:22:17	84.233.212.0	Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3	http://shlink.tzzrdeck.me/db.sql	invalid_short_url	f	\N	\N	\N
222		2026-02-09 10:22:19	84.233.212.0	Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3	http://shlink.tzzrdeck.me/dump.sql	invalid_short_url	f	\N	\N	\N
223		2026-02-09 10:22:20	84.233.212.0	Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3	http://shlink.tzzrdeck.me/database.sql	invalid_short_url	f	\N	\N	\N
224		2026-02-09 10:22:22	84.233.212.0	Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3	http://shlink.tzzrdeck.me/backup.sql	invalid_short_url	f	\N	\N	\N
225		2026-02-09 10:22:24	84.233.212.0	Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3	http://shlink.tzzrdeck.me/config/db.sql	regular_404	f	\N	\N	\N
226		2026-02-09 10:22:26	84.233.212.0	Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3	http://shlink.tzzrdeck.me/sql/db.sql	regular_404	f	\N	\N	\N
227		2026-02-09 10:22:28	84.233.212.0	Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3	http://shlink.tzzrdeck.me/data/dump.sql	regular_404	f	\N	\N	\N
228		2026-02-09 10:22:30	84.233.212.0	Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3	http://shlink.tzzrdeck.me/backups/database.sql	regular_404	f	\N	\N	\N
229		2026-02-09 10:22:31	84.233.212.0	Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3	http://shlink.tzzrdeck.me/mysql.sql	invalid_short_url	f	\N	\N	\N
230		2026-02-09 10:22:34	84.233.212.0	Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3	http://shlink.tzzrdeck.me/db_backup.sql	invalid_short_url	f	\N	\N	\N
231		2026-02-09 21:07:11	3.252.237.0	Mozilla/5.0 (compatible; NetcraftSurveyAgent/1.0; +info@netcraft.com)	http://shlink.tzzrdeck.me/	base_url	t	\N	\N	\N
232	http://shlink.tzzrdeck.me	2026-02-10 17:52:52	35.232.78.0	Mozilla/5.0 (compatible; CMS-Checker/1.0; +https://example.com)	http://shlink.tzzrdeck.me/	base_url	t	\N	\N	\N
233	http://shlink.tzzrdeck.me	2026-02-12 11:29:54	136.118.180.0	Mozilla/5.0 (compatible; CMS-Checker/1.0; +https://example.com)	http://shlink.tzzrdeck.me/	base_url	t	\N	\N	\N
234	http://shlink.tzzrdeck.me	2026-02-12 19:07:27	34.121.229.0	Mozilla/5.0 (compatible; CMS-Checker/1.0; +https://example.com)	http://shlink.tzzrdeck.me/	base_url	t	\N	\N	\N
235		2026-02-13 06:13:34	52.215.234.0	Mozilla/5.0 (compatible; NetcraftSurveyAgent/1.0; +info@netcraft.com)	http://shlink.tzzrdeck.me/	base_url	t	\N	\N	\N
236	http://shlink.tzzrdeck.me	2026-02-13 15:52:50	34.134.13.0	Mozilla/5.0 (compatible; CMS-Checker/1.0; +https://example.com)	http://shlink.tzzrdeck.me/	base_url	t	\N	\N	\N
237		2026-02-15 07:36:58	174.138.80.0	Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36	http://shlink.tzzrdeck.me/	base_url	f	\N	\N	\N
238		2026-02-15 10:13:13	167.94.138.0	Mozilla/5.0 (compatible; CensysInspect/1.1; +https://about.censys.io/)	http://shlink.tzzrdeck.me/	base_url	t	\N	\N	\N
239		2026-02-18 09:33:05	45.148.10.0	Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 Chrome/122.0.0.0 Safari/537.36	http://shlink.tzzrdeck.me/	base_url	f	\N	\N	\N
240		2026-02-20 11:24:59	\N	curl/8.4.0	http://shlink.tzzrdeck.me/.git/config	regular_404	t	\N	\N	\N
241		2026-02-23 04:39:39	167.94.138.0	Mozilla/5.0 (compatible; CensysInspect/1.1; +https://about.censys.io/)	http://shlink.tzzrdeck.me/	base_url	t	\N	\N	\N
242		2026-02-23 18:41:47	69.62.126.0	curl/8.5.0	http://shlink.tzzrdeck.me/	base_url	t	\N	\N	\N
243		2026-02-26 02:09:28	34.91.212.0	Scrapy/2.13.4 (+https://scrapy.org)	http://shlink.tzzrdeck.me/	base_url	t	\N	\N	\N
244	http://shlink.tzzrdeck.me	2026-02-26 15:37:02	136.119.236.0	Mozilla/5.0 (compatible; CMS-Checker/1.0; +https://example.com)	http://shlink.tzzrdeck.me/	base_url	t	\N	\N	\N
245		2026-02-26 18:43:41	69.62.126.0	curl/8.5.0	http://shlink.tzzrdeck.me/	base_url	t	\N	\N	\N
246		2026-02-26 23:26:57	72.62.1.0	curl/7.81.0	http://shlink.tzzrdeck.me/	base_url	t	\N	\N	\N
247		2026-02-27 15:19:27	69.62.126.0	curl/8.5.0	http://shlink.tzzrdeck.me/	base_url	t	\N	\N	\N
248	http://shlink.tzzrdeck.me	2026-02-27 16:29:35	35.192.51.0	Mozilla/5.0 (compatible; CMS-Checker/1.0; +https://example.com)	http://shlink.tzzrdeck.me/	base_url	t	\N	\N	\N
249		2026-02-28 03:01:39	3.221.83.0	Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36	http://shlink.tzzrdeck.me/	base_url	f	\N	\N	\N
250	http://shlink.tzzrdeck.me	2026-03-01 13:40:52	104.154.95.0	Mozilla/5.0 (compatible; CMS-Checker/1.0; +https://example.com)	http://shlink.tzzrdeck.me/	base_url	t	\N	\N	\N
\.


--
-- Name: api_key_roles_id_seq; Type: SEQUENCE SET; Schema: public; Owner: tzzr
--

SELECT pg_catalog.setval('public.api_key_roles_id_seq', 1, false);


--
-- Name: api_keys_id_seq; Type: SEQUENCE SET; Schema: public; Owner: tzzr
--

SELECT pg_catalog.setval('public.api_keys_id_seq', 1, true);


--
-- Name: domains_id_seq; Type: SEQUENCE SET; Schema: public; Owner: tzzr
--

SELECT pg_catalog.setval('public.domains_id_seq', 1, false);


--
-- Name: geolocation_db_updates_id_seq; Type: SEQUENCE SET; Schema: public; Owner: tzzr
--

SELECT pg_catalog.setval('public.geolocation_db_updates_id_seq', 1, false);


--
-- Name: orphan_visits_counts_id_seq; Type: SEQUENCE SET; Schema: public; Owner: tzzr
--

SELECT pg_catalog.setval('public.orphan_visits_counts_id_seq', 250, true);


--
-- Name: redirect_conditions_id_seq; Type: SEQUENCE SET; Schema: public; Owner: tzzr
--

SELECT pg_catalog.setval('public.redirect_conditions_id_seq', 1, false);


--
-- Name: short_url_redirect_rules_id_seq; Type: SEQUENCE SET; Schema: public; Owner: tzzr
--

SELECT pg_catalog.setval('public.short_url_redirect_rules_id_seq', 1, false);


--
-- Name: short_url_visits_counts_id_seq; Type: SEQUENCE SET; Schema: public; Owner: tzzr
--

SELECT pg_catalog.setval('public.short_url_visits_counts_id_seq', 1, false);


--
-- Name: short_urls_id_seq; Type: SEQUENCE SET; Schema: public; Owner: tzzr
--

SELECT pg_catalog.setval('public.short_urls_id_seq', 1, true);


--
-- Name: tags_id_seq; Type: SEQUENCE SET; Schema: public; Owner: tzzr
--

SELECT pg_catalog.setval('public.tags_id_seq', 1, false);


--
-- Name: visit_locations_id_seq; Type: SEQUENCE SET; Schema: public; Owner: tzzr
--

SELECT pg_catalog.setval('public.visit_locations_id_seq', 1, false);


--
-- Name: visits_id_seq; Type: SEQUENCE SET; Schema: public; Owner: tzzr
--

SELECT pg_catalog.setval('public.visits_id_seq', 250, true);


--
-- Name: api_key_roles api_key_roles_pkey; Type: CONSTRAINT; Schema: public; Owner: tzzr
--

ALTER TABLE ONLY public.api_key_roles
    ADD CONSTRAINT api_key_roles_pkey PRIMARY KEY (id);


--
-- Name: api_keys api_keys_pkey; Type: CONSTRAINT; Schema: public; Owner: tzzr
--

ALTER TABLE ONLY public.api_keys
    ADD CONSTRAINT api_keys_pkey PRIMARY KEY (id);


--
-- Name: domains domains_pkey; Type: CONSTRAINT; Schema: public; Owner: tzzr
--

ALTER TABLE ONLY public.domains
    ADD CONSTRAINT domains_pkey PRIMARY KEY (id);


--
-- Name: geolocation_db_updates geolocation_db_updates_pkey; Type: CONSTRAINT; Schema: public; Owner: tzzr
--

ALTER TABLE ONLY public.geolocation_db_updates
    ADD CONSTRAINT geolocation_db_updates_pkey PRIMARY KEY (id);


--
-- Name: migrations migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: tzzr
--

ALTER TABLE ONLY public.migrations
    ADD CONSTRAINT migrations_pkey PRIMARY KEY (version);


--
-- Name: orphan_visits_counts orphan_visits_counts_pkey; Type: CONSTRAINT; Schema: public; Owner: tzzr
--

ALTER TABLE ONLY public.orphan_visits_counts
    ADD CONSTRAINT orphan_visits_counts_pkey PRIMARY KEY (id);


--
-- Name: redirect_conditions_in_short_url_redirect_rules redirect_conditions_in_short_url_redirect_rules_pkey; Type: CONSTRAINT; Schema: public; Owner: tzzr
--

ALTER TABLE ONLY public.redirect_conditions_in_short_url_redirect_rules
    ADD CONSTRAINT redirect_conditions_in_short_url_redirect_rules_pkey PRIMARY KEY (short_url_redirect_rule_id, redirect_condition_id);


--
-- Name: redirect_conditions redirect_conditions_pkey; Type: CONSTRAINT; Schema: public; Owner: tzzr
--

ALTER TABLE ONLY public.redirect_conditions
    ADD CONSTRAINT redirect_conditions_pkey PRIMARY KEY (id);


--
-- Name: short_url_redirect_rules short_url_redirect_rules_pkey; Type: CONSTRAINT; Schema: public; Owner: tzzr
--

ALTER TABLE ONLY public.short_url_redirect_rules
    ADD CONSTRAINT short_url_redirect_rules_pkey PRIMARY KEY (id);


--
-- Name: short_url_visits_counts short_url_visits_counts_pkey; Type: CONSTRAINT; Schema: public; Owner: tzzr
--

ALTER TABLE ONLY public.short_url_visits_counts
    ADD CONSTRAINT short_url_visits_counts_pkey PRIMARY KEY (id);


--
-- Name: short_urls_in_tags short_urls_in_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: tzzr
--

ALTER TABLE ONLY public.short_urls_in_tags
    ADD CONSTRAINT short_urls_in_tags_pkey PRIMARY KEY (short_url_id, tag_id);


--
-- Name: short_urls short_urls_pkey; Type: CONSTRAINT; Schema: public; Owner: tzzr
--

ALTER TABLE ONLY public.short_urls
    ADD CONSTRAINT short_urls_pkey PRIMARY KEY (id);


--
-- Name: tags tags_pkey; Type: CONSTRAINT; Schema: public; Owner: tzzr
--

ALTER TABLE ONLY public.tags
    ADD CONSTRAINT tags_pkey PRIMARY KEY (id);


--
-- Name: visit_locations visit_locations_pkey; Type: CONSTRAINT; Schema: public; Owner: tzzr
--

ALTER TABLE ONLY public.visit_locations
    ADD CONSTRAINT visit_locations_pkey PRIMARY KEY (id);


--
-- Name: visits visits_pkey; Type: CONSTRAINT; Schema: public; Owner: tzzr
--

ALTER TABLE ONLY public.visits
    ADD CONSTRAINT visits_pkey PRIMARY KEY (id);


--
-- Name: idx_28e514e3f1252bc8; Type: INDEX; Schema: public; Owner: tzzr
--

CREATE INDEX idx_28e514e3f1252bc8 ON public.short_url_visits_counts USING btree (short_url_id);


--
-- Name: idx_29d4f6738be312b3; Type: INDEX; Schema: public; Owner: tzzr
--

CREATE INDEX idx_29d4f6738be312b3 ON public.api_key_roles USING btree (api_key_id);


--
-- Name: idx_444839ea8297882e; Type: INDEX; Schema: public; Owner: tzzr
--

CREATE INDEX idx_444839ea8297882e ON public.visits USING btree (visit_location_id);


--
-- Name: idx_444839eaf1252bc8; Type: INDEX; Schema: public; Owner: tzzr
--

CREATE INDEX idx_444839eaf1252bc8 ON public.visits USING btree (short_url_id);


--
-- Name: idx_448348bcf1252bc8; Type: INDEX; Schema: public; Owner: tzzr
--

CREATE INDEX idx_448348bcf1252bc8 ON public.short_url_redirect_rules USING btree (short_url_id);


--
-- Name: idx_4a53f934115f0ee5; Type: INDEX; Schema: public; Owner: tzzr
--

CREATE INDEX idx_4a53f934115f0ee5 ON public.short_urls USING btree (domain_id);


--
-- Name: idx_4a53f934c9ea6e08; Type: INDEX; Schema: public; Owner: tzzr
--

CREATE INDEX idx_4a53f934c9ea6e08 ON public.short_urls USING btree (author_api_key_id);


--
-- Name: idx_59775203bad26311; Type: INDEX; Schema: public; Owner: tzzr
--

CREATE INDEX idx_59775203bad26311 ON public.short_urls_in_tags USING btree (tag_id);


--
-- Name: idx_59775203f1252bc8; Type: INDEX; Schema: public; Owner: tzzr
--

CREATE INDEX idx_59775203f1252bc8 ON public.short_urls_in_tags USING btree (short_url_id);


--
-- Name: idx_62cf4fa49ae7732e; Type: INDEX; Schema: public; Owner: tzzr
--

CREATE INDEX idx_62cf4fa49ae7732e ON public.redirect_conditions_in_short_url_redirect_rules USING btree (redirect_condition_id);


--
-- Name: idx_62cf4fa4be19b441; Type: INDEX; Schema: public; Owner: tzzr
--

CREATE INDEX idx_62cf4fa4be19b441 ON public.redirect_conditions_in_short_url_redirect_rules USING btree (short_url_redirect_rule_id);


--
-- Name: idx_geolocation_date_updated; Type: INDEX; Schema: public; Owner: tzzr
--

CREATE INDEX idx_geolocation_date_updated ON public.geolocation_db_updates USING btree (date_updated);


--
-- Name: idx_geolocation_status_filesystem; Type: INDEX; Schema: public; Owner: tzzr
--

CREATE INDEX idx_geolocation_status_filesystem ON public.geolocation_db_updates USING btree (filesystem_id);


--
-- Name: idx_visits_date; Type: INDEX; Schema: public; Owner: tzzr
--

CREATE INDEX idx_visits_date ON public.visits USING btree (date);


--
-- Name: uniq_6fbc94265e237e06; Type: INDEX; Schema: public; Owner: tzzr
--

CREATE UNIQUE INDEX uniq_6fbc94265e237e06 ON public.tags USING btree (name);


--
-- Name: uniq_8c7bbf9d4af96afc; Type: INDEX; Schema: public; Owner: tzzr
--

CREATE UNIQUE INDEX uniq_8c7bbf9d4af96afc ON public.domains USING btree (authority);


--
-- Name: uniq_9579321ff48571eb; Type: INDEX; Schema: public; Owner: tzzr
--

CREATE UNIQUE INDEX uniq_9579321ff48571eb ON public.api_keys USING btree (key);


--
-- Name: unique_short_code_plus_domain; Type: INDEX; Schema: public; Owner: tzzr
--

CREATE UNIQUE INDEX unique_short_code_plus_domain ON public.short_urls USING btree (short_code, domain_id);


--
-- Name: uq_role_plus_api_key; Type: INDEX; Schema: public; Owner: tzzr
--

CREATE UNIQUE INDEX uq_role_plus_api_key ON public.api_key_roles USING btree (role_name, api_key_id);


--
-- Name: uq_slot; Type: INDEX; Schema: public; Owner: tzzr
--

CREATE UNIQUE INDEX uq_slot ON public.orphan_visits_counts USING btree (potential_bot, slot_id);


--
-- Name: uq_slot_per_short_url; Type: INDEX; Schema: public; Owner: tzzr
--

CREATE UNIQUE INDEX uq_slot_per_short_url ON public.short_url_visits_counts USING btree (short_url_id, potential_bot, slot_id);


--
-- Name: visits_potential_bot_idx; Type: INDEX; Schema: public; Owner: tzzr
--

CREATE INDEX visits_potential_bot_idx ON public.visits USING btree (potential_bot);


--
-- Name: short_url_visits_counts fk_28e514e3f1252bc8; Type: FK CONSTRAINT; Schema: public; Owner: tzzr
--

ALTER TABLE ONLY public.short_url_visits_counts
    ADD CONSTRAINT fk_28e514e3f1252bc8 FOREIGN KEY (short_url_id) REFERENCES public.short_urls(id) ON DELETE CASCADE;


--
-- Name: api_key_roles fk_29d4f6738be312b3; Type: FK CONSTRAINT; Schema: public; Owner: tzzr
--

ALTER TABLE ONLY public.api_key_roles
    ADD CONSTRAINT fk_29d4f6738be312b3 FOREIGN KEY (api_key_id) REFERENCES public.api_keys(id) ON DELETE CASCADE;


--
-- Name: visits fk_444839ea8297882e; Type: FK CONSTRAINT; Schema: public; Owner: tzzr
--

ALTER TABLE ONLY public.visits
    ADD CONSTRAINT fk_444839ea8297882e FOREIGN KEY (visit_location_id) REFERENCES public.visit_locations(id) ON DELETE SET NULL;


--
-- Name: visits fk_444839eaf1252bc8; Type: FK CONSTRAINT; Schema: public; Owner: tzzr
--

ALTER TABLE ONLY public.visits
    ADD CONSTRAINT fk_444839eaf1252bc8 FOREIGN KEY (short_url_id) REFERENCES public.short_urls(id) ON DELETE CASCADE;


--
-- Name: short_url_redirect_rules fk_448348bcf1252bc8; Type: FK CONSTRAINT; Schema: public; Owner: tzzr
--

ALTER TABLE ONLY public.short_url_redirect_rules
    ADD CONSTRAINT fk_448348bcf1252bc8 FOREIGN KEY (short_url_id) REFERENCES public.short_urls(id) ON DELETE CASCADE;


--
-- Name: short_urls fk_4a53f934115f0ee5; Type: FK CONSTRAINT; Schema: public; Owner: tzzr
--

ALTER TABLE ONLY public.short_urls
    ADD CONSTRAINT fk_4a53f934115f0ee5 FOREIGN KEY (domain_id) REFERENCES public.domains(id) ON DELETE RESTRICT;


--
-- Name: short_urls fk_4a53f934c9ea6e08; Type: FK CONSTRAINT; Schema: public; Owner: tzzr
--

ALTER TABLE ONLY public.short_urls
    ADD CONSTRAINT fk_4a53f934c9ea6e08 FOREIGN KEY (author_api_key_id) REFERENCES public.api_keys(id) ON DELETE SET NULL;


--
-- Name: short_urls_in_tags fk_59775203bad26311; Type: FK CONSTRAINT; Schema: public; Owner: tzzr
--

ALTER TABLE ONLY public.short_urls_in_tags
    ADD CONSTRAINT fk_59775203bad26311 FOREIGN KEY (tag_id) REFERENCES public.tags(id) ON DELETE CASCADE;


--
-- Name: short_urls_in_tags fk_59775203f1252bc8; Type: FK CONSTRAINT; Schema: public; Owner: tzzr
--

ALTER TABLE ONLY public.short_urls_in_tags
    ADD CONSTRAINT fk_59775203f1252bc8 FOREIGN KEY (short_url_id) REFERENCES public.short_urls(id) ON DELETE CASCADE;


--
-- Name: redirect_conditions_in_short_url_redirect_rules fk_62cf4fa49ae7732e; Type: FK CONSTRAINT; Schema: public; Owner: tzzr
--

ALTER TABLE ONLY public.redirect_conditions_in_short_url_redirect_rules
    ADD CONSTRAINT fk_62cf4fa49ae7732e FOREIGN KEY (redirect_condition_id) REFERENCES public.redirect_conditions(id) ON DELETE CASCADE;


--
-- Name: redirect_conditions_in_short_url_redirect_rules fk_62cf4fa4be19b441; Type: FK CONSTRAINT; Schema: public; Owner: tzzr
--

ALTER TABLE ONLY public.redirect_conditions_in_short_url_redirect_rules
    ADD CONSTRAINT fk_62cf4fa4be19b441 FOREIGN KEY (short_url_redirect_rule_id) REFERENCES public.short_url_redirect_rules(id) ON DELETE CASCADE;


--
--

\unrestrict 30JjzYeDC4yFh3ATEGQzMcCXdREnQy6LPJ82fFntWe3dYufbcf7HW3wccnTozeq

--
-- Database "tzzr" dump
--

--
--

\restrict ybTwzMIeusKrHKvb37lHmMLDf7s3KVWGLJSYUHp9Y7D0BksfXQAZArCYbT1ZMsm


SELECT pg_catalog.set_config('search_path', '', false);

--
-- Name: tzzr; Type: DATABASE; Schema: -; Owner: tzzr
--

CREATE DATABASE tzzr WITH TEMPLATE = template0 ENCODING = 'UTF8' LOCALE_PROVIDER = libc LC_COLLATE = 'C' LC_CTYPE = 'C.UTF-8';


ALTER DATABASE tzzr OWNER TO tzzr;

\unrestrict ybTwzMIeusKrHKvb37lHmMLDf7s3KVWGLJSYUHp9Y7D0BksfXQAZArCYbT1ZMsm
\connect tzzr
\restrict ybTwzMIeusKrHKvb37lHmMLDf7s3KVWGLJSYUHp9Y7D0BksfXQAZArCYbT1ZMsm

SELECT pg_catalog.set_config('search_path', '', false);

--
-- Name: tzzr; Type: DATABASE PROPERTIES; Schema: -; Owner: tzzr
--

ALTER DATABASE tzzr SET search_path TO 'tzzr_core_hst', 'tzzr_core_itm_base', 'tzzr_core_secretaria', 'tzzr_core_oracle', 'tzzr_core_contabilidad', 'tzzr_core_administracion', 'tzzr_core_produccion', 'public';


\unrestrict ybTwzMIeusKrHKvb37lHmMLDf7s3KVWGLJSYUHp9Y7D0BksfXQAZArCYbT1ZMsm
\connect tzzr
\restrict ybTwzMIeusKrHKvb37lHmMLDf7s3KVWGLJSYUHp9Y7D0BksfXQAZArCYbT1ZMsm

SELECT pg_catalog.set_config('search_path', '', false);

--
-- Name: cto; Type: SCHEMA; Schema: -; Owner: tzzr
--

CREATE SCHEMA cto;


ALTER SCHEMA cto OWNER TO tzzr;

--
-- Name: production_alfred; Type: SCHEMA; Schema: -; Owner: postgres
--

CREATE SCHEMA production_alfred;


ALTER SCHEMA production_alfred OWNER TO postgres;

--
-- Name: public; Type: SCHEMA; Schema: -; Owner: postgres
--

-- *not* creating schema, since initdb creates it


ALTER SCHEMA public OWNER TO postgres;

--
-- Name: SCHEMA public; Type: COMMENT; Schema: -; Owner: postgres
--

COMMENT ON SCHEMA public IS '';


--
-- Name: tzzr_ai; Type: SCHEMA; Schema: -; Owner: postgres
--

CREATE SCHEMA tzzr_ai;


ALTER SCHEMA tzzr_ai OWNER TO postgres;

--
-- Name: tzzr_chat_ai; Type: SCHEMA; Schema: -; Owner: tzzr
--

CREATE SCHEMA tzzr_chat_ai;


ALTER SCHEMA tzzr_chat_ai OWNER TO tzzr;

--
-- Name: tzzr_communications; Type: SCHEMA; Schema: -; Owner: postgres
--

CREATE SCHEMA tzzr_communications;


ALTER SCHEMA tzzr_communications OWNER TO postgres;

--
-- Name: tzzr_communications_ai; Type: SCHEMA; Schema: -; Owner: postgres
--

CREATE SCHEMA tzzr_communications_ai;


ALTER SCHEMA tzzr_communications_ai OWNER TO postgres;

--
-- Name: tzzr_communications_str; Type: SCHEMA; Schema: -; Owner: tzzr
--

CREATE SCHEMA tzzr_communications_str;


ALTER SCHEMA tzzr_communications_str OWNER TO tzzr;

--
-- Name: tzzr_connection; Type: SCHEMA; Schema: -; Owner: tzzr
--

CREATE SCHEMA tzzr_connection;


ALTER SCHEMA tzzr_connection OWNER TO tzzr;

--
-- Name: tzzr_core_administracion; Type: SCHEMA; Schema: -; Owner: postgres
--

CREATE SCHEMA tzzr_core_administracion;


ALTER SCHEMA tzzr_core_administracion OWNER TO postgres;

--
-- Name: tzzr_core_contabilidad; Type: SCHEMA; Schema: -; Owner: postgres
--

CREATE SCHEMA tzzr_core_contabilidad;


ALTER SCHEMA tzzr_core_contabilidad OWNER TO postgres;

--
-- Name: tzzr_core_hst; Type: SCHEMA; Schema: -; Owner: postgres
--

CREATE SCHEMA tzzr_core_hst;


ALTER SCHEMA tzzr_core_hst OWNER TO postgres;

--
-- Name: tzzr_core_itm_base; Type: SCHEMA; Schema: -; Owner: postgres
--

CREATE SCHEMA tzzr_core_itm_base;


ALTER SCHEMA tzzr_core_itm_base OWNER TO postgres;

--
-- Name: tzzr_core_oracle; Type: SCHEMA; Schema: -; Owner: postgres
--

CREATE SCHEMA tzzr_core_oracle;


ALTER SCHEMA tzzr_core_oracle OWNER TO postgres;

--
-- Name: tzzr_core_produccion; Type: SCHEMA; Schema: -; Owner: postgres
--

CREATE SCHEMA tzzr_core_produccion;


ALTER SCHEMA tzzr_core_produccion OWNER TO postgres;

--
-- Name: tzzr_core_secretaria; Type: SCHEMA; Schema: -; Owner: postgres
--

CREATE SCHEMA tzzr_core_secretaria;


ALTER SCHEMA tzzr_core_secretaria OWNER TO postgres;

--
-- Name: tzzr_iachat; Type: SCHEMA; Schema: -; Owner: tzzr
--

CREATE SCHEMA tzzr_iachat;


ALTER SCHEMA tzzr_iachat OWNER TO tzzr;

--
-- Name: tzzr_list; Type: SCHEMA; Schema: -; Owner: tzzr
--

CREATE SCHEMA tzzr_list;


ALTER SCHEMA tzzr_list OWNER TO tzzr;

--
-- Name: tzzr_storage; Type: SCHEMA; Schema: -; Owner: postgres
--

CREATE SCHEMA tzzr_storage;


ALTER SCHEMA tzzr_storage OWNER TO postgres;

--
-- Name: tzzr_system; Type: SCHEMA; Schema: -; Owner: postgres
--

CREATE SCHEMA tzzr_system;


ALTER SCHEMA tzzr_system OWNER TO postgres;

--
-- Name: usr; Type: SCHEMA; Schema: -; Owner: postgres
--

CREATE SCHEMA usr;


ALTER SCHEMA usr OWNER TO postgres;

--
-- Name: pgcrypto; Type: EXTENSION; Schema: -; Owner: -
--

CREATE EXTENSION IF NOT EXISTS pgcrypto WITH SCHEMA tzzr_core_hst;


--
-- Name: EXTENSION pgcrypto; Type: COMMENT; Schema: -; Owner: 
--

COMMENT ON EXTENSION pgcrypto IS 'cryptographic functions';


--
-- Name: vector; Type: EXTENSION; Schema: -; Owner: -
--

CREATE EXTENSION IF NOT EXISTS vector WITH SCHEMA tzzr_core_hst;


--
-- Name: EXTENSION vector; Type: COMMENT; Schema: -; Owner: 
--

COMMENT ON EXTENSION vector IS 'vector data type and ivfflat and hnsw access methods';


--
-- Name: auto_weight_new_message(); Type: FUNCTION; Schema: cto; Owner: tzzr
--

CREATE FUNCTION cto.auto_weight_new_message() RETURNS trigger
    LANGUAGE plpgsql
    AS $$ DECLARE gestor_uuid UUID; BEGIN SELECT uuid INTO gestor_uuid FROM cto.players WHERE type = 'gestor' AND name = 'CTO Gestor' LIMIT 1; INSERT INTO cto.context_weights (thread_uuid, target_type, target_uuid, weight, reason, assigned_by) VALUES (NEW.thread_uuid, 'message', NEW.uuid, 1.00, 'Peso inicial automático', gestor_uuid); RETURN NEW; END; $$;


ALTER FUNCTION cto.auto_weight_new_message() OWNER TO tzzr;

--
-- Name: get_context(uuid, integer); Type: FUNCTION; Schema: cto; Owner: tzzr
--

CREATE FUNCTION cto.get_context(p_thread_uuid uuid, p_max_tokens integer DEFAULT 100000) RETURNS TABLE(item_type character varying, item_uuid uuid, content text, weight numeric, tokens integer)
    LANGUAGE plpgsql
    AS $$
BEGIN
    RETURN QUERY
    SELECT
        m.message_type::VARCHAR AS item_type,
        m.uuid AS item_uuid,
        m.content,
        COALESCE(w.weight, 0.50) AS weight,
        COALESCE(m.tokens_out, length(m.content)/4)::INTEGER AS tokens
    FROM cto.messages m
    LEFT JOIN LATERAL (
        SELECT cw.weight
        FROM cto.context_weights cw
        WHERE cw.target_uuid = m.uuid AND cw.target_type = 'message'
        ORDER BY cw.created_at DESC LIMIT 1
    ) w ON true
    WHERE m.thread_uuid = p_thread_uuid
      AND COALESCE(w.weight, 0.50) > 0.00

    UNION ALL

    SELECT
        'document'::VARCHAR AS item_type,
        d.uuid AS item_uuid,
        d.context_index AS content,
        COALESCE(w.weight, 0.50) AS weight,
        (length(d.context_index)/4)::INTEGER AS tokens
    FROM cto.thread_documents d
    LEFT JOIN LATERAL (
        SELECT cw.weight
        FROM cto.context_weights cw
        WHERE cw.target_uuid = d.uuid AND cw.target_type = 'document'
        ORDER BY cw.created_at DESC LIMIT 1
    ) w ON true
    WHERE d.thread_uuid = p_thread_uuid
      AND COALESCE(w.weight, 0.50) > 0.00

    ORDER BY weight DESC
    LIMIT p_max_tokens / 100;
END;
$$;


ALTER FUNCTION cto.get_context(p_thread_uuid uuid, p_max_tokens integer) OWNER TO tzzr;

--
-- Name: list_documents(uuid, boolean); Type: FUNCTION; Schema: cto; Owner: tzzr
--

CREATE FUNCTION cto.list_documents(p_thread_uuid uuid, p_include_obsolete boolean DEFAULT true) RETURNS TABLE(uuid uuid, source character varying, path text, context_index text, added_by uuid, weight numeric, created_at timestamp with time zone)
    LANGUAGE plpgsql
    AS $$
BEGIN
    RETURN QUERY
    SELECT
        d.uuid,
        d.source::VARCHAR,
        d.path,
        d.context_index,
        d.added_by,
        COALESCE(w.weight, 0.50) AS weight,
        d.created_at
    FROM cto.thread_documents d
    LEFT JOIN LATERAL (
        SELECT cw.weight
        FROM cto.context_weights cw
        WHERE cw.target_uuid = d.uuid AND cw.target_type = 'document'
        ORDER BY cw.created_at DESC LIMIT 1
    ) w ON true
    WHERE d.thread_uuid = p_thread_uuid
      AND (p_include_obsolete OR COALESCE(w.weight, 0.50) > 0.00)
    ORDER BY d.created_at DESC;
END;
$$;


ALTER FUNCTION cto.list_documents(p_thread_uuid uuid, p_include_obsolete boolean) OWNER TO tzzr;

--
-- Name: prevent_delete(); Type: FUNCTION; Schema: cto; Owner: tzzr
--

CREATE FUNCTION cto.prevent_delete() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
    RAISE EXCEPTION 'DELETE no permitido en tabla inmutable %', TG_TABLE_NAME;
END;
$$;


ALTER FUNCTION cto.prevent_delete() OWNER TO tzzr;

--
-- Name: prevent_update(); Type: FUNCTION; Schema: cto; Owner: tzzr
--

CREATE FUNCTION cto.prevent_update() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
    RAISE EXCEPTION 'UPDATE no permitido en tabla inmutable %', TG_TABLE_NAME;
END;
$$;


ALTER FUNCTION cto.prevent_update() OWNER TO tzzr;

--
-- Name: mth_delete(); Type: FUNCTION; Schema: production_alfred; Owner: postgres
--

CREATE FUNCTION production_alfred.mth_delete() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
  DELETE FROM tzzr_core_itm_base.ply WHERE mrf = OLD.mrf;
  RETURN OLD;
END;
$$;


ALTER FUNCTION production_alfred.mth_delete() OWNER TO postgres;

--
-- Name: mth_insert(); Type: FUNCTION; Schema: production_alfred; Owner: postgres
--

CREATE FUNCTION production_alfred.mth_insert() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
  INSERT INTO tzzr_core_itm_base.ply (mrf, ref, alias, name_es, name_en, txt, set_hst, owner, jsonb_data)
  VALUES (
    encode(sha256(('mth_' || COALESCE(NEW.alias, 'new') || '_' || now()::text)::bytea), 'hex'),
    COALESCE(NEW.ref, substring(NEW.alias from 1 for 4)),
    NEW.alias,
    NEW.name_es,
    NEW.name_en,
    NEW.description,
    '54f57ce4e0a8fda28cb965edb974b63bdfcb882293320a3ec3a00518daec5f06',
    COALESCE(NEW.owner, '{"name": "system"}'::jsonb),
    jsonb_build_object(
      'wm_path', NEW.wm_path,
      'wm_workspace', COALESCE(NEW.wm_workspace, 'deck'),
      'wm_type', COALESCE(NEW.wm_type, 'script'),
      'trigger_type', COALESCE(NEW.trigger_type, 'manual'),
      'trigger_config', COALESCE(NEW.trigger_config, '{}'::jsonb),
      'input_schema', COALESCE(NEW.input_schema, '{}'::jsonb),
      'output_schema', COALESCE(NEW.output_schema, '{}'::jsonb),
      'timeout_ms', COALESCE(NEW.timeout_ms, 300000),
      'retry_policy', COALESCE(NEW.retry_policy, '{"max_retries": 0}'::jsonb),
      'dependencies', COALESCE(NEW.dependencies, '[]'::jsonb),
      'enabled', COALESCE(NEW.enabled, true),
      'updated_at', now()
    )
  );
  RETURN NEW;
END;
$$;


ALTER FUNCTION production_alfred.mth_insert() OWNER TO postgres;

--
-- Name: mth_update(); Type: FUNCTION; Schema: production_alfred; Owner: postgres
--

CREATE FUNCTION production_alfred.mth_update() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
  UPDATE tzzr_core_itm_base.ply SET
    alias = COALESCE(NEW.alias, OLD.alias),
    name_es = COALESCE(NEW.name_es, OLD.name_es),
    name_en = COALESCE(NEW.name_en, OLD.name_en),
    txt = COALESCE(NEW.description, OLD.description),
    jsonb_data = jsonb_data
      || jsonb_build_object('updated_at', now())
      || CASE WHEN NEW.wm_path IS DISTINCT FROM OLD.wm_path AND NEW.wm_path IS NOT NULL
              THEN jsonb_build_object('wm_path', NEW.wm_path) ELSE '{}'::jsonb END
      || CASE WHEN NEW.wm_type IS DISTINCT FROM OLD.wm_type AND NEW.wm_type IS NOT NULL
              THEN jsonb_build_object('wm_type', NEW.wm_type) ELSE '{}'::jsonb END
      || CASE WHEN NEW.wm_workspace IS DISTINCT FROM OLD.wm_workspace AND NEW.wm_workspace IS NOT NULL
              THEN jsonb_build_object('wm_workspace', NEW.wm_workspace) ELSE '{}'::jsonb END
      || CASE WHEN NEW.trigger_type IS DISTINCT FROM OLD.trigger_type AND NEW.trigger_type IS NOT NULL
              THEN jsonb_build_object('trigger_type', NEW.trigger_type) ELSE '{}'::jsonb END
      || CASE WHEN NEW.trigger_config IS DISTINCT FROM OLD.trigger_config AND NEW.trigger_config IS NOT NULL
              THEN jsonb_build_object('trigger_config', NEW.trigger_config) ELSE '{}'::jsonb END
      || CASE WHEN NEW.timeout_ms IS DISTINCT FROM OLD.timeout_ms AND NEW.timeout_ms IS NOT NULL
              THEN jsonb_build_object('timeout_ms', NEW.timeout_ms) ELSE '{}'::jsonb END
      || CASE WHEN NEW.enabled IS DISTINCT FROM OLD.enabled AND NEW.enabled IS NOT NULL
              THEN jsonb_build_object('enabled', NEW.enabled) ELSE '{}'::jsonb END
      || CASE WHEN NEW.input_schema IS DISTINCT FROM OLD.input_schema AND NEW.input_schema IS NOT NULL
              THEN jsonb_build_object('input_schema', NEW.input_schema) ELSE '{}'::jsonb END
      || CASE WHEN NEW.output_schema IS DISTINCT FROM OLD.output_schema AND NEW.output_schema IS NOT NULL
              THEN jsonb_build_object('output_schema', NEW.output_schema) ELSE '{}'::jsonb END
      || CASE WHEN NEW.retry_policy IS DISTINCT FROM OLD.retry_policy AND NEW.retry_policy IS NOT NULL
              THEN jsonb_build_object('retry_policy', NEW.retry_policy) ELSE '{}'::jsonb END
      || CASE WHEN NEW.dependencies IS DISTINCT FROM OLD.dependencies AND NEW.dependencies IS NOT NULL
              THEN jsonb_build_object('dependencies', NEW.dependencies) ELSE '{}'::jsonb END
  WHERE mrf = OLD.mrf;
  RETURN NEW;
END;
$$;


ALTER FUNCTION production_alfred.mth_update() OWNER TO postgres;

--
-- Name: alias_stats(); Type: FUNCTION; Schema: tzzr_communications; Owner: postgres
--

CREATE FUNCTION tzzr_communications.alias_stats() RETURNS TABLE(alias character varying, destino character varying, descripcion text, uso_total integer, ultimo_uso timestamp without time zone, activo boolean)
    LANGUAGE plpgsql
    AS $$
BEGIN
    RETURN QUERY
    SELECT a.alias::VARCHAR, a.destino::VARCHAR, a.descripcion,
           a.contador_uso, a.ultimo_uso, a.activo
    FROM tzzr_communications.mail_aliases a
    ORDER BY a.contador_uso DESC;
END;
$$;


ALTER FUNCTION tzzr_communications.alias_stats() OWNER TO postgres;

--
-- Name: list_recent_mail(character varying, integer); Type: FUNCTION; Schema: tzzr_communications; Owner: postgres
--

CREATE FUNCTION tzzr_communications.list_recent_mail(p_account character varying, p_limit integer DEFAULT 20) RETURNS TABLE(uuid uuid, mrf character varying, from_addr character varying, subject character varying, created_at timestamp with time zone, read boolean, starred boolean)
    LANGUAGE plpgsql
    AS $$
BEGIN
    RETURN QUERY
    SELECT m.uuid, m.mrf::VARCHAR, m.from_address::VARCHAR, m.subject::VARCHAR,
           m.created_at, m.read, m.starred
    FROM tzzr_communications.mail m
    WHERE m.account = p_account AND m.folder = 'inbox'
    ORDER BY m.created_at DESC LIMIT p_limit;
END;
$$;


ALTER FUNCTION tzzr_communications.list_recent_mail(p_account character varying, p_limit integer) OWNER TO postgres;

--
-- Name: search_mail(character varying, text); Type: FUNCTION; Schema: tzzr_communications; Owner: postgres
--

CREATE FUNCTION tzzr_communications.search_mail(p_account character varying, p_query text) RETURNS TABLE(uuid uuid, mrf character varying, from_addr character varying, subject character varying, snippet text, created_at timestamp with time zone)
    LANGUAGE plpgsql
    AS $$
BEGIN
    RETURN QUERY
    SELECT m.uuid, m.mrf::VARCHAR, m.from_address::VARCHAR, m.subject::VARCHAR,
           LEFT(m.body, 200), m.created_at
    FROM tzzr_communications.mail m
    WHERE m.account = p_account
      AND (m.subject ILIKE '%' || p_query || '%'
           OR m.body ILIKE '%' || p_query || '%'
           OR m.from_address ILIKE '%' || p_query || '%')
    ORDER BY m.created_at DESC LIMIT 50;
END;
$$;


ALTER FUNCTION tzzr_communications.search_mail(p_account character varying, p_query text) OWNER TO postgres;

--
-- Name: worm(); Type: FUNCTION; Schema: tzzr_communications; Owner: postgres
--

CREATE FUNCTION tzzr_communications.worm() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
    RAISE EXCEPTION '% not allowed on WORM table %', TG_OP, TG_TABLE_NAME;
END;
$$;


ALTER FUNCTION tzzr_communications.worm() OWNER TO postgres;

--
-- Name: update_updated_at(); Type: FUNCTION; Schema: tzzr_communications_str; Owner: tzzr
--

CREATE FUNCTION tzzr_communications_str.update_updated_at() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
    NEW.updated_at = now();
    RETURN NEW;
END;
$$;


ALTER FUNCTION tzzr_communications_str.update_updated_at() OWNER TO tzzr;

--
-- Name: actualizar_hst_usados(); Type: FUNCTION; Schema: tzzr_core_hst; Owner: postgres
--

CREATE FUNCTION tzzr_core_hst.actualizar_hst_usados() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
DECLARE
    v_tabla VARCHAR;
BEGIN
    v_tabla := TG_TABLE_SCHEMA || '.' || TG_TABLE_NAME;
    
    -- Añadir set_hst al array si no existe
    IF NEW.set_hst IS NOT NULL THEN
        UPDATE tzzr_core_hst.hst_rules 
        SET hst_usados = ARRAY(SELECT DISTINCT unnest(hst_usados || ARRAY[NEW.set_hst]))
        WHERE tabla = v_tabla 
          AND NOT (NEW.set_hst = ANY(hst_usados));
    END IF;
    
    RETURN NEW;
END;
$$;


ALTER FUNCTION tzzr_core_hst.actualizar_hst_usados() OWNER TO postgres;

--
-- Name: api_children(character varying); Type: FUNCTION; Schema: tzzr_core_hst; Owner: postgres
--

CREATE FUNCTION tzzr_core_hst.api_children(parent_mrf character varying) RETURNS TABLE(mrf character varying, ref character varying, name_es character varying, name_en character varying, img_thumb_url character varying)
    LANGUAGE sql STABLE
    AS $$
SELECT h.mrf, h.ref, h.name_es, h.name_en, h.img_thumb_url
FROM tzzr_core_hst.tree_hst t
JOIN tzzr_core_hst.hst h ON h.mrf = t.mrf_child
WHERE t.mrf_parent = parent_mrf
ORDER BY h.name_es;
$$;


ALTER FUNCTION tzzr_core_hst.api_children(parent_mrf character varying) OWNER TO postgres;

--
-- Name: api_related(character varying); Type: FUNCTION; Schema: tzzr_core_hst; Owner: postgres
--

CREATE FUNCTION tzzr_core_hst.api_related(tag_mrf character varying) RETURNS TABLE(mrf character varying, ref character varying, name_es character varying, name_en character varying, img_thumb_url character varying, edge_type character varying, weight double precision)
    LANGUAGE sql STABLE
    AS $$
SELECT h.mrf, h.ref, h.name_es, h.name_en, h.img_thumb_url, g.edge_type, g.weight
FROM tzzr_core_hst.graph_hst g
JOIN tzzr_core_hst.hst h ON (g.mrf_b = h.mrf AND g.mrf_a = tag_mrf) OR (g.mrf_a = h.mrf AND g.mrf_b = tag_mrf)
ORDER BY g.weight DESC;
$$;


ALTER FUNCTION tzzr_core_hst.api_related(tag_mrf character varying) OWNER TO postgres;

--
-- Name: validar_set_hst(); Type: FUNCTION; Schema: tzzr_core_hst; Owner: postgres
--

CREATE FUNCTION tzzr_core_hst.validar_set_hst() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
DECLARE
    v_permitidos VARCHAR[];
    v_tabla VARCHAR;
BEGIN
    v_tabla := TG_TABLE_SCHEMA || '.' || TG_TABLE_NAME;
    
    SELECT hst_permitidos INTO v_permitidos
    FROM tzzr_core_hst.hst_rules 
    WHERE tabla = v_tabla;
    
    -- Si array vacío o NULL, permitir todo
    IF v_permitidos IS NULL OR array_length(v_permitidos, 1) IS NULL THEN
        RETURN NEW;
    END IF;
    
    -- Si set_hst es NULL, permitir
    IF NEW.set_hst IS NULL THEN
        RETURN NEW;
    END IF;
    
    -- Validar que set_hst esté en permitidos
    IF NOT (NEW.set_hst = ANY(v_permitidos)) THEN
        RAISE EXCEPTION 'HST % no permitido para %', NEW.set_hst, v_tabla;
    END IF;
    
    RETURN NEW;
END;
$$;


ALTER FUNCTION tzzr_core_hst.validar_set_hst() OWNER TO postgres;

--
-- Name: api_children_itm(character varying); Type: FUNCTION; Schema: tzzr_core_itm_base; Owner: postgres
--

CREATE FUNCTION tzzr_core_itm_base.api_children_itm(parent_mrf character varying) RETURNS TABLE(mrf character varying, ref character varying, name_es character varying, name_en character varying, img_thumb_url character varying)
    LANGUAGE sql STABLE
    AS $$
SELECT i.mrf, i.ref, i.name_es, i.name_en, i.img_thumb_url
FROM tzzr_core_itm_base.tree_itm t
JOIN tzzr_core_itm_base.itm i ON i.mrf = t.mrf_child
WHERE t.mrf_parent = parent_mrf
ORDER BY i.name_es;
$$;


ALTER FUNCTION tzzr_core_itm_base.api_children_itm(parent_mrf character varying) OWNER TO postgres;

--
-- Name: api_children_loc(character varying); Type: FUNCTION; Schema: tzzr_core_itm_base; Owner: postgres
--

CREATE FUNCTION tzzr_core_itm_base.api_children_loc(parent_mrf character varying) RETURNS TABLE(mrf character varying, ref character varying, name_es character varying, name_en character varying, img_thumb_url character varying)
    LANGUAGE sql STABLE
    AS $$
SELECT l.mrf, l.ref, l.name_es, l.name_en, l.img_thumb_url
FROM tzzr_core_itm_base.tree_loc t
JOIN tzzr_core_itm_base.loc l ON l.mrf = t.mrf_child
WHERE t.mrf_parent = parent_mrf
ORDER BY l.name_es;
$$;


ALTER FUNCTION tzzr_core_itm_base.api_children_loc(parent_mrf character varying) OWNER TO postgres;

--
-- Name: api_children_ply(character varying); Type: FUNCTION; Schema: tzzr_core_itm_base; Owner: postgres
--

CREATE FUNCTION tzzr_core_itm_base.api_children_ply(parent_mrf character varying) RETURNS TABLE(mrf character varying, ref character varying, name_es character varying, name_en character varying, img_thumb_url character varying)
    LANGUAGE sql STABLE
    AS $$
SELECT p.mrf, p.ref, p.name_es, p.name_en, p.img_thumb_url
FROM tzzr_core_itm_base.tree_ply t
JOIN tzzr_core_itm_base.ply p ON p.mrf = t.mrf_child
WHERE t.mrf_parent = parent_mrf
ORDER BY p.name_es;
$$;


ALTER FUNCTION tzzr_core_itm_base.api_children_ply(parent_mrf character varying) OWNER TO postgres;

--
-- Name: api_related_itm(character varying); Type: FUNCTION; Schema: tzzr_core_itm_base; Owner: postgres
--

CREATE FUNCTION tzzr_core_itm_base.api_related_itm(tag_mrf character varying) RETURNS TABLE(mrf character varying, ref character varying, name_es character varying, name_en character varying, img_thumb_url character varying, edge_type character varying, weight double precision)
    LANGUAGE sql STABLE
    AS $$
SELECT i.mrf, i.ref, i.name_es, i.name_en, i.img_thumb_url, g.edge_type, g.weight
FROM tzzr_core_itm_base.graph_itm g
JOIN tzzr_core_itm_base.itm i ON (g.mrf_b = i.mrf AND g.mrf_a = tag_mrf) OR (g.mrf_a = i.mrf AND g.mrf_b = tag_mrf)
ORDER BY g.weight DESC;
$$;


ALTER FUNCTION tzzr_core_itm_base.api_related_itm(tag_mrf character varying) OWNER TO postgres;

--
-- Name: api_related_loc(character varying); Type: FUNCTION; Schema: tzzr_core_itm_base; Owner: postgres
--

CREATE FUNCTION tzzr_core_itm_base.api_related_loc(tag_mrf character varying) RETURNS TABLE(mrf character varying, ref character varying, name_es character varying, name_en character varying, img_thumb_url character varying, edge_type character varying, weight double precision)
    LANGUAGE sql STABLE
    AS $$
SELECT l.mrf, l.ref, l.name_es, l.name_en, l.img_thumb_url, g.edge_type, g.weight
FROM tzzr_core_itm_base.graph_loc g
JOIN tzzr_core_itm_base.loc l ON (g.mrf_b = l.mrf AND g.mrf_a = tag_mrf) OR (g.mrf_a = l.mrf AND g.mrf_b = tag_mrf)
ORDER BY g.weight DESC;
$$;


ALTER FUNCTION tzzr_core_itm_base.api_related_loc(tag_mrf character varying) OWNER TO postgres;

--
-- Name: api_related_ply(character varying); Type: FUNCTION; Schema: tzzr_core_itm_base; Owner: postgres
--

CREATE FUNCTION tzzr_core_itm_base.api_related_ply(tag_mrf character varying) RETURNS TABLE(mrf character varying, ref character varying, name_es character varying, name_en character varying, img_thumb_url character varying, edge_type character varying, weight double precision)
    LANGUAGE sql STABLE
    AS $$
SELECT p.mrf, p.ref, p.name_es, p.name_en, p.img_thumb_url, g.edge_type, g.weight
FROM tzzr_core_itm_base.graph_ply g
JOIN tzzr_core_itm_base.ply p ON (g.mrf_b = p.mrf AND g.mrf_a = tag_mrf) OR (g.mrf_a = p.mrf AND g.mrf_b = tag_mrf)
ORDER BY g.weight DESC;
$$;


ALTER FUNCTION tzzr_core_itm_base.api_related_ply(tag_mrf character varying) OWNER TO postgres;

--
-- Name: message_worm(); Type: FUNCTION; Schema: tzzr_iachat; Owner: tzzr
--

CREATE FUNCTION tzzr_iachat.message_worm() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
    RAISE EXCEPTION 'messages are immutable: % not allowed', TG_OP;
END;
$$;


ALTER FUNCTION tzzr_iachat.message_worm() OWNER TO tzzr;

--
-- Name: update_threads_updated_at(); Type: FUNCTION; Schema: tzzr_iachat; Owner: tzzr
--

CREATE FUNCTION tzzr_iachat.update_threads_updated_at() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
    NEW.updated_at = now();
    RETURN NEW;
END;
$$;


ALTER FUNCTION tzzr_iachat.update_threads_updated_at() OWNER TO tzzr;

--
-- Name: update_updated_at(); Type: FUNCTION; Schema: tzzr_list; Owner: tzzr
--

CREATE FUNCTION tzzr_list.update_updated_at() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
    NEW.updated_at = now();
    RETURN NEW;
END;
$$;


ALTER FUNCTION tzzr_list.update_updated_at() OWNER TO tzzr;

--
-- Name: atc_upsert_trigger(); Type: FUNCTION; Schema: tzzr_storage; Owner: postgres
--

CREATE FUNCTION tzzr_storage.atc_upsert_trigger() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
    -- Borrar registro existente con el mismo mrf (si existe)
    DELETE FROM tzzr_storage.atc WHERE mrf = NEW.mrf;
    RETURN NEW;
END;
$$;


ALTER FUNCTION tzzr_storage.atc_upsert_trigger() OWNER TO postgres;

--
-- Name: update_updated_at_column(); Type: FUNCTION; Schema: tzzr_system; Owner: tzzr
--

CREATE FUNCTION tzzr_system.update_updated_at_column() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
    NEW.updated_at = now();
    RETURN NEW;
END;
$$;


ALTER FUNCTION tzzr_system.update_updated_at_column() OWNER TO tzzr;



--
-- Name: context_weights; Type: TABLE; Schema: cto; Owner: tzzr
--

CREATE TABLE cto.context_weights (
    uuid uuid DEFAULT gen_random_uuid() NOT NULL,
    thread_uuid uuid NOT NULL,
    target_uuid uuid NOT NULL,
    target_type character varying(20) NOT NULL,
    weight numeric(3,2) NOT NULL,
    reason text,
    assigned_by uuid,
    created_at timestamp with time zone DEFAULT now(),
    CONSTRAINT context_weights_weight_check CHECK (((weight >= 0.00) AND (weight <= 1.00)))
);


ALTER TABLE cto.context_weights OWNER TO tzzr;

--
-- Name: messages; Type: TABLE; Schema: cto; Owner: tzzr
--

CREATE TABLE cto.messages (
    uuid uuid DEFAULT gen_random_uuid() NOT NULL,
    thread_uuid uuid NOT NULL,
    prev_uuid uuid,
    sender_uuid uuid NOT NULL,
    receivers uuid[] DEFAULT '{}'::uuid[],
    role character varying(20) NOT NULL,
    message_type character varying(20) DEFAULT 'normal'::character varying,
    content text NOT NULL,
    sources uuid[] DEFAULT '{}'::uuid[],
    absorbs uuid[] DEFAULT '{}'::uuid[],
    model_id character varying(100),
    tokens_in integer,
    tokens_out integer,
    context_received uuid[] DEFAULT '{}'::uuid[],
    context_useful uuid[] DEFAULT '{}'::uuid[],
    context_irrelevant uuid[] DEFAULT '{}'::uuid[],
    feedback_notes text,
    created_at timestamp with time zone DEFAULT now()
);


ALTER TABLE cto.messages OWNER TO tzzr;

--
-- Name: players; Type: TABLE; Schema: cto; Owner: tzzr
--

CREATE TABLE cto.players (
    uuid uuid DEFAULT gen_random_uuid() NOT NULL,
    type character varying(20) NOT NULL,
    name character varying(100),
    model_id character varying(100),
    config jsonb DEFAULT '{}'::jsonb,
    created_at timestamp with time zone DEFAULT now()
);


ALTER TABLE cto.players OWNER TO tzzr;

--
-- Name: thread_documents; Type: TABLE; Schema: cto; Owner: tzzr
--

CREATE TABLE cto.thread_documents (
    uuid uuid DEFAULT gen_random_uuid() NOT NULL,
    thread_uuid uuid NOT NULL,
    source character varying(20) NOT NULL,
    path text NOT NULL,
    context_index text NOT NULL,
    added_by uuid NOT NULL,
    promoted_from uuid,
    created_at timestamp with time zone DEFAULT now()
);


ALTER TABLE cto.thread_documents OWNER TO tzzr;

--
-- Name: threads; Type: TABLE; Schema: cto; Owner: tzzr
--

CREATE TABLE cto.threads (
    uuid uuid DEFAULT gen_random_uuid() NOT NULL,
    parent_uuid uuid,
    server_id character varying(50) NOT NULL,
    name character varying(255),
    hashtags uuid[] DEFAULT '{}'::uuid[],
    status character varying(20) DEFAULT 'active'::character varying,
    created_at timestamp with time zone DEFAULT now()
);


ALTER TABLE cto.threads OWNER TO tzzr;

--
-- Name: exe; Type: TABLE; Schema: production_alfred; Owner: postgres
--

CREATE TABLE production_alfred.exe (
    num integer NOT NULL,
    mrf character varying(64) NOT NULL,
    mth_mrf character varying(64) NOT NULL,
    wm_job_id character varying(64),
    status character varying(16) DEFAULT 'pending'::character varying,
    input_data jsonb DEFAULT '{}'::jsonb,
    output_data jsonb DEFAULT '{}'::jsonb,
    error_msg text,
    started_at timestamp with time zone,
    finished_at timestamp with time zone,
    duration_ms integer,
    retry_count integer DEFAULT 0,
    parent_exe_mrf character varying(64),
    set_hst character varying(64),
    etiquetas jsonb DEFAULT '[]'::jsonb,
    created_at timestamp with time zone DEFAULT now(),
    CONSTRAINT chk_exe_status CHECK (((status)::text = ANY ((ARRAY['pending'::character varying, 'running'::character varying, 'success'::character varying, 'error'::character varying, 'cancelled'::character varying])::text[])))
);


ALTER TABLE production_alfred.exe OWNER TO postgres;

--
-- Name: exe_num_seq; Type: SEQUENCE; Schema: production_alfred; Owner: postgres
--

CREATE SEQUENCE production_alfred.exe_num_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE production_alfred.exe_num_seq OWNER TO postgres;

--
-- Name: exe_num_seq; Type: SEQUENCE OWNED BY; Schema: production_alfred; Owner: postgres
--

ALTER SEQUENCE production_alfred.exe_num_seq OWNED BY production_alfred.exe.num;


--
-- Name: ply; Type: TABLE; Schema: tzzr_core_itm_base; Owner: tzzr
--

CREATE TABLE tzzr_core_itm_base.ply (
    num integer NOT NULL,
    alias character varying(256),
    ref character varying(8) NOT NULL,
    mrf character varying(64) NOT NULL,
    private_mrf character varying(64),
    name_es character varying(128),
    name_en character varying(128),
    name_ch character varying(128),
    set_hst character varying(64),
    set_flg jsonb,
    txt text,
    hashtags jsonb,
    standard_data text,
    jsonb_data jsonb,
    version_hst_data character varying(8),
    rootref character varying(64),
    roothash jsonb,
    img_url character varying(128),
    img_thumb_url character varying(128),
    owner jsonb,
    url character varying(128),
    url_json jsonb,
    url_atc jsonb,
    date date,
    created_at timestamp with time zone DEFAULT now(),
    previous_version character varying(64)
);


ALTER TABLE tzzr_core_itm_base.ply OWNER TO tzzr;

--
-- Name: mth; Type: VIEW; Schema: production_alfred; Owner: postgres
--

CREATE VIEW production_alfred.mth AS
 SELECT p.num,
    p.mrf,
    p.alias,
    p.ref,
    p.name_es,
    p.name_en,
    p.txt AS description,
    (p.jsonb_data ->> 'wm_path'::text) AS wm_path,
    (p.jsonb_data ->> 'wm_workspace'::text) AS wm_workspace,
    (p.jsonb_data ->> 'wm_type'::text) AS wm_type,
    (p.jsonb_data ->> 'trigger_type'::text) AS trigger_type,
    (p.jsonb_data -> 'trigger_config'::text) AS trigger_config,
    (p.jsonb_data -> 'input_schema'::text) AS input_schema,
    (p.jsonb_data -> 'output_schema'::text) AS output_schema,
    ((p.jsonb_data ->> 'timeout_ms'::text))::integer AS timeout_ms,
    (p.jsonb_data -> 'retry_policy'::text) AS retry_policy,
    (p.jsonb_data -> 'dependencies'::text) AS dependencies,
    ((p.jsonb_data ->> 'enabled'::text))::boolean AS enabled,
    p.set_hst,
    p.hashtags AS etiquetas,
    p.jsonb_data,
    p.owner,
    p.created_at,
    ((p.jsonb_data ->> 'updated_at'::text))::timestamp with time zone AS updated_at
   FROM tzzr_core_itm_base.ply p
  WHERE (((p.set_hst)::text = '54f57ce4e0a8fda28cb965edb974b63bdfcb882293320a3ec3a00518daec5f06'::text) AND (p.jsonb_data ? 'wm_path'::text));


ALTER TABLE production_alfred.mth OWNER TO postgres;

--
-- Name: mth_backup_260228; Type: TABLE; Schema: production_alfred; Owner: postgres
--

CREATE TABLE production_alfred.mth_backup_260228 (
    num integer,
    mrf character varying(64),
    alias character varying(64),
    name_es character varying(128),
    name_en character varying(128),
    description text,
    wm_path character varying(256),
    wm_workspace character varying(64),
    wm_type character varying(16),
    trigger_type character varying(16),
    trigger_config jsonb,
    input_schema jsonb,
    output_schema jsonb,
    timeout_ms integer,
    retry_policy jsonb,
    dependencies jsonb,
    set_hst character varying(64),
    etiquetas jsonb,
    enabled boolean,
    created_at timestamp with time zone,
    updated_at timestamp with time zone
);


ALTER TABLE production_alfred.mth_backup_260228 OWNER TO postgres;

--
-- Name: rule_log; Type: TABLE; Schema: production_alfred; Owner: postgres
--

CREATE TABLE production_alfred.rule_log (
    num integer NOT NULL,
    rule_mrf character varying(64) NOT NULL,
    mail_mrf text,
    action_taken character varying(64),
    action_data jsonb DEFAULT '{}'::jsonb,
    executed_at timestamp with time zone DEFAULT now()
);


ALTER TABLE production_alfred.rule_log OWNER TO postgres;

--
-- Name: rule_log_num_seq; Type: SEQUENCE; Schema: production_alfred; Owner: postgres
--

CREATE SEQUENCE production_alfred.rule_log_num_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE production_alfred.rule_log_num_seq OWNER TO postgres;

--
-- Name: rule_log_num_seq; Type: SEQUENCE OWNED BY; Schema: production_alfred; Owner: postgres
--

ALTER SEQUENCE production_alfred.rule_log_num_seq OWNED BY production_alfred.rule_log.num;


--
-- Name: rules; Type: TABLE; Schema: production_alfred; Owner: postgres
--

CREATE TABLE production_alfred.rules (
    num integer NOT NULL,
    mrf character varying(64) NOT NULL,
    rule_text text,
    compiled_logic jsonb DEFAULT '{}'::jsonb,
    actions jsonb DEFAULT '{}'::jsonb,
    scope jsonb DEFAULT '{}'::jsonb,
    priority integer DEFAULT 0,
    enabled boolean DEFAULT true,
    last_run timestamp with time zone,
    matches_total integer DEFAULT 0,
    created_at timestamp with time zone DEFAULT now(),
    updated_at timestamp with time zone DEFAULT now()
);


ALTER TABLE production_alfred.rules OWNER TO postgres;

--
-- Name: rules_num_seq; Type: SEQUENCE; Schema: production_alfred; Owner: postgres
--

CREATE SEQUENCE production_alfred.rules_num_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE production_alfred.rules_num_seq OWNER TO postgres;

--
-- Name: rules_num_seq; Type: SEQUENCE OWNED BY; Schema: production_alfred; Owner: postgres
--

ALTER SEQUENCE production_alfred.rules_num_seq OWNED BY production_alfred.rules.num;


--
-- Name: ply_agent_llm_map; Type: TABLE; Schema: tzzr_core_itm_base; Owner: postgres
--

CREATE TABLE tzzr_core_itm_base.ply_agent_llm_map (
    num integer NOT NULL,
    ply_mrf character varying(64) NOT NULL,
    agent_llm_mrf character varying(64) NOT NULL,
    match_type character varying(16) NOT NULL,
    verified boolean DEFAULT false,
    created_at timestamp with time zone DEFAULT now(),
    updated_at timestamp with time zone DEFAULT now(),
    CONSTRAINT ply_agent_llm_map_match_type_check CHECK (((match_type)::text = ANY ((ARRAY['EXACTO'::character varying, 'MANUAL'::character varying, 'AUTO'::character varying])::text[])))
);


ALTER TABLE tzzr_core_itm_base.ply_agent_llm_map OWNER TO postgres;

--
-- Name: agent_llm; Type: TABLE; Schema: tzzr_iachat; Owner: tzzr
--

CREATE TABLE tzzr_iachat.agent_llm (
    num integer NOT NULL,
    mrf character varying(64) DEFAULT md5(((random())::text || (clock_timestamp())::text)) NOT NULL,
    name character varying(100) NOT NULL,
    type character varying(16) NOT NULL,
    description text,
    config jsonb DEFAULT '{}'::jsonb NOT NULL,
    pin_hash character varying(64),
    color character varying(7) DEFAULT '#6366f1'::character varying,
    icon character varying(32) DEFAULT 'terminal'::character varying,
    sort_order integer DEFAULT 0,
    is_active boolean DEFAULT true,
    created_at timestamp with time zone DEFAULT now(),
    updated_at timestamp with time zone DEFAULT now(),
    parent_mrf character varying(64),
    system_prompt text,
    terminal_whitelist_mrfs jsonb DEFAULT '[]'::jsonb,
    set_hst character varying(64),
    etiquetas jsonb DEFAULT '[]'::jsonb,
    model_mrf character varying,
    CONSTRAINT agent_llm_type_check CHECK (((type)::text = ANY ((ARRAY['terminal'::character varying, 'instruction'::character varying, 'agent'::character varying, 'node'::character varying])::text[])))
);


ALTER TABLE tzzr_iachat.agent_llm OWNER TO tzzr;

--
-- Name: COLUMN agent_llm.config; Type: COMMENT; Schema: tzzr_iachat; Owner: tzzr
--

COMMENT ON COLUMN tzzr_iachat.agent_llm.config IS 'terminal: {"command_whitelist_mrfs": ["mrf1"]}
instruction: {"system_prompt": "..."}
agent: {"provider_mrf": "...", "model": "...", "temperature": 0.7, "persona": "..."}';


--
-- Name: v_agentes_completo; Type: VIEW; Schema: public; Owner: postgres
--

CREATE VIEW public.v_agentes_completo AS
 SELECT p.ref,
    p.name_es AS ply_name,
    p.alias AS ply_alias,
    al.name AS agent_llm_name,
    al.type AS agent_type,
    m.match_type,
    m.verified AS match_verified,
    al.is_active AS agent_llm_active,
        CASE
            WHEN (al.mrf IS NULL) THEN '❌ SIN_AGENT_LLM'::text
            WHEN (al.is_active = false) THEN '⚠️ INACTIVO (revisar)'::text
            ELSE '✅ OK'::text
        END AS estado
   FROM ((tzzr_core_itm_base.ply p
     LEFT JOIN tzzr_core_itm_base.ply_agent_llm_map m ON (((m.ply_mrf)::text = (p.mrf)::text)))
     LEFT JOIN tzzr_iachat.agent_llm al ON (((al.mrf)::text = (m.agent_llm_mrf)::text)))
  WHERE ((p.set_hst)::text = '3381e85a2f70b05f30749774e729af0b95f166191f410d471638d850820dbf65'::text)
  ORDER BY p.ref;


ALTER TABLE public.v_agentes_completo OWNER TO postgres;

--
-- Name: agent; Type: VIEW; Schema: tzzr_ai; Owner: postgres
--

CREATE VIEW tzzr_ai.agent AS
 SELECT ply.num,
    ply.mrf,
    ply.alias,
    ply.ref,
    ply.name_es,
    ply.name_en,
    ply.txt,
    ply.set_hst,
    ply.hashtags,
    ply.jsonb_data,
    ply.owner,
    ply.created_at
   FROM tzzr_core_itm_base.ply
  WHERE ((ply.set_hst)::text = '3381e85a2f70b05f30749774e729af0b95f166191f410d471638d850820dbf65'::text);


ALTER TABLE tzzr_ai.agent OWNER TO postgres;

--
-- Name: agent_description; Type: TABLE; Schema: tzzr_ai; Owner: postgres
--

CREATE TABLE tzzr_ai.agent_description (
    num integer NOT NULL,
    mrf character varying(64) NOT NULL,
    agent_mrf character varying(64) NOT NULL,
    content text NOT NULL,
    version integer DEFAULT 1,
    active boolean DEFAULT true,
    model character varying(64),
    set_hst character varying(64),
    etiquetas jsonb,
    created_at timestamp with time zone DEFAULT now(),
    updated_at timestamp with time zone DEFAULT now()
);


ALTER TABLE tzzr_ai.agent_description OWNER TO postgres;

--
-- Name: agent_description_num_seq; Type: SEQUENCE; Schema: tzzr_ai; Owner: postgres
--

CREATE SEQUENCE tzzr_ai.agent_description_num_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE tzzr_ai.agent_description_num_seq OWNER TO postgres;

--
-- Name: agent_description_num_seq; Type: SEQUENCE OWNED BY; Schema: tzzr_ai; Owner: postgres
--

ALTER SEQUENCE tzzr_ai.agent_description_num_seq OWNED BY tzzr_ai.agent_description.num;


--
-- Name: dataset; Type: TABLE; Schema: tzzr_ai; Owner: postgres
--

CREATE TABLE tzzr_ai.dataset (
    num integer NOT NULL,
    mrf character varying(64) NOT NULL,
    alias character varying(256),
    txt text,
    set_hst character varying(64),
    hashtags jsonb,
    jsonb_data jsonb,
    owner jsonb,
    created_at timestamp with time zone DEFAULT now()
);


ALTER TABLE tzzr_ai.dataset OWNER TO postgres;

--
-- Name: dataset_num_seq; Type: SEQUENCE; Schema: tzzr_ai; Owner: postgres
--

CREATE SEQUENCE tzzr_ai.dataset_num_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE tzzr_ai.dataset_num_seq OWNER TO postgres;

--
-- Name: dataset_num_seq; Type: SEQUENCE OWNED BY; Schema: tzzr_ai; Owner: postgres
--

ALTER SEQUENCE tzzr_ai.dataset_num_seq OWNED BY tzzr_ai.dataset.num;


--
-- Name: library_agent; Type: TABLE; Schema: tzzr_ai; Owner: postgres
--

CREATE TABLE tzzr_ai.library_agent (
    num integer NOT NULL,
    mrf_library character varying(64) NOT NULL,
    mrf_child character varying(64) NOT NULL,
    created_at timestamp with time zone DEFAULT now()
);


ALTER TABLE tzzr_ai.library_agent OWNER TO postgres;

--
-- Name: library_agent_num_seq; Type: SEQUENCE; Schema: tzzr_ai; Owner: postgres
--

CREATE SEQUENCE tzzr_ai.library_agent_num_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE tzzr_ai.library_agent_num_seq OWNER TO postgres;

--
-- Name: library_agent_num_seq; Type: SEQUENCE OWNED BY; Schema: tzzr_ai; Owner: postgres
--

ALTER SEQUENCE tzzr_ai.library_agent_num_seq OWNED BY tzzr_ai.library_agent.num;


--
-- Name: library_model; Type: TABLE; Schema: tzzr_ai; Owner: postgres
--

CREATE TABLE tzzr_ai.library_model (
    num integer NOT NULL,
    mrf_library character varying(64) NOT NULL,
    mrf_child character varying(64) NOT NULL,
    created_at timestamp with time zone DEFAULT now()
);


ALTER TABLE tzzr_ai.library_model OWNER TO postgres;

--
-- Name: library_model_num_seq; Type: SEQUENCE; Schema: tzzr_ai; Owner: postgres
--

CREATE SEQUENCE tzzr_ai.library_model_num_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE tzzr_ai.library_model_num_seq OWNER TO postgres;

--
-- Name: library_model_num_seq; Type: SEQUENCE OWNED BY; Schema: tzzr_ai; Owner: postgres
--

ALTER SEQUENCE tzzr_ai.library_model_num_seq OWNED BY tzzr_ai.library_model.num;


--
-- Name: library_setup_agent; Type: TABLE; Schema: tzzr_ai; Owner: postgres
--

CREATE TABLE tzzr_ai.library_setup_agent (
    num integer NOT NULL,
    mrf_library character varying(64) NOT NULL,
    mrf_child character varying(64) NOT NULL,
    created_at timestamp with time zone DEFAULT now()
);


ALTER TABLE tzzr_ai.library_setup_agent OWNER TO postgres;

--
-- Name: library_setup_agent_num_seq; Type: SEQUENCE; Schema: tzzr_ai; Owner: postgres
--

CREATE SEQUENCE tzzr_ai.library_setup_agent_num_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE tzzr_ai.library_setup_agent_num_seq OWNER TO postgres;

--
-- Name: library_setup_agent_num_seq; Type: SEQUENCE OWNED BY; Schema: tzzr_ai; Owner: postgres
--

ALTER SEQUENCE tzzr_ai.library_setup_agent_num_seq OWNED BY tzzr_ai.library_setup_agent.num;


--
-- Name: library_setup_model; Type: TABLE; Schema: tzzr_ai; Owner: postgres
--

CREATE TABLE tzzr_ai.library_setup_model (
    num integer NOT NULL,
    mrf_library character varying(64) NOT NULL,
    mrf_child character varying(64) NOT NULL,
    created_at timestamp with time zone DEFAULT now()
);


ALTER TABLE tzzr_ai.library_setup_model OWNER TO postgres;

--
-- Name: library_setup_model_num_seq; Type: SEQUENCE; Schema: tzzr_ai; Owner: postgres
--

CREATE SEQUENCE tzzr_ai.library_setup_model_num_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE tzzr_ai.library_setup_model_num_seq OWNER TO postgres;

--
-- Name: library_setup_model_num_seq; Type: SEQUENCE OWNED BY; Schema: tzzr_ai; Owner: postgres
--

ALTER SEQUENCE tzzr_ai.library_setup_model_num_seq OWNED BY tzzr_ai.library_setup_model.num;


--
-- Name: model; Type: TABLE; Schema: tzzr_ai; Owner: postgres
--

CREATE TABLE tzzr_ai.model (
    num integer NOT NULL,
    mrf character varying(64) DEFAULT md5(((random())::text || (clock_timestamp())::text)) NOT NULL,
    provider_mrf character varying(64) NOT NULL,
    model_id character varying(128) NOT NULL,
    display_name character varying(100) NOT NULL,
    type character varying(16) NOT NULL,
    enabled boolean DEFAULT true,
    is_default boolean DEFAULT false,
    config jsonb DEFAULT '{}'::jsonb,
    set_hst character varying(64),
    etiquetas jsonb DEFAULT '[]'::jsonb,
    created_at timestamp with time zone DEFAULT now(),
    updated_at timestamp with time zone DEFAULT now(),
    alias character varying(256),
    hashtags jsonb
);


ALTER TABLE tzzr_ai.model OWNER TO postgres;

--
-- Name: model_num_seq; Type: SEQUENCE; Schema: tzzr_ai; Owner: postgres
--

CREATE SEQUENCE tzzr_ai.model_num_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE tzzr_ai.model_num_seq OWNER TO postgres;

--
-- Name: model_num_seq; Type: SEQUENCE OWNED BY; Schema: tzzr_ai; Owner: postgres
--

ALTER SEQUENCE tzzr_ai.model_num_seq OWNED BY tzzr_ai.model.num;


--
-- Name: model_usage; Type: TABLE; Schema: tzzr_ai; Owner: postgres
--

CREATE TABLE tzzr_ai.model_usage (
    num bigint NOT NULL,
    model_mrf character varying(64) NOT NULL,
    context character varying(32) NOT NULL,
    source_mrf text,
    tokens_in integer,
    tokens_out integer,
    duration_ms integer,
    status character varying(16) DEFAULT 'success'::character varying,
    created_at timestamp with time zone DEFAULT now()
);


ALTER TABLE tzzr_ai.model_usage OWNER TO postgres;

--
-- Name: model_usage_num_seq; Type: SEQUENCE; Schema: tzzr_ai; Owner: postgres
--

CREATE SEQUENCE tzzr_ai.model_usage_num_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE tzzr_ai.model_usage_num_seq OWNER TO postgres;

--
-- Name: model_usage_num_seq; Type: SEQUENCE OWNED BY; Schema: tzzr_ai; Owner: postgres
--

ALTER SEQUENCE tzzr_ai.model_usage_num_seq OWNED BY tzzr_ai.model_usage.num;


--
-- Name: provider; Type: TABLE; Schema: tzzr_ai; Owner: postgres
--

CREATE TABLE tzzr_ai.provider (
    num integer NOT NULL,
    mrf character varying(64) DEFAULT md5(((random())::text || (clock_timestamp())::text)) NOT NULL,
    name character varying(100) NOT NULL,
    service character varying(32) NOT NULL,
    endpoint text NOT NULL,
    api_key_id integer,
    format character varying(16) DEFAULT 'openai'::character varying,
    is_active boolean DEFAULT true,
    config jsonb DEFAULT '{}'::jsonb,
    set_hst character varying(64),
    etiquetas jsonb DEFAULT '[]'::jsonb,
    created_at timestamp with time zone DEFAULT now(),
    updated_at timestamp with time zone DEFAULT now(),
    alias character varying(256),
    hashtags jsonb
);


ALTER TABLE tzzr_ai.provider OWNER TO postgres;

--
-- Name: provider_num_seq; Type: SEQUENCE; Schema: tzzr_ai; Owner: postgres
--

CREATE SEQUENCE tzzr_ai.provider_num_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE tzzr_ai.provider_num_seq OWNER TO postgres;

--
-- Name: provider_num_seq; Type: SEQUENCE OWNED BY; Schema: tzzr_ai; Owner: postgres
--

ALTER SEQUENCE tzzr_ai.provider_num_seq OWNED BY tzzr_ai.provider.num;


--
-- Name: setup; Type: TABLE; Schema: tzzr_ai; Owner: postgres
--

CREATE TABLE tzzr_ai.setup (
    num integer NOT NULL,
    mrf character varying(64) DEFAULT md5(((random())::text || (clock_timestamp())::text)) NOT NULL,
    ref character varying(32) NOT NULL,
    name character varying(128) NOT NULL,
    color character varying(16) DEFAULT '#818cf8'::character varying,
    sort_order integer DEFAULT 0,
    is_active boolean DEFAULT true,
    created_at timestamp with time zone DEFAULT now()
);


ALTER TABLE tzzr_ai.setup OWNER TO postgres;

--
-- Name: setup_num_seq; Type: SEQUENCE; Schema: tzzr_ai; Owner: postgres
--

CREATE SEQUENCE tzzr_ai.setup_num_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE tzzr_ai.setup_num_seq OWNER TO postgres;

--
-- Name: setup_num_seq; Type: SEQUENCE OWNED BY; Schema: tzzr_ai; Owner: postgres
--

ALTER SEQUENCE tzzr_ai.setup_num_seq OWNED BY tzzr_ai.setup.num;


--
-- Name: actions; Type: TABLE; Schema: tzzr_chat_ai; Owner: postgres
--

CREATE TABLE tzzr_chat_ai.actions (
    num integer NOT NULL,
    mrf character varying(64) DEFAULT md5(((random())::text || (clock_timestamp())::text)) NOT NULL,
    session_mrf character varying(64) NOT NULL,
    action_type character varying(32) NOT NULL,
    title text,
    description text,
    priority character varying(16) DEFAULT 'medium'::character varying,
    status character varying(16) DEFAULT 'pending'::character varying,
    set_hst character varying(64),
    etiquetas jsonb DEFAULT '[]'::jsonb,
    created_at timestamp with time zone DEFAULT now(),
    completed_at timestamp with time zone,
    CONSTRAINT actions_priority_check CHECK (((priority)::text = ANY ((ARRAY['low'::character varying, 'medium'::character varying, 'high'::character varying, 'urgent'::character varying])::text[]))),
    CONSTRAINT actions_status_check CHECK (((status)::text = ANY ((ARRAY['pending'::character varying, 'in_progress'::character varying, 'completed'::character varying, 'cancelled'::character varying])::text[])))
);


ALTER TABLE tzzr_chat_ai.actions OWNER TO postgres;

--
-- Name: actions_num_seq; Type: SEQUENCE; Schema: tzzr_chat_ai; Owner: postgres
--

CREATE SEQUENCE tzzr_chat_ai.actions_num_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE tzzr_chat_ai.actions_num_seq OWNER TO postgres;

--
-- Name: actions_num_seq; Type: SEQUENCE OWNED BY; Schema: tzzr_chat_ai; Owner: postgres
--

ALTER SEQUENCE tzzr_chat_ai.actions_num_seq OWNED BY tzzr_chat_ai.actions.num;


--
-- Name: curated_context; Type: TABLE; Schema: tzzr_chat_ai; Owner: postgres
--

CREATE TABLE tzzr_chat_ai.curated_context (
    num integer NOT NULL,
    mrf character varying(64) DEFAULT md5(((random())::text || (clock_timestamp())::text)) NOT NULL,
    title character varying(300) NOT NULL,
    content text NOT NULL,
    source_session_mrfs jsonb DEFAULT '[]'::jsonb,
    tags jsonb DEFAULT '[]'::jsonb,
    quality_score integer,
    set_hst character varying(64),
    etiquetas jsonb DEFAULT '[]'::jsonb,
    created_at timestamp with time zone DEFAULT now(),
    updated_at timestamp with time zone DEFAULT now(),
    CONSTRAINT curated_context_quality_score_check CHECK (((quality_score >= 1) AND (quality_score <= 5)))
);


ALTER TABLE tzzr_chat_ai.curated_context OWNER TO postgres;

--
-- Name: curated_context_num_seq; Type: SEQUENCE; Schema: tzzr_chat_ai; Owner: postgres
--

CREATE SEQUENCE tzzr_chat_ai.curated_context_num_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE tzzr_chat_ai.curated_context_num_seq OWNER TO postgres;

--
-- Name: curated_context_num_seq; Type: SEQUENCE OWNED BY; Schema: tzzr_chat_ai; Owner: postgres
--

ALTER SEQUENCE tzzr_chat_ai.curated_context_num_seq OWNED BY tzzr_chat_ai.curated_context.num;


--
-- Name: embeddings; Type: TABLE; Schema: tzzr_chat_ai; Owner: postgres
--

CREATE TABLE tzzr_chat_ai.embeddings (
    num integer NOT NULL,
    session_mrf character varying(64) NOT NULL,
    message_mrf character varying(64),
    chunk_type text,
    chunk_index integer,
    chunk_text text,
    embedding tzzr_core_hst.vector(1536),
    set_hst character varying(64),
    model_used text,
    created_at timestamp with time zone DEFAULT now()
);


ALTER TABLE tzzr_chat_ai.embeddings OWNER TO postgres;

--
-- Name: embeddings_num_seq; Type: SEQUENCE; Schema: tzzr_chat_ai; Owner: postgres
--

CREATE SEQUENCE tzzr_chat_ai.embeddings_num_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE tzzr_chat_ai.embeddings_num_seq OWNER TO postgres;

--
-- Name: embeddings_num_seq; Type: SEQUENCE OWNED BY; Schema: tzzr_chat_ai; Owner: postgres
--

ALTER SEQUENCE tzzr_chat_ai.embeddings_num_seq OWNED BY tzzr_chat_ai.embeddings.num;


--
-- Name: enrichment; Type: TABLE; Schema: tzzr_chat_ai; Owner: postgres
--

CREATE TABLE tzzr_chat_ai.enrichment (
    num integer NOT NULL,
    session_mrf character varying(64) NOT NULL,
    summary text,
    topics jsonb DEFAULT '[]'::jsonb,
    sentiment character varying(16),
    intent character varying(32),
    entities jsonb DEFAULT '{}'::jsonb,
    set_hst character varying(64),
    etiquetas jsonb DEFAULT '[]'::jsonb,
    model_used character varying(64),
    confidence double precision,
    processed_at timestamp with time zone,
    created_at timestamp with time zone DEFAULT now(),
    updated_at timestamp with time zone DEFAULT now()
);


ALTER TABLE tzzr_chat_ai.enrichment OWNER TO postgres;

--
-- Name: enrichment_num_seq; Type: SEQUENCE; Schema: tzzr_chat_ai; Owner: postgres
--

CREATE SEQUENCE tzzr_chat_ai.enrichment_num_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE tzzr_chat_ai.enrichment_num_seq OWNER TO postgres;

--
-- Name: enrichment_num_seq; Type: SEQUENCE OWNED BY; Schema: tzzr_chat_ai; Owner: postgres
--

ALTER SEQUENCE tzzr_chat_ai.enrichment_num_seq OWNED BY tzzr_chat_ai.enrichment.num;


--
-- Name: extracted; Type: TABLE; Schema: tzzr_chat_ai; Owner: postgres
--

CREATE TABLE tzzr_chat_ai.extracted (
    num integer NOT NULL,
    mrf character varying(64) DEFAULT md5(((random())::text || (clock_timestamp())::text)) NOT NULL,
    session_mrf character varying(64) NOT NULL,
    extraction_type character varying(32) NOT NULL,
    value text,
    data jsonb DEFAULT '{}'::jsonb,
    set_hst character varying(64),
    etiquetas jsonb DEFAULT '[]'::jsonb,
    model character varying(64),
    created_at timestamp with time zone DEFAULT now()
);


ALTER TABLE tzzr_chat_ai.extracted OWNER TO postgres;

--
-- Name: extracted_num_seq; Type: SEQUENCE; Schema: tzzr_chat_ai; Owner: postgres
--

CREATE SEQUENCE tzzr_chat_ai.extracted_num_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE tzzr_chat_ai.extracted_num_seq OWNER TO postgres;

--
-- Name: extracted_num_seq; Type: SEQUENCE OWNED BY; Schema: tzzr_chat_ai; Owner: postgres
--

ALTER SEQUENCE tzzr_chat_ai.extracted_num_seq OWNED BY tzzr_chat_ai.extracted.num;


--
-- Name: graph_actions; Type: TABLE; Schema: tzzr_chat_ai; Owner: postgres
--

CREATE TABLE tzzr_chat_ai.graph_actions (
    num integer NOT NULL,
    mrf_a character varying(64) NOT NULL,
    mrf_b character varying(64) NOT NULL,
    weight double precision DEFAULT 1.0,
    edge_type character varying(32),
    created_at timestamp with time zone DEFAULT now()
);


ALTER TABLE tzzr_chat_ai.graph_actions OWNER TO postgres;

--
-- Name: graph_actions_num_seq; Type: SEQUENCE; Schema: tzzr_chat_ai; Owner: postgres
--

CREATE SEQUENCE tzzr_chat_ai.graph_actions_num_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE tzzr_chat_ai.graph_actions_num_seq OWNER TO postgres;

--
