diff --git a/sql/schema_init/create_database_schema.sql b/sql/schema_init/create_database_schema.sql index 74760a95..bfb21b28 100644 --- a/sql/schema_init/create_database_schema.sql +++ b/sql/schema_init/create_database_schema.sql @@ -2,7 +2,7 @@ -- PostgreSQL database dump -- -\restrict Vwcqwiq0T7Wa2mK8KvZhGZRaSeFcgOrgunEbjWSCbLeRLSwJLeXqBprmQroWe9O +\restrict ioCi9akCEb4OTJqqafagnN0ujRzEOChWnb2NQKO5G1mPGHoPiOIWcce58T7EixH -- Dumped from database version 18.3 (Ubuntu 18.3-1.pgdg25.10+1) -- Dumped by pg_dump version 18.3 (Ubuntu 18.3-1.pgdg25.10+1) @@ -1228,20 +1228,44 @@ CREATE VIEW library.video_items_v AS ALTER VIEW library.video_items_v OWNER TO postgres; +-- +-- Name: __EFMigrationsHistory; Type: TABLE; Schema: public; Owner: jellyfin +-- + +CREATE TABLE public."__EFMigrationsHistory" ( + migration_id character varying(150) CONSTRAINT "__EFMigrationsHistory_MigrationId_not_null" NOT NULL, + product_version character varying(32) CONSTRAINT "__EFMigrationsHistory_ProductVersion_not_null" NOT NULL +); + + +ALTER TABLE public."__EFMigrationsHistory" OWNER TO jellyfin; + -- -- Name: __ef_migrations_history; Type: TABLE; Schema: public; Owner: jellyfin -- CREATE TABLE public.__ef_migrations_history ( - migration_id character varying(150) CONSTRAINT "__EFMigrationsHistory_MigrationId_not_null" NOT NULL, - product_version character varying(32) CONSTRAINT "__EFMigrationsHistory_ProductVersion_not_null" NOT NULL + migration_id character varying(150) NOT NULL, + product_version character varying(32) NOT NULL ); ALTER TABLE public.__ef_migrations_history OWNER TO jellyfin; -- --- Name: bloat_tables; Type: TABLE; Schema: public; Owner: jellyfin +-- Name: __efmigrationshistory; Type: TABLE; Schema: public; Owner: postgres +-- + +CREATE TABLE public.__efmigrationshistory ( + migrationid character varying(150) NOT NULL, + productversion character varying(32) NOT NULL +); + + +ALTER TABLE public.__efmigrationshistory OWNER TO postgres; + +-- +-- Name: bloat_tables; Type: TABLE; Schema: public; Owner: postgres -- CREATE TABLE public.bloat_tables ( @@ -1249,7 +1273,7 @@ CREATE TABLE public.bloat_tables ( ); -ALTER TABLE public.bloat_tables OWNER TO jellyfin; +ALTER TABLE public.bloat_tables OWNER TO postgres; -- -- Name: access_schedules; Type: TABLE; Schema: users; Owner: jellyfin @@ -1581,13 +1605,37 @@ ALTER TABLE ONLY library.video_stream_details -- --- Name: __ef_migrations_history PK___EFMigrationsHistory; Type: CONSTRAINT; Schema: public; Owner: jellyfin +-- Name: item_values_map pk_itemvaluesmap; Type: CONSTRAINT; Schema: library; Owner: jellyfin -- -ALTER TABLE ONLY public.__ef_migrations_history +ALTER TABLE ONLY library.item_values_map + ADD CONSTRAINT pk_itemvaluesmap PRIMARY KEY (item_value_id, item_id); + + +-- +-- Name: people_base_item_map pk_peoplebaseitemmap; Type: CONSTRAINT; Schema: library; Owner: jellyfin +-- + +ALTER TABLE ONLY library.people_base_item_map + ADD CONSTRAINT pk_peoplebaseitemmap PRIMARY KEY (item_id, people_id, role); + + +-- +-- Name: __EFMigrationsHistory PK___EFMigrationsHistory; Type: CONSTRAINT; Schema: public; Owner: jellyfin +-- + +ALTER TABLE ONLY public."__EFMigrationsHistory" ADD CONSTRAINT "PK___EFMigrationsHistory" PRIMARY KEY (migration_id); +-- +-- Name: __efmigrationshistory pk___efmigrationshistory; Type: CONSTRAINT; Schema: public; Owner: postgres +-- + +ALTER TABLE ONLY public.__efmigrationshistory + ADD CONSTRAINT pk___efmigrationshistory PRIMARY KEY (migrationid); + + -- -- Name: access_schedules PK_AccessSchedules; Type: CONSTRAINT; Schema: users; Owner: jellyfin -- @@ -1634,6 +1682,13 @@ CREATE INDEX "IX_ActivityLogs_DateCreated" ON activitylog.activity_logs USING bt CREATE INDEX idx_activitylogs_userid_datecreated ON activitylog.activity_logs USING btree (user_id, date_created DESC) WHERE (user_id IS NOT NULL); +-- +-- Name: ix_activitylogs_datecreated; Type: INDEX; Schema: activitylog; Owner: jellyfin +-- + +CREATE INDEX ix_activitylogs_datecreated ON activitylog.activity_logs USING btree (date_created); + + -- -- Name: IX_ApiKeys_AccessToken; Type: INDEX; Schema: authentication; Owner: jellyfin -- @@ -1676,6 +1731,48 @@ CREATE INDEX "IX_Devices_DeviceId_DateLastActivity" ON authentication.devices US CREATE INDEX "IX_Devices_UserId_DeviceId" ON authentication.devices USING btree (user_id, device_id); +-- +-- Name: ix_apikeys_accesstoken; Type: INDEX; Schema: authentication; Owner: jellyfin +-- + +CREATE UNIQUE INDEX ix_apikeys_accesstoken ON authentication.api_keys USING btree (access_token); + + +-- +-- Name: ix_deviceoptions_deviceid; Type: INDEX; Schema: authentication; Owner: jellyfin +-- + +CREATE UNIQUE INDEX ix_deviceoptions_deviceid ON authentication.device_options USING btree (device_id); + + +-- +-- Name: ix_devices_accesstoken_datelastactivity; Type: INDEX; Schema: authentication; Owner: jellyfin +-- + +CREATE INDEX ix_devices_accesstoken_datelastactivity ON authentication.devices USING btree (access_token, date_last_activity); + + +-- +-- Name: ix_devices_deviceid; Type: INDEX; Schema: authentication; Owner: jellyfin +-- + +CREATE INDEX ix_devices_deviceid ON authentication.devices USING btree (device_id); + + +-- +-- Name: ix_devices_deviceid_datelastactivity; Type: INDEX; Schema: authentication; Owner: jellyfin +-- + +CREATE INDEX ix_devices_deviceid_datelastactivity ON authentication.devices USING btree (device_id, date_last_activity); + + +-- +-- Name: ix_devices_userid_deviceid; Type: INDEX; Schema: authentication; Owner: jellyfin +-- + +CREATE INDEX ix_devices_userid_deviceid ON authentication.devices USING btree (user_id, device_id); + + -- -- Name: IX_CustomItemDisplayPreferences_UserId_ItemId_Client_Key; Type: INDEX; Schema: displaypreferences; Owner: jellyfin -- @@ -1704,6 +1801,27 @@ CREATE INDEX "IX_HomeSection_DisplayPreferencesId" ON displaypreferences.home_se CREATE INDEX "IX_ItemDisplayPreferences_UserId" ON displaypreferences.item_display_preferences USING btree (user_id); +-- +-- Name: ix_displaypreferences_userid_itemid_client; Type: INDEX; Schema: displaypreferences; Owner: jellyfin +-- + +CREATE UNIQUE INDEX ix_displaypreferences_userid_itemid_client ON displaypreferences.display_preferences USING btree (user_id, item_id, client); + + +-- +-- Name: ix_homesection_displaypreferencesid; Type: INDEX; Schema: displaypreferences; Owner: jellyfin +-- + +CREATE INDEX ix_homesection_displaypreferencesid ON displaypreferences.home_sections USING btree (display_preferences_id); + + +-- +-- Name: ix_itemdisplaypreferences_userid; Type: INDEX; Schema: displaypreferences; Owner: jellyfin +-- + +CREATE INDEX ix_itemdisplaypreferences_userid ON displaypreferences.item_display_preferences USING btree (user_id); + + -- -- Name: IX_BaseItemImageInfos_ItemId; Type: INDEX; Schema: library; Owner: jellyfin -- @@ -1830,6 +1948,97 @@ CREATE INDEX "IX_UserData_ItemId_UserId_PlaybackPositionTicks" ON library.user_d CREATE INDEX "IX_UserData_ItemId_UserId_Played" ON library.user_data USING btree (item_id, user_id, played); +-- +-- Name: baseitemproviders_providerid_idx; Type: INDEX; Schema: library; Owner: jellyfin +-- + +CREATE INDEX baseitemproviders_providerid_idx ON library.base_item_providers USING btree (provider_id, item_id); + + +-- +-- Name: baseitemproviders_providervalue_idx; Type: INDEX; Schema: library; Owner: jellyfin +-- + +CREATE INDEX baseitemproviders_providervalue_idx ON library.base_item_providers USING btree (provider_value, provider_id); + + +-- +-- Name: baseitems_communityrating_idx; Type: INDEX; Schema: library; Owner: jellyfin +-- + +CREATE INDEX baseitems_communityrating_idx ON library.base_items USING btree (community_rating DESC); + + +-- +-- Name: baseitems_datecreated_idx; Type: INDEX; Schema: library; Owner: jellyfin +-- + +CREATE INDEX baseitems_datecreated_idx ON library.base_items USING btree (date_created DESC); + + +-- +-- Name: baseitems_datemodified_idx; Type: INDEX; Schema: library; Owner: jellyfin +-- + +CREATE INDEX baseitems_datemodified_idx ON library.base_items USING btree (date_modified DESC); + + +-- +-- Name: baseitems_premieredate_idx; Type: INDEX; Schema: library; Owner: jellyfin +-- + +CREATE INDEX baseitems_premieredate_idx ON library.base_items USING btree (premiere_date DESC); + + +-- +-- Name: baseitems_productionyear_idx; Type: INDEX; Schema: library; Owner: jellyfin +-- + +CREATE INDEX baseitems_productionyear_idx ON library.base_items USING btree (production_year DESC); + + +-- +-- Name: baseitems_sortname_idx; Type: INDEX; Schema: library; Owner: jellyfin +-- + +CREATE INDEX baseitems_sortname_idx ON library.base_items USING btree (sort_name); + + +-- +-- Name: baseitems_topparentid_idx; Type: INDEX; Schema: library; Owner: jellyfin +-- + +CREATE INDEX baseitems_topparentid_idx ON library.base_items USING btree (top_parent_id, type); + + +-- +-- Name: idx_baseitems_datecreated_filtered; Type: INDEX; Schema: library; Owner: jellyfin +-- + +CREATE INDEX idx_baseitems_datecreated_filtered ON library.base_items USING btree (date_created DESC, type, is_virtual_item) WHERE ((date_created IS NOT NULL) AND (is_virtual_item = false)); + + +-- +-- Name: idx_baseitems_presentationuniquekey_episodes; Type: INDEX; Schema: library; Owner: jellyfin +-- + +CREATE INDEX idx_baseitems_presentationuniquekey_episodes ON library.base_items USING btree (presentation_unique_key, top_parent_id, is_virtual_item) WHERE ((type = 'MediaBrowser.Controller.Entities.TV.Episode'::text) AND (presentation_unique_key IS NOT NULL)); + + +-- +-- Name: idx_baseitems_topparentid_isfolder; Type: INDEX; Schema: library; Owner: jellyfin +-- + +CREATE INDEX idx_baseitems_topparentid_isfolder ON library.base_items USING btree (top_parent_id, is_folder, is_virtual_item) WHERE (top_parent_id IS NOT NULL); + + +-- +-- Name: idx_baseitems_type_isvirtualitem_topparentid; Type: INDEX; Schema: library; Owner: jellyfin +-- + +CREATE INDEX idx_baseitems_type_isvirtualitem_topparentid ON library.base_items USING btree (type, is_virtual_item, top_parent_id) WHERE (is_virtual_item = false); + + -- -- Name: idx_itemvalues_cleanvalue; Type: INDEX; Schema: library; Owner: jellyfin -- @@ -1865,6 +2074,209 @@ CREATE INDEX idx_itemvalues_value ON library.item_values USING btree (value) WHE CREATE INDEX idx_itemvaluesmap_itemvalueid_itemid ON library.item_values_map USING btree (item_value_id, item_id); +-- +-- Name: ix_ancestorids_parentitemid; Type: INDEX; Schema: library; Owner: jellyfin +-- + +CREATE INDEX ix_ancestorids_parentitemid ON library.ancestor_ids USING btree (parent_item_id); + + +-- +-- Name: ix_baseitemimageinfos_itemid; Type: INDEX; Schema: library; Owner: jellyfin +-- + +CREATE INDEX ix_baseitemimageinfos_itemid ON library.base_item_image_infos USING btree (item_id); + + +-- +-- Name: ix_baseitemmetadatafields_itemid; Type: INDEX; Schema: library; Owner: jellyfin +-- + +CREATE INDEX ix_baseitemmetadatafields_itemid ON library.base_item_metadata_fields USING btree (item_id); + + +-- +-- Name: ix_baseitemproviders_providerid_providervalue_itemid; Type: INDEX; Schema: library; Owner: jellyfin +-- + +CREATE INDEX ix_baseitemproviders_providerid_providervalue_itemid ON library.base_item_providers USING btree (provider_id, provider_value, item_id); + + +-- +-- Name: ix_baseitems_id_type_isfolder_isvirtualitem; Type: INDEX; Schema: library; Owner: jellyfin +-- + +CREATE INDEX ix_baseitems_id_type_isfolder_isvirtualitem ON library.base_items USING btree (id, type, is_folder, is_virtual_item); + + +-- +-- Name: ix_baseitems_path; Type: INDEX; Schema: library; Owner: jellyfin +-- + +CREATE INDEX ix_baseitems_path ON library.base_items USING btree (path); + + +-- +-- Name: ix_baseitems_presentationuniquekey; Type: INDEX; Schema: library; Owner: jellyfin +-- + +CREATE INDEX ix_baseitems_presentationuniquekey ON library.base_items USING btree (presentation_unique_key); + + +-- +-- Name: ix_baseitems_topparentid_id; Type: INDEX; Schema: library; Owner: jellyfin +-- + +CREATE INDEX ix_baseitems_topparentid_id ON library.base_items USING btree (top_parent_id, id); + + +-- +-- Name: ix_baseitems_type_topparentid_id; Type: INDEX; Schema: library; Owner: jellyfin +-- + +CREATE INDEX ix_baseitems_type_topparentid_id ON library.base_items USING btree (type, top_parent_id, id); + + +-- +-- Name: ix_baseitems_type_topparentid_presentationuniquekey; Type: INDEX; Schema: library; Owner: jellyfin +-- + +CREATE INDEX ix_baseitems_type_topparentid_presentationuniquekey ON library.base_items USING btree (type, top_parent_id, presentation_unique_key); + + +-- +-- Name: ix_baseitemtrailertypes_itemid; Type: INDEX; Schema: library; Owner: jellyfin +-- + +CREATE INDEX ix_baseitemtrailertypes_itemid ON library.base_item_trailer_types USING btree (item_id); + + +-- +-- Name: ix_imageinfos_userid; Type: INDEX; Schema: library; Owner: jellyfin +-- + +CREATE UNIQUE INDEX ix_imageinfos_userid ON library.image_infos USING btree (user_id); + + +-- +-- Name: ix_itemvalues_type_cleanvalue; Type: INDEX; Schema: library; Owner: jellyfin +-- + +CREATE INDEX ix_itemvalues_type_cleanvalue ON library.item_values USING btree (type, clean_value); + + +-- +-- Name: ix_itemvalues_type_value; Type: INDEX; Schema: library; Owner: jellyfin +-- + +CREATE UNIQUE INDEX ix_itemvalues_type_value ON library.item_values USING btree (type, value); + + +-- +-- Name: ix_itemvaluesmap_itemid; Type: INDEX; Schema: library; Owner: jellyfin +-- + +CREATE INDEX ix_itemvaluesmap_itemid ON library.item_values_map USING btree (item_id); + + +-- +-- Name: ix_mediastreaminfos_streamindex; Type: INDEX; Schema: library; Owner: jellyfin +-- + +CREATE INDEX ix_mediastreaminfos_streamindex ON library.media_stream_infos USING btree (stream_index); + + +-- +-- Name: ix_mediastreaminfos_streamindex_streamtype; Type: INDEX; Schema: library; Owner: jellyfin +-- + +CREATE INDEX ix_mediastreaminfos_streamindex_streamtype ON library.media_stream_infos USING btree (stream_index, stream_type); + + +-- +-- Name: ix_mediastreaminfos_streamindex_streamtype_language; Type: INDEX; Schema: library; Owner: jellyfin +-- + +CREATE INDEX ix_mediastreaminfos_streamindex_streamtype_language ON library.media_stream_infos USING btree (stream_index, stream_type, language); + + +-- +-- Name: ix_mediastreaminfos_streamtype; Type: INDEX; Schema: library; Owner: jellyfin +-- + +CREATE INDEX ix_mediastreaminfos_streamtype ON library.media_stream_infos USING btree (stream_type); + + +-- +-- Name: ix_peoplebaseitemmap_itemid_listorder; Type: INDEX; Schema: library; Owner: jellyfin +-- + +CREATE INDEX ix_peoplebaseitemmap_itemid_listorder ON library.people_base_item_map USING btree (item_id, list_order); + + +-- +-- Name: ix_peoplebaseitemmap_itemid_sortorder; Type: INDEX; Schema: library; Owner: jellyfin +-- + +CREATE INDEX ix_peoplebaseitemmap_itemid_sortorder ON library.people_base_item_map USING btree (item_id, sort_order); + + +-- +-- Name: ix_peoplebaseitemmap_peopleid; Type: INDEX; Schema: library; Owner: jellyfin +-- + +CREATE INDEX ix_peoplebaseitemmap_peopleid ON library.people_base_item_map USING btree (people_id); + + +-- +-- Name: ix_peoples_name; Type: INDEX; Schema: library; Owner: jellyfin +-- + +CREATE INDEX ix_peoples_name ON library.peoples USING btree (name); + + +-- +-- Name: ix_userdata_itemid_userid_isfavorite; Type: INDEX; Schema: library; Owner: jellyfin +-- + +CREATE INDEX ix_userdata_itemid_userid_isfavorite ON library.user_data USING btree (item_id, user_id, is_favorite); + + +-- +-- Name: ix_userdata_itemid_userid_lastplayeddate; Type: INDEX; Schema: library; Owner: jellyfin +-- + +CREATE INDEX ix_userdata_itemid_userid_lastplayeddate ON library.user_data USING btree (item_id, user_id, last_played_date); + + +-- +-- Name: ix_userdata_itemid_userid_playbackpositionticks; Type: INDEX; Schema: library; Owner: jellyfin +-- + +CREATE INDEX ix_userdata_itemid_userid_playbackpositionticks ON library.user_data USING btree (item_id, user_id, playback_position_ticks); + + +-- +-- Name: ix_userdata_itemid_userid_played; Type: INDEX; Schema: library; Owner: jellyfin +-- + +CREATE INDEX ix_userdata_itemid_userid_played ON library.user_data USING btree (item_id, user_id, played); + + +-- +-- Name: ix_userdata_userid; Type: INDEX; Schema: library; Owner: jellyfin +-- + +CREATE INDEX ix_userdata_userid ON library.user_data USING btree (user_id); + + +-- +-- Name: mediastreaminfos_codec_idx; Type: INDEX; Schema: library; Owner: jellyfin +-- + +CREATE INDEX mediastreaminfos_codec_idx ON library.media_stream_infos USING btree (codec); + + -- -- Name: mediastreaminfos_itemid_idx; Type: INDEX; Schema: library; Owner: jellyfin -- @@ -1886,6 +2298,27 @@ CREATE INDEX peoplebaseitemmap_itemid_idx ON library.people_base_item_map USING CREATE INDEX peoplebaseitemmap_peopleid_idx ON library.people_base_item_map USING btree (people_id, item_id); +-- +-- Name: userdata_lastplayeddate_idx; Type: INDEX; Schema: library; Owner: jellyfin +-- + +CREATE INDEX userdata_lastplayeddate_idx ON library.user_data USING btree (last_played_date DESC); + + +-- +-- Name: userdata_userid_isfavorite_idx; Type: INDEX; Schema: library; Owner: jellyfin +-- + +CREATE INDEX userdata_userid_isfavorite_idx ON library.user_data USING btree (user_id, is_favorite); + + +-- +-- Name: userdata_userid_played_idx; Type: INDEX; Schema: library; Owner: jellyfin +-- + +CREATE INDEX userdata_userid_played_idx ON library.user_data USING btree (user_id, played); + + -- -- Name: IX_AccessSchedules_UserId; Type: INDEX; Schema: users; Owner: jellyfin -- @@ -1914,6 +2347,34 @@ CREATE UNIQUE INDEX "IX_Preferences_UserId_Kind" ON users.preferences USING btre CREATE UNIQUE INDEX "IX_Users_Username" ON users.users USING btree (username); +-- +-- Name: ix_accessschedules_userid; Type: INDEX; Schema: users; Owner: jellyfin +-- + +CREATE INDEX ix_accessschedules_userid ON users.access_schedules USING btree (user_id); + + +-- +-- Name: ix_permissions_userid_kind; Type: INDEX; Schema: users; Owner: jellyfin +-- + +CREATE UNIQUE INDEX ix_permissions_userid_kind ON users.permissions USING btree (user_id, kind) WHERE (user_id IS NOT NULL); + + +-- +-- Name: ix_preferences_userid_kind; Type: INDEX; Schema: users; Owner: jellyfin +-- + +CREATE UNIQUE INDEX ix_preferences_userid_kind ON users.preferences USING btree (user_id, kind) WHERE (user_id IS NOT NULL); + + +-- +-- Name: ix_users_username; Type: INDEX; Schema: users; Owner: jellyfin +-- + +CREATE UNIQUE INDEX ix_users_username ON users.users USING btree (username); + + -- -- Name: devices FK_Devices_Users_UserId; Type: FK CONSTRAINT; Schema: authentication; Owner: jellyfin -- @@ -1922,6 +2383,14 @@ ALTER TABLE ONLY authentication.devices ADD CONSTRAINT "FK_Devices_Users_UserId" FOREIGN KEY (user_id) REFERENCES users.users(id) ON DELETE CASCADE; +-- +-- Name: devices fk_devices_users_userid; Type: FK CONSTRAINT; Schema: authentication; Owner: jellyfin +-- + +ALTER TABLE ONLY authentication.devices + ADD CONSTRAINT fk_devices_users_userid FOREIGN KEY (user_id) REFERENCES users.users(id) ON DELETE CASCADE; + + -- -- Name: display_preferences FK_DisplayPreferences_Users_UserId; Type: FK CONSTRAINT; Schema: displaypreferences; Owner: jellyfin -- @@ -1946,6 +2415,30 @@ ALTER TABLE ONLY displaypreferences.item_display_preferences ADD CONSTRAINT "FK_ItemDisplayPreferences_Users_UserId" FOREIGN KEY (user_id) REFERENCES users.users(id) ON DELETE CASCADE; +-- +-- Name: display_preferences fk_displaypreferences_users_userid; Type: FK CONSTRAINT; Schema: displaypreferences; Owner: jellyfin +-- + +ALTER TABLE ONLY displaypreferences.display_preferences + ADD CONSTRAINT fk_displaypreferences_users_userid FOREIGN KEY (user_id) REFERENCES users.users(id) ON DELETE CASCADE; + + +-- +-- Name: home_sections fk_homesection_displaypreferences_displaypreferencesid; Type: FK CONSTRAINT; Schema: displaypreferences; Owner: jellyfin +-- + +ALTER TABLE ONLY displaypreferences.home_sections + ADD CONSTRAINT fk_homesection_displaypreferences_displaypreferencesid FOREIGN KEY (display_preferences_id) REFERENCES displaypreferences.display_preferences(id) ON DELETE CASCADE; + + +-- +-- Name: item_display_preferences fk_itemdisplaypreferences_users_userid; Type: FK CONSTRAINT; Schema: displaypreferences; Owner: jellyfin +-- + +ALTER TABLE ONLY displaypreferences.item_display_preferences + ADD CONSTRAINT fk_itemdisplaypreferences_users_userid FOREIGN KEY (user_id) REFERENCES users.users(id) ON DELETE CASCADE; + + -- -- Name: ancestor_ids FK_AncestorIds_BaseItems_ItemId; Type: FK CONSTRAINT; Schema: library; Owner: jellyfin -- @@ -2130,6 +2623,142 @@ ALTER TABLE ONLY library.video_stream_details ADD CONSTRAINT "FK_VideoStreamDetails_MediaStreamInfos_ItemId_StreamIndex" FOREIGN KEY (item_id, stream_index) REFERENCES library.media_stream_infos(item_id, stream_index) ON DELETE CASCADE; +-- +-- Name: ancestor_ids fk_ancestorids_baseitems_itemid; Type: FK CONSTRAINT; Schema: library; Owner: jellyfin +-- + +ALTER TABLE ONLY library.ancestor_ids + ADD CONSTRAINT fk_ancestorids_baseitems_itemid FOREIGN KEY (item_id) REFERENCES library.base_items(id) ON DELETE CASCADE; + + +-- +-- Name: ancestor_ids fk_ancestorids_baseitems_parentitemid; Type: FK CONSTRAINT; Schema: library; Owner: jellyfin +-- + +ALTER TABLE ONLY library.ancestor_ids + ADD CONSTRAINT fk_ancestorids_baseitems_parentitemid FOREIGN KEY (parent_item_id) REFERENCES library.base_items(id) ON DELETE CASCADE; + + +-- +-- Name: attachment_stream_infos fk_attachmentstreaminfos_baseitems_itemid; Type: FK CONSTRAINT; Schema: library; Owner: jellyfin +-- + +ALTER TABLE ONLY library.attachment_stream_infos + ADD CONSTRAINT fk_attachmentstreaminfos_baseitems_itemid FOREIGN KEY (item_id) REFERENCES library.base_items(id) ON DELETE CASCADE; + + +-- +-- Name: base_item_image_infos fk_baseitemimageinfos_baseitems_itemid; Type: FK CONSTRAINT; Schema: library; Owner: jellyfin +-- + +ALTER TABLE ONLY library.base_item_image_infos + ADD CONSTRAINT fk_baseitemimageinfos_baseitems_itemid FOREIGN KEY (item_id) REFERENCES library.base_items(id) ON DELETE CASCADE; + + +-- +-- Name: base_item_metadata_fields fk_baseitemmetadatafields_baseitems_itemid; Type: FK CONSTRAINT; Schema: library; Owner: jellyfin +-- + +ALTER TABLE ONLY library.base_item_metadata_fields + ADD CONSTRAINT fk_baseitemmetadatafields_baseitems_itemid FOREIGN KEY (item_id) REFERENCES library.base_items(id) ON DELETE CASCADE; + + +-- +-- Name: base_item_providers fk_baseitemproviders_baseitems_itemid; Type: FK CONSTRAINT; Schema: library; Owner: jellyfin +-- + +ALTER TABLE ONLY library.base_item_providers + ADD CONSTRAINT fk_baseitemproviders_baseitems_itemid FOREIGN KEY (item_id) REFERENCES library.base_items(id) ON DELETE CASCADE; + + +-- +-- Name: base_item_trailer_types fk_baseitemtrailertypes_baseitems_itemid; Type: FK CONSTRAINT; Schema: library; Owner: jellyfin +-- + +ALTER TABLE ONLY library.base_item_trailer_types + ADD CONSTRAINT fk_baseitemtrailertypes_baseitems_itemid FOREIGN KEY (item_id) REFERENCES library.base_items(id) ON DELETE CASCADE; + + +-- +-- Name: chapters fk_chapters_baseitems_itemid; Type: FK CONSTRAINT; Schema: library; Owner: jellyfin +-- + +ALTER TABLE ONLY library.chapters + ADD CONSTRAINT fk_chapters_baseitems_itemid FOREIGN KEY (item_id) REFERENCES library.base_items(id) ON DELETE CASCADE; + + +-- +-- Name: image_infos fk_imageinfos_users_userid; Type: FK CONSTRAINT; Schema: library; Owner: jellyfin +-- + +ALTER TABLE ONLY library.image_infos + ADD CONSTRAINT fk_imageinfos_users_userid FOREIGN KEY (user_id) REFERENCES users.users(id) ON DELETE CASCADE; + + +-- +-- Name: item_values_map fk_itemvaluesmap_baseitems_itemid; Type: FK CONSTRAINT; Schema: library; Owner: jellyfin +-- + +ALTER TABLE ONLY library.item_values_map + ADD CONSTRAINT fk_itemvaluesmap_baseitems_itemid FOREIGN KEY (item_id) REFERENCES library.base_items(id) ON DELETE CASCADE; + + +-- +-- Name: item_values_map fk_itemvaluesmap_itemvalues_itemvalueid; Type: FK CONSTRAINT; Schema: library; Owner: jellyfin +-- + +ALTER TABLE ONLY library.item_values_map + ADD CONSTRAINT fk_itemvaluesmap_itemvalues_itemvalueid FOREIGN KEY (item_value_id) REFERENCES library.item_values(item_value_id) ON DELETE CASCADE; + + +-- +-- Name: keyframe_data fk_keyframedata_baseitems_itemid; Type: FK CONSTRAINT; Schema: library; Owner: jellyfin +-- + +ALTER TABLE ONLY library.keyframe_data + ADD CONSTRAINT fk_keyframedata_baseitems_itemid FOREIGN KEY (item_id) REFERENCES library.base_items(id) ON DELETE CASCADE; + + +-- +-- Name: media_stream_infos fk_mediastreaminfos_baseitems_itemid; Type: FK CONSTRAINT; Schema: library; Owner: jellyfin +-- + +ALTER TABLE ONLY library.media_stream_infos + ADD CONSTRAINT fk_mediastreaminfos_baseitems_itemid FOREIGN KEY (item_id) REFERENCES library.base_items(id) ON DELETE CASCADE; + + +-- +-- Name: people_base_item_map fk_peoplebaseitemmap_baseitems_itemid; Type: FK CONSTRAINT; Schema: library; Owner: jellyfin +-- + +ALTER TABLE ONLY library.people_base_item_map + ADD CONSTRAINT fk_peoplebaseitemmap_baseitems_itemid FOREIGN KEY (item_id) REFERENCES library.base_items(id) ON DELETE CASCADE; + + +-- +-- Name: people_base_item_map fk_peoplebaseitemmap_peoples_peopleid; Type: FK CONSTRAINT; Schema: library; Owner: jellyfin +-- + +ALTER TABLE ONLY library.people_base_item_map + ADD CONSTRAINT fk_peoplebaseitemmap_peoples_peopleid FOREIGN KEY (people_id) REFERENCES library.peoples(id) ON DELETE CASCADE; + + +-- +-- Name: user_data fk_userdata_baseitems_itemid; Type: FK CONSTRAINT; Schema: library; Owner: jellyfin +-- + +ALTER TABLE ONLY library.user_data + ADD CONSTRAINT fk_userdata_baseitems_itemid FOREIGN KEY (item_id) REFERENCES library.base_items(id) ON DELETE CASCADE; + + +-- +-- Name: user_data fk_userdata_users_userid; Type: FK CONSTRAINT; Schema: library; Owner: jellyfin +-- + +ALTER TABLE ONLY library.user_data + ADD CONSTRAINT fk_userdata_users_userid FOREIGN KEY (user_id) REFERENCES users.users(id) ON DELETE CASCADE; + + -- -- Name: access_schedules FK_AccessSchedules_Users_UserId; Type: FK CONSTRAINT; Schema: users; Owner: jellyfin -- @@ -2154,9 +2783,33 @@ ALTER TABLE ONLY users.preferences ADD CONSTRAINT "FK_Preferences_Users_UserId" FOREIGN KEY (user_id) REFERENCES users.users(id) ON DELETE CASCADE; +-- +-- Name: access_schedules fk_accessschedules_users_userid; Type: FK CONSTRAINT; Schema: users; Owner: jellyfin +-- + +ALTER TABLE ONLY users.access_schedules + ADD CONSTRAINT fk_accessschedules_users_userid FOREIGN KEY (user_id) REFERENCES users.users(id) ON DELETE CASCADE; + + +-- +-- Name: permissions fk_permissions_users_userid; Type: FK CONSTRAINT; Schema: users; Owner: jellyfin +-- + +ALTER TABLE ONLY users.permissions + ADD CONSTRAINT fk_permissions_users_userid FOREIGN KEY (user_id) REFERENCES users.users(id) ON DELETE CASCADE; + + +-- +-- Name: preferences fk_preferences_users_userid; Type: FK CONSTRAINT; Schema: users; Owner: jellyfin +-- + +ALTER TABLE ONLY users.preferences + ADD CONSTRAINT fk_preferences_users_userid FOREIGN KEY (user_id) REFERENCES users.users(id) ON DELETE CASCADE; + + -- -- PostgreSQL database dump complete -- -\unrestrict Vwcqwiq0T7Wa2mK8KvZhGZRaSeFcgOrgunEbjWSCbLeRLSwJLeXqBprmQroWe9O +\unrestrict ioCi9akCEb4OTJqqafagnN0ujRzEOChWnb2NQKO5G1mPGHoPiOIWcce58T7EixH diff --git a/sql/schema_init/create_database_schema.sql.v2 b/sql/schema_init/create_database_schema.sql.v2 index 5a989fe8..9de83f54 100644 Binary files a/sql/schema_init/create_database_schema.sql.v2 and b/sql/schema_init/create_database_schema.sql.v2 differ diff --git a/sql/schema_init/create_database_schema.sql.v3 b/sql/schema_init/create_database_schema.sql.v3 index 9de83f54..74760a95 100644 --- a/sql/schema_init/create_database_schema.sql.v3 +++ b/sql/schema_init/create_database_schema.sql.v3 @@ -2,7 +2,7 @@ -- PostgreSQL database dump -- -\restrict 7yQHzelyscgVdVnHcclaahZ3bSdtHCyhzvmlksdJIsj2eWF8f38OCYThpGtIjiX +\restrict Vwcqwiq0T7Wa2mK8KvZhGZRaSeFcgOrgunEbjWSCbLeRLSwJLeXqBprmQroWe9O -- Dumped from database version 18.3 (Ubuntu 18.3-1.pgdg25.10+1) -- Dumped by pg_dump version 18.3 (Ubuntu 18.3-1.pgdg25.10+1) @@ -55,6 +55,20 @@ CREATE SCHEMA library; ALTER SCHEMA library OWNER TO jellyfin; +-- +-- Name: pg_repack; Type: EXTENSION; Schema: -; Owner: - +-- + +CREATE EXTENSION IF NOT EXISTS pg_repack WITH SCHEMA public; + + +-- +-- Name: EXTENSION pg_repack; Type: COMMENT; Schema: -; Owner: +-- + +COMMENT ON EXTENSION pg_repack IS 'Reorganize tables in PostgreSQL databases with minimal locks'; + + -- -- Name: users; Type: SCHEMA; Schema: -; Owner: jellyfin -- @@ -83,30 +97,30 @@ SET default_tablespace = ''; SET default_table_access_method = heap; -- --- Name: ActivityLogs; Type: TABLE; Schema: activitylog; Owner: jellyfin +-- Name: activity_logs; Type: TABLE; Schema: activitylog; Owner: jellyfin -- -CREATE TABLE activitylog."ActivityLogs" ( - "Id" integer NOT NULL, - "Name" character varying(512) NOT NULL, - "Overview" character varying(512), - "ShortOverview" character varying(512), - "Type" character varying(256) NOT NULL, - "UserId" uuid NOT NULL, - "ItemId" character varying(256), - "DateCreated" timestamp with time zone NOT NULL, - "LogSeverity" integer NOT NULL, - "RowVersion" bigint NOT NULL +CREATE TABLE activitylog.activity_logs ( + id integer CONSTRAINT "ActivityLogs_Id_not_null" NOT NULL, + name character varying(512) CONSTRAINT "ActivityLogs_Name_not_null" NOT NULL, + overview character varying(512), + short_overview character varying(512), + type character varying(256) CONSTRAINT "ActivityLogs_Type_not_null" NOT NULL, + user_id uuid CONSTRAINT "ActivityLogs_UserId_not_null" NOT NULL, + item_id character varying(256), + date_created timestamp with time zone CONSTRAINT "ActivityLogs_DateCreated_not_null" NOT NULL, + log_severity integer CONSTRAINT "ActivityLogs_LogSeverity_not_null" NOT NULL, + row_version bigint CONSTRAINT "ActivityLogs_RowVersion_not_null" NOT NULL ); -ALTER TABLE activitylog."ActivityLogs" OWNER TO jellyfin; +ALTER TABLE activitylog.activity_logs OWNER TO jellyfin; -- -- Name: ActivityLogs_Id_seq; Type: SEQUENCE; Schema: activitylog; Owner: jellyfin -- -ALTER TABLE activitylog."ActivityLogs" ALTER COLUMN "Id" ADD GENERATED BY DEFAULT AS IDENTITY ( +ALTER TABLE activitylog.activity_logs ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY ( SEQUENCE NAME activitylog."ActivityLogs_Id_seq" START WITH 1 INCREMENT BY 1 @@ -117,25 +131,25 @@ ALTER TABLE activitylog."ActivityLogs" ALTER COLUMN "Id" ADD GENERATED BY DEFAUL -- --- Name: ApiKeys; Type: TABLE; Schema: authentication; Owner: jellyfin +-- Name: api_keys; Type: TABLE; Schema: authentication; Owner: jellyfin -- -CREATE TABLE authentication."ApiKeys" ( - "Id" integer NOT NULL, - "DateCreated" timestamp with time zone NOT NULL, - "DateLastActivity" timestamp with time zone NOT NULL, - "Name" character varying(64) NOT NULL, - "AccessToken" text NOT NULL +CREATE TABLE authentication.api_keys ( + id integer CONSTRAINT "ApiKeys_Id_not_null" NOT NULL, + date_created timestamp with time zone CONSTRAINT "ApiKeys_DateCreated_not_null" NOT NULL, + date_last_activity timestamp with time zone CONSTRAINT "ApiKeys_DateLastActivity_not_null" NOT NULL, + name character varying(64) CONSTRAINT "ApiKeys_Name_not_null" NOT NULL, + access_token text CONSTRAINT "ApiKeys_AccessToken_not_null" NOT NULL ); -ALTER TABLE authentication."ApiKeys" OWNER TO jellyfin; +ALTER TABLE authentication.api_keys OWNER TO jellyfin; -- -- Name: ApiKeys_Id_seq; Type: SEQUENCE; Schema: authentication; Owner: jellyfin -- -ALTER TABLE authentication."ApiKeys" ALTER COLUMN "Id" ADD GENERATED BY DEFAULT AS IDENTITY ( +ALTER TABLE authentication.api_keys ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY ( SEQUENCE NAME authentication."ApiKeys_Id_seq" START WITH 1 INCREMENT BY 1 @@ -146,23 +160,23 @@ ALTER TABLE authentication."ApiKeys" ALTER COLUMN "Id" ADD GENERATED BY DEFAULT -- --- Name: DeviceOptions; Type: TABLE; Schema: authentication; Owner: jellyfin +-- Name: device_options; Type: TABLE; Schema: authentication; Owner: jellyfin -- -CREATE TABLE authentication."DeviceOptions" ( - "Id" integer NOT NULL, - "DeviceId" text NOT NULL, - "CustomName" text +CREATE TABLE authentication.device_options ( + id integer CONSTRAINT "DeviceOptions_Id_not_null" NOT NULL, + device_id text CONSTRAINT "DeviceOptions_DeviceId_not_null" NOT NULL, + custom_name text ); -ALTER TABLE authentication."DeviceOptions" OWNER TO jellyfin; +ALTER TABLE authentication.device_options OWNER TO jellyfin; -- -- Name: DeviceOptions_Id_seq; Type: SEQUENCE; Schema: authentication; Owner: jellyfin -- -ALTER TABLE authentication."DeviceOptions" ALTER COLUMN "Id" ADD GENERATED BY DEFAULT AS IDENTITY ( +ALTER TABLE authentication.device_options ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY ( SEQUENCE NAME authentication."DeviceOptions_Id_seq" START WITH 1 INCREMENT BY 1 @@ -173,31 +187,31 @@ ALTER TABLE authentication."DeviceOptions" ALTER COLUMN "Id" ADD GENERATED BY DE -- --- Name: Devices; Type: TABLE; Schema: authentication; Owner: jellyfin +-- Name: devices; Type: TABLE; Schema: authentication; Owner: jellyfin -- -CREATE TABLE authentication."Devices" ( - "Id" integer NOT NULL, - "UserId" uuid NOT NULL, - "AccessToken" text NOT NULL, - "AppName" character varying(64) NOT NULL, - "AppVersion" character varying(32) NOT NULL, - "DeviceName" character varying(64) NOT NULL, - "DeviceId" character varying(256) NOT NULL, - "IsActive" boolean NOT NULL, - "DateCreated" timestamp with time zone NOT NULL, - "DateModified" timestamp with time zone NOT NULL, - "DateLastActivity" timestamp with time zone NOT NULL +CREATE TABLE authentication.devices ( + id integer CONSTRAINT "Devices_Id_not_null" NOT NULL, + user_id uuid CONSTRAINT "Devices_UserId_not_null" NOT NULL, + access_token text CONSTRAINT "Devices_AccessToken_not_null" NOT NULL, + app_name character varying(64) CONSTRAINT "Devices_AppName_not_null" NOT NULL, + app_version character varying(32) CONSTRAINT "Devices_AppVersion_not_null" NOT NULL, + device_name character varying(64) CONSTRAINT "Devices_DeviceName_not_null" NOT NULL, + device_id character varying(256) CONSTRAINT "Devices_DeviceId_not_null" NOT NULL, + is_active boolean CONSTRAINT "Devices_IsActive_not_null" NOT NULL, + date_created timestamp with time zone CONSTRAINT "Devices_DateCreated_not_null" NOT NULL, + date_modified timestamp with time zone CONSTRAINT "Devices_DateModified_not_null" NOT NULL, + date_last_activity timestamp with time zone CONSTRAINT "Devices_DateLastActivity_not_null" NOT NULL ); -ALTER TABLE authentication."Devices" OWNER TO jellyfin; +ALTER TABLE authentication.devices OWNER TO jellyfin; -- -- Name: Devices_Id_seq; Type: SEQUENCE; Schema: authentication; Owner: jellyfin -- -ALTER TABLE authentication."Devices" ALTER COLUMN "Id" ADD GENERATED BY DEFAULT AS IDENTITY ( +ALTER TABLE authentication.devices ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY ( SEQUENCE NAME authentication."Devices_Id_seq" START WITH 1 INCREMENT BY 1 @@ -208,26 +222,26 @@ ALTER TABLE authentication."Devices" ALTER COLUMN "Id" ADD GENERATED BY DEFAULT -- --- Name: CustomItemDisplayPreferences; Type: TABLE; Schema: displaypreferences; Owner: jellyfin +-- Name: custom_item_display_preferences; Type: TABLE; Schema: displaypreferences; Owner: jellyfin -- -CREATE TABLE displaypreferences."CustomItemDisplayPreferences" ( - "Id" integer NOT NULL, - "UserId" uuid NOT NULL, - "ItemId" uuid NOT NULL, - "Client" character varying(32) NOT NULL, - "Key" text NOT NULL, - "Value" text +CREATE TABLE displaypreferences.custom_item_display_preferences ( + id integer CONSTRAINT "CustomItemDisplayPreferences_Id_not_null" NOT NULL, + user_id uuid CONSTRAINT "CustomItemDisplayPreferences_UserId_not_null" NOT NULL, + item_id uuid CONSTRAINT "CustomItemDisplayPreferences_ItemId_not_null" NOT NULL, + client character varying(32) CONSTRAINT "CustomItemDisplayPreferences_Client_not_null" NOT NULL, + key text CONSTRAINT "CustomItemDisplayPreferences_Key_not_null" NOT NULL, + value text ); -ALTER TABLE displaypreferences."CustomItemDisplayPreferences" OWNER TO jellyfin; +ALTER TABLE displaypreferences.custom_item_display_preferences OWNER TO jellyfin; -- -- Name: CustomItemDisplayPreferences_Id_seq; Type: SEQUENCE; Schema: displaypreferences; Owner: jellyfin -- -ALTER TABLE displaypreferences."CustomItemDisplayPreferences" ALTER COLUMN "Id" ADD GENERATED BY DEFAULT AS IDENTITY ( +ALTER TABLE displaypreferences.custom_item_display_preferences ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY ( SEQUENCE NAME displaypreferences."CustomItemDisplayPreferences_Id_seq" START WITH 1 INCREMENT BY 1 @@ -238,34 +252,34 @@ ALTER TABLE displaypreferences."CustomItemDisplayPreferences" ALTER COLUMN "Id" -- --- Name: DisplayPreferences; Type: TABLE; Schema: displaypreferences; Owner: jellyfin +-- Name: display_preferences; Type: TABLE; Schema: displaypreferences; Owner: jellyfin -- -CREATE TABLE displaypreferences."DisplayPreferences" ( - "Id" integer NOT NULL, - "UserId" uuid NOT NULL, - "ItemId" uuid NOT NULL, - "Client" character varying(32) NOT NULL, - "ShowSidebar" boolean NOT NULL, - "ShowBackdrop" boolean NOT NULL, - "ScrollDirection" integer NOT NULL, - "IndexBy" integer, - "SkipForwardLength" integer NOT NULL, - "SkipBackwardLength" integer NOT NULL, - "ChromecastVersion" integer NOT NULL, - "EnableNextVideoInfoOverlay" boolean NOT NULL, - "DashboardTheme" character varying(32), - "TvHome" character varying(32) +CREATE TABLE displaypreferences.display_preferences ( + id integer CONSTRAINT "DisplayPreferences_Id_not_null" NOT NULL, + user_id uuid CONSTRAINT "DisplayPreferences_UserId_not_null" NOT NULL, + item_id uuid CONSTRAINT "DisplayPreferences_ItemId_not_null" NOT NULL, + client character varying(32) CONSTRAINT "DisplayPreferences_Client_not_null" NOT NULL, + show_sidebar boolean CONSTRAINT "DisplayPreferences_ShowSidebar_not_null" NOT NULL, + show_backdrop boolean CONSTRAINT "DisplayPreferences_ShowBackdrop_not_null" NOT NULL, + scroll_direction integer CONSTRAINT "DisplayPreferences_ScrollDirection_not_null" NOT NULL, + index_by integer, + skip_forward_length integer CONSTRAINT "DisplayPreferences_SkipForwardLength_not_null" NOT NULL, + skip_backward_length integer CONSTRAINT "DisplayPreferences_SkipBackwardLength_not_null" NOT NULL, + chromecast_version integer CONSTRAINT "DisplayPreferences_ChromecastVersion_not_null" NOT NULL, + enable_next_video_info_overlay boolean CONSTRAINT "DisplayPreferences_EnableNextVideoInfoOverlay_not_null" NOT NULL, + dashboard_theme character varying(32), + tv_home character varying(32) ); -ALTER TABLE displaypreferences."DisplayPreferences" OWNER TO jellyfin; +ALTER TABLE displaypreferences.display_preferences OWNER TO jellyfin; -- -- Name: DisplayPreferences_Id_seq; Type: SEQUENCE; Schema: displaypreferences; Owner: jellyfin -- -ALTER TABLE displaypreferences."DisplayPreferences" ALTER COLUMN "Id" ADD GENERATED BY DEFAULT AS IDENTITY ( +ALTER TABLE displaypreferences.display_preferences ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY ( SEQUENCE NAME displaypreferences."DisplayPreferences_Id_seq" START WITH 1 INCREMENT BY 1 @@ -276,24 +290,24 @@ ALTER TABLE displaypreferences."DisplayPreferences" ALTER COLUMN "Id" ADD GENERA -- --- Name: HomeSection; Type: TABLE; Schema: displaypreferences; Owner: jellyfin +-- Name: home_sections; Type: TABLE; Schema: displaypreferences; Owner: jellyfin -- -CREATE TABLE displaypreferences."HomeSection" ( - "Id" integer NOT NULL, - "DisplayPreferencesId" integer NOT NULL, - "Order" integer NOT NULL, - "Type" integer NOT NULL +CREATE TABLE displaypreferences.home_sections ( + id integer CONSTRAINT "HomeSection_Id_not_null" NOT NULL, + display_preferences_id integer CONSTRAINT "HomeSection_DisplayPreferencesId_not_null" NOT NULL, + "order" integer CONSTRAINT "HomeSection_Order_not_null" NOT NULL, + type integer CONSTRAINT "HomeSection_Type_not_null" NOT NULL ); -ALTER TABLE displaypreferences."HomeSection" OWNER TO jellyfin; +ALTER TABLE displaypreferences.home_sections OWNER TO jellyfin; -- -- Name: HomeSection_Id_seq; Type: SEQUENCE; Schema: displaypreferences; Owner: jellyfin -- -ALTER TABLE displaypreferences."HomeSection" ALTER COLUMN "Id" ADD GENERATED BY DEFAULT AS IDENTITY ( +ALTER TABLE displaypreferences.home_sections ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY ( SEQUENCE NAME displaypreferences."HomeSection_Id_seq" START WITH 1 INCREMENT BY 1 @@ -304,30 +318,30 @@ ALTER TABLE displaypreferences."HomeSection" ALTER COLUMN "Id" ADD GENERATED BY -- --- Name: ItemDisplayPreferences; Type: TABLE; Schema: displaypreferences; Owner: jellyfin +-- Name: item_display_preferences; Type: TABLE; Schema: displaypreferences; Owner: jellyfin -- -CREATE TABLE displaypreferences."ItemDisplayPreferences" ( - "Id" integer NOT NULL, - "UserId" uuid NOT NULL, - "ItemId" uuid NOT NULL, - "Client" character varying(32) NOT NULL, - "ViewType" integer NOT NULL, - "RememberIndexing" boolean NOT NULL, - "IndexBy" integer, - "RememberSorting" boolean NOT NULL, - "SortBy" character varying(64) NOT NULL, - "SortOrder" integer NOT NULL +CREATE TABLE displaypreferences.item_display_preferences ( + id integer CONSTRAINT "ItemDisplayPreferences_Id_not_null" NOT NULL, + user_id uuid CONSTRAINT "ItemDisplayPreferences_UserId_not_null" NOT NULL, + item_id uuid CONSTRAINT "ItemDisplayPreferences_ItemId_not_null" NOT NULL, + client character varying(32) CONSTRAINT "ItemDisplayPreferences_Client_not_null" NOT NULL, + view_type integer CONSTRAINT "ItemDisplayPreferences_ViewType_not_null" NOT NULL, + remember_indexing boolean CONSTRAINT "ItemDisplayPreferences_RememberIndexing_not_null" NOT NULL, + index_by integer, + remember_sorting boolean CONSTRAINT "ItemDisplayPreferences_RememberSorting_not_null" NOT NULL, + sort_by character varying(64) CONSTRAINT "ItemDisplayPreferences_SortBy_not_null" NOT NULL, + sort_order integer CONSTRAINT "ItemDisplayPreferences_SortOrder_not_null" NOT NULL ); -ALTER TABLE displaypreferences."ItemDisplayPreferences" OWNER TO jellyfin; +ALTER TABLE displaypreferences.item_display_preferences OWNER TO jellyfin; -- -- Name: ItemDisplayPreferences_Id_seq; Type: SEQUENCE; Schema: displaypreferences; Owner: jellyfin -- -ALTER TABLE displaypreferences."ItemDisplayPreferences" ALTER COLUMN "Id" ADD GENERATED BY DEFAULT AS IDENTITY ( +ALTER TABLE displaypreferences.item_display_preferences ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY ( SEQUENCE NAME displaypreferences."ItemDisplayPreferences_Id_seq" START WITH 1 INCREMENT BY 1 @@ -338,206 +352,24 @@ ALTER TABLE displaypreferences."ItemDisplayPreferences" ALTER COLUMN "Id" ADD GE -- --- Name: AncestorIds; Type: TABLE; Schema: library; Owner: jellyfin +-- Name: image_infos; Type: TABLE; Schema: library; Owner: jellyfin -- -CREATE TABLE library."AncestorIds" ( - "ParentItemId" uuid NOT NULL, - "ItemId" uuid NOT NULL +CREATE TABLE library.image_infos ( + id integer CONSTRAINT "ImageInfos_Id_not_null" NOT NULL, + user_id uuid, + path character varying(512) CONSTRAINT "ImageInfos_Path_not_null" NOT NULL, + last_modified timestamp with time zone CONSTRAINT "ImageInfos_LastModified_not_null" NOT NULL ); -ALTER TABLE library."AncestorIds" OWNER TO jellyfin; - --- --- Name: AttachmentStreamInfos; Type: TABLE; Schema: library; Owner: jellyfin --- - -CREATE TABLE library."AttachmentStreamInfos" ( - "ItemId" uuid NOT NULL, - "Index" integer NOT NULL, - "Codec" text, - "CodecTag" text, - "Comment" text, - "Filename" text, - "MimeType" text -); - - -ALTER TABLE library."AttachmentStreamInfos" OWNER TO jellyfin; - --- --- Name: BaseItemImageInfos; Type: TABLE; Schema: library; Owner: jellyfin --- - -CREATE TABLE library."BaseItemImageInfos" ( - "Id" uuid NOT NULL, - "Path" text NOT NULL, - "DateModified" timestamp with time zone, - "ImageType" integer NOT NULL, - "Width" integer NOT NULL, - "Height" integer NOT NULL, - "Blurhash" bytea, - "ItemId" uuid NOT NULL -); - - -ALTER TABLE library."BaseItemImageInfos" OWNER TO jellyfin; - --- --- Name: BaseItemMetadataFields; Type: TABLE; Schema: library; Owner: jellyfin --- - -CREATE TABLE library."BaseItemMetadataFields" ( - "Id" integer NOT NULL, - "ItemId" uuid NOT NULL -); - - -ALTER TABLE library."BaseItemMetadataFields" OWNER TO jellyfin; - --- --- Name: BaseItemProviders; Type: TABLE; Schema: library; Owner: jellyfin --- - -CREATE TABLE library."BaseItemProviders" ( - "ItemId" uuid NOT NULL, - "ProviderId" text NOT NULL, - "ProviderValue" text NOT NULL -); - - -ALTER TABLE library."BaseItemProviders" OWNER TO jellyfin; - --- --- Name: BaseItemTrailerTypes; Type: TABLE; Schema: library; Owner: jellyfin --- - -CREATE TABLE library."BaseItemTrailerTypes" ( - "Id" integer NOT NULL, - "ItemId" uuid NOT NULL -); - - -ALTER TABLE library."BaseItemTrailerTypes" OWNER TO jellyfin; - --- --- Name: BaseItems; Type: TABLE; Schema: library; Owner: jellyfin --- - -CREATE TABLE library."BaseItems" ( - "Id" uuid NOT NULL, - "Type" text NOT NULL, - "Data" text, - "Path" text, - "StartDate" timestamp with time zone, - "EndDate" timestamp with time zone, - "ChannelId" uuid, - "IsMovie" boolean NOT NULL, - "CommunityRating" real, - "CustomRating" text, - "IndexNumber" integer, - "IsLocked" boolean NOT NULL, - "Name" text, - "OfficialRating" text, - "MediaType" text, - "Overview" text, - "ParentIndexNumber" integer, - "PremiereDate" timestamp with time zone, - "ProductionYear" integer, - "Genres" text, - "SortName" text, - "ForcedSortName" text, - "RunTimeTicks" bigint, - "DateCreated" timestamp with time zone, - "DateModified" timestamp with time zone, - "IsSeries" boolean NOT NULL, - "EpisodeTitle" text, - "IsRepeat" boolean NOT NULL, - "PreferredMetadataLanguage" text, - "PreferredMetadataCountryCode" text, - "DateLastRefreshed" timestamp with time zone, - "DateLastSaved" timestamp with time zone, - "IsInMixedFolder" boolean NOT NULL, - "Studios" text, - "ExternalServiceId" text, - "Tags" text, - "IsFolder" boolean NOT NULL, - "InheritedParentalRatingValue" integer, - "InheritedParentalRatingSubValue" integer, - "UnratedType" text, - "CriticRating" real, - "CleanName" text, - "PresentationUniqueKey" text, - "OriginalTitle" text, - "PrimaryVersionId" text, - "DateLastMediaAdded" timestamp with time zone, - "Album" text, - "LUFS" real, - "NormalizationGain" real, - "IsVirtualItem" boolean NOT NULL, - "SeriesName" text, - "SeasonName" text, - "ExternalSeriesId" text, - "Tagline" text, - "ProductionLocations" text, - "ExtraIds" text, - "TotalBitrate" integer, - "ExtraType" integer, - "Artists" text, - "AlbumArtists" text, - "ExternalId" text, - "SeriesPresentationUniqueKey" text, - "ShowId" text, - "OwnerId" text, - "Width" integer, - "Height" integer, - "Size" bigint, - "Audio" integer, - "ParentId" uuid, - "TopParentId" uuid, - "SeasonId" uuid, - "SeriesId" uuid -); - - -ALTER TABLE library."BaseItems" OWNER TO jellyfin; - --- --- Name: Chapters; Type: TABLE; Schema: library; Owner: jellyfin --- - -CREATE TABLE library."Chapters" ( - "ItemId" uuid NOT NULL, - "ChapterIndex" integer NOT NULL, - "StartPositionTicks" bigint NOT NULL, - "Name" text, - "ImagePath" text, - "ImageDateModified" timestamp with time zone -); - - -ALTER TABLE library."Chapters" OWNER TO jellyfin; - --- --- Name: ImageInfos; Type: TABLE; Schema: library; Owner: jellyfin --- - -CREATE TABLE library."ImageInfos" ( - "Id" integer NOT NULL, - "UserId" uuid, - "Path" character varying(512) NOT NULL, - "LastModified" timestamp with time zone NOT NULL -); - - -ALTER TABLE library."ImageInfos" OWNER TO jellyfin; +ALTER TABLE library.image_infos OWNER TO jellyfin; -- -- Name: ImageInfos_Id_seq; Type: SEQUENCE; Schema: library; Owner: jellyfin -- -ALTER TABLE library."ImageInfos" ALTER COLUMN "Id" ADD GENERATED BY DEFAULT AS IDENTITY ( +ALTER TABLE library.image_infos ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY ( SEQUENCE NAME library."ImageInfos_Id_seq" START WITH 1 INCREMENT BY 1 @@ -548,212 +380,865 @@ ALTER TABLE library."ImageInfos" ALTER COLUMN "Id" ADD GENERATED BY DEFAULT AS I -- --- Name: ItemValues; Type: TABLE; Schema: library; Owner: jellyfin +-- Name: ancestor_ids; Type: TABLE; Schema: library; Owner: jellyfin -- -CREATE TABLE library."ItemValues" ( - "ItemValueId" uuid NOT NULL, - "Type" integer NOT NULL, - "Value" text NOT NULL, - "CleanValue" text NOT NULL +CREATE TABLE library.ancestor_ids ( + parent_item_id uuid CONSTRAINT "AncestorIds_ParentItemId_not_null" NOT NULL, + item_id uuid CONSTRAINT "AncestorIds_ItemId_not_null" NOT NULL ); -ALTER TABLE library."ItemValues" OWNER TO jellyfin; +ALTER TABLE library.ancestor_ids OWNER TO jellyfin; -- --- Name: ItemValuesMap; Type: TABLE; Schema: library; Owner: jellyfin +-- Name: attachment_stream_infos; Type: TABLE; Schema: library; Owner: jellyfin -- -CREATE TABLE library."ItemValuesMap" ( - "ItemId" uuid NOT NULL, - "ItemValueId" uuid NOT NULL +CREATE TABLE library.attachment_stream_infos ( + item_id uuid CONSTRAINT "AttachmentStreamInfos_ItemId_not_null" NOT NULL, + index integer CONSTRAINT "AttachmentStreamInfos_Index_not_null" NOT NULL, + codec text, + codec_tag text, + comment text, + filename text, + mime_type text ); -ALTER TABLE library."ItemValuesMap" OWNER TO jellyfin; +ALTER TABLE library.attachment_stream_infos OWNER TO jellyfin; -- --- Name: KeyframeData; Type: TABLE; Schema: library; Owner: jellyfin +-- Name: audio_stream_details; Type: TABLE; Schema: library; Owner: postgres -- -CREATE TABLE library."KeyframeData" ( - "ItemId" uuid NOT NULL, - "TotalDuration" bigint NOT NULL, - "KeyframeTicks" bigint[] +CREATE TABLE library.audio_stream_details ( + item_id uuid CONSTRAINT "AudioStreamDetails_ItemId_not_null" NOT NULL, + stream_index integer CONSTRAINT "AudioStreamDetails_StreamIndex_not_null" NOT NULL, + channel_layout text, + channels integer, + sample_rate integer, + is_hearing_impaired boolean ); -ALTER TABLE library."KeyframeData" OWNER TO jellyfin; +ALTER TABLE library.audio_stream_details OWNER TO postgres; -- --- Name: LibraryOptions; Type: TABLE; Schema: library; Owner: postgres +-- Name: base_item_audio_extras; Type: TABLE; Schema: library; Owner: postgres -- -CREATE TABLE library."LibraryOptions" ( - "LibraryPath" text NOT NULL, - "OptionsJson" jsonb NOT NULL, - "Version" integer DEFAULT 1 NOT NULL, - "DateCreated" timestamp with time zone DEFAULT now() NOT NULL, - "DateModified" timestamp with time zone DEFAULT now() NOT NULL +CREATE TABLE library.base_item_audio_extras ( + item_id uuid CONSTRAINT "BaseItemAudioExtras_ItemId_not_null" NOT NULL, + album text, + artists text, + album_artists text, + lufs real, + normalization_gain real ); -ALTER TABLE library."LibraryOptions" OWNER TO postgres; +ALTER TABLE library.base_item_audio_extras OWNER TO postgres; -- --- Name: MediaSegments; Type: TABLE; Schema: library; Owner: jellyfin +-- Name: base_item_image_infos; Type: TABLE; Schema: library; Owner: jellyfin -- -CREATE TABLE library."MediaSegments" ( - "Id" uuid NOT NULL, - "ItemId" uuid NOT NULL, - "Type" integer NOT NULL, - "EndTicks" bigint NOT NULL, - "StartTicks" bigint NOT NULL, - "SegmentProviderId" text NOT NULL +CREATE TABLE library.base_item_image_infos ( + id uuid CONSTRAINT "BaseItemImageInfos_Id_not_null" NOT NULL, + path text CONSTRAINT "BaseItemImageInfos_Path_not_null" NOT NULL, + date_modified timestamp with time zone, + image_type integer CONSTRAINT "BaseItemImageInfos_ImageType_not_null" NOT NULL, + width integer CONSTRAINT "BaseItemImageInfos_Width_not_null" NOT NULL, + height integer CONSTRAINT "BaseItemImageInfos_Height_not_null" NOT NULL, + blurhash bytea, + item_id uuid CONSTRAINT "BaseItemImageInfos_ItemId_not_null" NOT NULL ); -ALTER TABLE library."MediaSegments" OWNER TO jellyfin; +ALTER TABLE library.base_item_image_infos OWNER TO jellyfin; -- --- Name: MediaStreamInfos; Type: TABLE; Schema: library; Owner: jellyfin +-- Name: base_item_live_tv_extras; Type: TABLE; Schema: library; Owner: postgres -- -CREATE TABLE library."MediaStreamInfos" ( - "ItemId" uuid NOT NULL, - "StreamIndex" integer NOT NULL, - "StreamType" integer NOT NULL, - "Codec" text, - "Language" text, - "ChannelLayout" text, - "Profile" text, - "AspectRatio" text, - "Path" text, - "IsInterlaced" boolean, - "BitRate" integer, - "Channels" integer, - "SampleRate" integer, - "IsDefault" boolean NOT NULL, - "IsForced" boolean NOT NULL, - "IsExternal" boolean NOT NULL, - "Height" integer, - "Width" integer, - "AverageFrameRate" real, - "RealFrameRate" real, - "Level" real, - "PixelFormat" text, - "BitDepth" integer, - "IsAnamorphic" boolean, - "RefFrames" integer, - "CodecTag" text, - "Comment" text, - "NalLengthSize" text, - "IsAvc" boolean, - "Title" text, - "TimeBase" text, - "CodecTimeBase" text, - "ColorPrimaries" text, - "ColorSpace" text, - "ColorTransfer" text, - "DvVersionMajor" integer, - "DvVersionMinor" integer, - "DvProfile" integer, - "DvLevel" integer, - "RpuPresentFlag" integer, - "ElPresentFlag" integer, - "BlPresentFlag" integer, - "DvBlSignalCompatibilityId" integer, - "IsHearingImpaired" boolean, - "Rotation" integer, - "KeyFrames" text, - "Hdr10PlusPresentFlag" boolean +CREATE TABLE library.base_item_live_tv_extras ( + item_id uuid CONSTRAINT "BaseItemLiveTvExtras_ItemId_not_null" NOT NULL, + start_date timestamp with time zone, + end_date timestamp with time zone, + episode_title text, + show_id text, + external_series_id text, + external_service_id text, + audio integer ); -ALTER TABLE library."MediaStreamInfos" OWNER TO jellyfin; +ALTER TABLE library.base_item_live_tv_extras OWNER TO postgres; -- --- Name: PeopleBaseItemMap; Type: TABLE; Schema: library; Owner: jellyfin +-- Name: base_item_metadata_fields; Type: TABLE; Schema: library; Owner: jellyfin -- -CREATE TABLE library."PeopleBaseItemMap" ( - "Role" text NOT NULL, - "ItemId" uuid NOT NULL, - "PeopleId" uuid NOT NULL, - "SortOrder" integer, - "ListOrder" integer +CREATE TABLE library.base_item_metadata_fields ( + id integer CONSTRAINT "BaseItemMetadataFields_Id_not_null" NOT NULL, + item_id uuid CONSTRAINT "BaseItemMetadataFields_ItemId_not_null" NOT NULL ); -ALTER TABLE library."PeopleBaseItemMap" OWNER TO jellyfin; +ALTER TABLE library.base_item_metadata_fields OWNER TO jellyfin; -- --- Name: Peoples; Type: TABLE; Schema: library; Owner: jellyfin +-- Name: base_item_providers; Type: TABLE; Schema: library; Owner: jellyfin -- -CREATE TABLE library."Peoples" ( - "Id" uuid NOT NULL, - "Name" text NOT NULL, - "PersonType" text +CREATE TABLE library.base_item_providers ( + item_id uuid CONSTRAINT "BaseItemProviders_ItemId_not_null" NOT NULL, + provider_id text CONSTRAINT "BaseItemProviders_ProviderId_not_null" NOT NULL, + provider_value text CONSTRAINT "BaseItemProviders_ProviderValue_not_null" NOT NULL ); -ALTER TABLE library."Peoples" OWNER TO jellyfin; +ALTER TABLE library.base_item_providers OWNER TO jellyfin; -- --- Name: TrickplayInfos; Type: TABLE; Schema: library; Owner: jellyfin +-- Name: base_item_trailer_types; Type: TABLE; Schema: library; Owner: jellyfin -- -CREATE TABLE library."TrickplayInfos" ( - "ItemId" uuid NOT NULL, - "Width" integer NOT NULL, - "Height" integer NOT NULL, - "TileWidth" integer NOT NULL, - "TileHeight" integer NOT NULL, - "ThumbnailCount" integer NOT NULL, - "Interval" integer NOT NULL, - "Bandwidth" integer NOT NULL +CREATE TABLE library.base_item_trailer_types ( + id integer CONSTRAINT "BaseItemTrailerTypes_Id_not_null" NOT NULL, + item_id uuid CONSTRAINT "BaseItemTrailerTypes_ItemId_not_null" NOT NULL ); -ALTER TABLE library."TrickplayInfos" OWNER TO jellyfin; +ALTER TABLE library.base_item_trailer_types OWNER TO jellyfin; -- --- Name: UserData; Type: TABLE; Schema: library; Owner: jellyfin +-- Name: base_item_tv_extras; Type: TABLE; Schema: library; Owner: postgres -- -CREATE TABLE library."UserData" ( - "CustomDataKey" text NOT NULL, - "ItemId" uuid NOT NULL, - "UserId" uuid NOT NULL, - "Rating" double precision, - "PlaybackPositionTicks" bigint NOT NULL, - "PlayCount" integer NOT NULL, - "IsFavorite" boolean NOT NULL, - "LastPlayedDate" timestamp with time zone, - "Played" boolean NOT NULL, - "AudioStreamIndex" integer, - "SubtitleStreamIndex" integer, - "Likes" boolean, - "RetentionDate" timestamp with time zone +CREATE TABLE library.base_item_tv_extras ( + item_id uuid CONSTRAINT "BaseItemTvExtras_ItemId_not_null" NOT NULL, + series_id uuid, + season_id uuid, + series_name text, + season_name text, + series_presentation_unique_key text ); -ALTER TABLE library."UserData" OWNER TO jellyfin; +ALTER TABLE library.base_item_tv_extras OWNER TO postgres; -- --- Name: __EFMigrationsHistory; Type: TABLE; Schema: public; Owner: jellyfin +-- Name: base_items; Type: TABLE; Schema: library; Owner: jellyfin -- -CREATE TABLE public."__EFMigrationsHistory" ( - "MigrationId" character varying(150) NOT NULL, - "ProductVersion" character varying(32) NOT NULL +CREATE TABLE library.base_items ( + id uuid CONSTRAINT "BaseItems_Id_not_null" NOT NULL, + type text CONSTRAINT "BaseItems_Type_not_null" NOT NULL, + data text, + path text, + channel_id uuid, + is_movie boolean CONSTRAINT "BaseItems_IsMovie_not_null" NOT NULL, + community_rating real, + custom_rating text, + index_number integer, + is_locked boolean CONSTRAINT "BaseItems_IsLocked_not_null" NOT NULL, + name text, + official_rating text, + media_type text, + overview text, + parent_index_number integer, + premiere_date timestamp with time zone, + production_year integer, + genres text, + sort_name text, + forced_sort_name text, + run_time_ticks bigint, + date_created timestamp with time zone, + date_modified timestamp with time zone, + is_series boolean CONSTRAINT "BaseItems_IsSeries_not_null" NOT NULL, + is_repeat boolean CONSTRAINT "BaseItems_IsRepeat_not_null" NOT NULL, + preferred_metadata_language text, + preferred_metadata_country_code text, + date_last_refreshed timestamp with time zone, + date_last_saved timestamp with time zone, + is_in_mixed_folder boolean CONSTRAINT "BaseItems_IsInMixedFolder_not_null" NOT NULL, + studios text, + tags text, + is_folder boolean CONSTRAINT "BaseItems_IsFolder_not_null" NOT NULL, + inherited_parental_rating_value integer, + inherited_parental_rating_sub_value integer, + unrated_type text, + critic_rating real, + clean_name text, + presentation_unique_key text, + original_title text, + primary_version_id text, + date_last_media_added timestamp with time zone, + is_virtual_item boolean CONSTRAINT "BaseItems_IsVirtualItem_not_null" NOT NULL, + tagline text, + production_locations text, + extra_ids text, + total_bitrate integer, + extra_type integer, + external_id text, + owner_id text, + width integer, + height integer, + size bigint, + parent_id uuid, + top_parent_id uuid ); -ALTER TABLE public."__EFMigrationsHistory" OWNER TO jellyfin; +ALTER TABLE library.base_items OWNER TO jellyfin; + +-- +-- Name: base_items_v; Type: VIEW; Schema: library; Owner: postgres +-- + +CREATE VIEW library.base_items_v AS + SELECT b.id, + b.type, + b.data, + b.path, + b.channel_id, + b.is_movie, + b.community_rating, + b.custom_rating, + b.index_number, + b.is_locked, + b.name, + b.official_rating, + b.media_type, + b.overview, + b.parent_index_number, + b.premiere_date, + b.production_year, + b.genres, + b.sort_name, + b.forced_sort_name, + b.run_time_ticks, + b.date_created, + b.date_modified, + b.is_series, + b.is_repeat, + b.preferred_metadata_language, + b.preferred_metadata_country_code, + b.date_last_refreshed, + b.date_last_saved, + b.is_in_mixed_folder, + b.studios, + b.tags, + b.is_folder, + b.inherited_parental_rating_value, + b.inherited_parental_rating_sub_value, + b.unrated_type, + b.critic_rating, + b.clean_name, + b.presentation_unique_key, + b.original_title, + b.primary_version_id, + b.date_last_media_added, + b.is_virtual_item, + b.tagline, + b.production_locations, + b.extra_ids, + b.total_bitrate, + b.extra_type, + b.external_id, + b.owner_id, + b.width, + b.height, + b.size, + b.parent_id, + b.top_parent_id, + tv.series_id, + tv.season_id, + tv.series_name, + tv.season_name, + tv.series_presentation_unique_key, + ltv.start_date, + ltv.end_date, + ltv.episode_title, + ltv.show_id, + ltv.external_series_id, + ltv.external_service_id, + ltv.audio, + au.album, + au.artists, + au.album_artists, + au.lufs, + au.normalization_gain + FROM (((library.base_items b + LEFT JOIN library.base_item_tv_extras tv ON ((tv.item_id = b.id))) + LEFT JOIN library.base_item_live_tv_extras ltv ON ((ltv.item_id = b.id))) + LEFT JOIN library.base_item_audio_extras au ON ((au.item_id = b.id))); + + +ALTER VIEW library.base_items_v OWNER TO postgres; + +-- +-- Name: chapters; Type: TABLE; Schema: library; Owner: jellyfin +-- + +CREATE TABLE library.chapters ( + item_id uuid CONSTRAINT "Chapters_ItemId_not_null" NOT NULL, + chapter_index integer CONSTRAINT "Chapters_ChapterIndex_not_null" NOT NULL, + start_position_ticks bigint CONSTRAINT "Chapters_StartPositionTicks_not_null" NOT NULL, + name text, + image_path text, + image_date_modified timestamp with time zone +); + + +ALTER TABLE library.chapters OWNER TO jellyfin; + +-- +-- Name: people_base_item_map; Type: TABLE; Schema: library; Owner: jellyfin +-- + +CREATE TABLE library.people_base_item_map ( + role text CONSTRAINT "PeopleBaseItemMap_Role_not_null" NOT NULL, + item_id uuid CONSTRAINT "PeopleBaseItemMap_ItemId_not_null" NOT NULL, + people_id uuid CONSTRAINT "PeopleBaseItemMap_PeopleId_not_null" NOT NULL, + sort_order integer, + list_order integer +); + + +ALTER TABLE library.people_base_item_map OWNER TO jellyfin; + +-- +-- Name: peoples; Type: TABLE; Schema: library; Owner: jellyfin +-- + +CREATE TABLE library.peoples ( + id uuid CONSTRAINT "Peoples_Id_not_null" NOT NULL, + name text CONSTRAINT "Peoples_Name_not_null" NOT NULL, + person_type text +); + + +ALTER TABLE library.peoples OWNER TO jellyfin; + +-- +-- Name: item_people_v; Type: VIEW; Schema: library; Owner: postgres +-- + +CREATE VIEW library.item_people_v AS + SELECT b.id AS item_id, + b.type AS item_type, + b.name AS item_name, + tv.series_name, + b.production_year, + pe.id AS person_id, + pe.name AS person_name, + pe.person_type, + pm.role, + pm.sort_order, + pm.list_order + FROM (((library.people_base_item_map pm + JOIN library.base_items b ON ((pm.item_id = b.id))) + JOIN library.peoples pe ON ((pm.people_id = pe.id))) + LEFT JOIN library.base_item_tv_extras tv ON ((tv.item_id = b.id))) + WHERE (b.is_virtual_item = false); + + +ALTER VIEW library.item_people_v OWNER TO postgres; + +-- +-- Name: item_providers_v; Type: VIEW; Schema: library; Owner: postgres +-- + +CREATE VIEW library.item_providers_v AS + SELECT b.id AS item_id, + b.type, + b.name, + b.original_title, + b.production_year, + tv.series_name, + b.index_number AS episode_number, + b.parent_index_number AS season_number, + max( + CASE + WHEN (p.provider_id = 'Imdb'::text) THEN p.provider_value + ELSE NULL::text + END) AS imdb_id, + max( + CASE + WHEN (p.provider_id = 'Tmdb'::text) THEN p.provider_value + ELSE NULL::text + END) AS tmdb_id, + max( + CASE + WHEN (p.provider_id = 'Tvdb'::text) THEN p.provider_value + ELSE NULL::text + END) AS tvdb_id, + max( + CASE + WHEN (p.provider_id = 'TvRage'::text) THEN p.provider_value + ELSE NULL::text + END) AS tv_rage_id, + max( + CASE + WHEN (p.provider_id = 'MusicBrainzAlbum'::text) THEN p.provider_value + ELSE NULL::text + END) AS music_brainz_album_id, + max( + CASE + WHEN (p.provider_id = 'MusicBrainzArtist'::text) THEN p.provider_value + ELSE NULL::text + END) AS music_brainz_artist_id, + CASE + WHEN (count( + CASE + WHEN (p.provider_id <> ALL (ARRAY['Imdb'::text, 'Tmdb'::text, 'Tvdb'::text, 'TvRage'::text, 'MusicBrainzAlbum'::text, 'MusicBrainzArtist'::text])) THEN 1 + ELSE NULL::integer + END) > 0) THEN (jsonb_object_agg(p.provider_id, p.provider_value) FILTER (WHERE (p.provider_id <> ALL (ARRAY['Imdb'::text, 'Tmdb'::text, 'Tvdb'::text, 'TvRage'::text, 'MusicBrainzAlbum'::text, 'MusicBrainzArtist'::text]))))::text + ELSE NULL::text + END AS other_providers + FROM ((library.base_items b + LEFT JOIN library.base_item_providers p ON ((b.id = p.item_id))) + LEFT JOIN library.base_item_tv_extras tv ON ((b.id = tv.item_id))) + WHERE (b.is_virtual_item = false) + GROUP BY b.id, b.type, b.name, b.original_title, b.production_year, tv.series_name, b.index_number, b.parent_index_number; + + +ALTER VIEW library.item_providers_v OWNER TO postgres; + +-- +-- Name: item_values; Type: TABLE; Schema: library; Owner: jellyfin +-- + +CREATE TABLE library.item_values ( + item_value_id uuid CONSTRAINT "ItemValues_ItemValueId_not_null" NOT NULL, + type integer CONSTRAINT "ItemValues_Type_not_null" NOT NULL, + value text CONSTRAINT "ItemValues_Value_not_null" NOT NULL, + clean_value text CONSTRAINT "ItemValues_CleanValue_not_null" NOT NULL +); + + +ALTER TABLE library.item_values OWNER TO jellyfin; + +-- +-- Name: item_values_map; Type: TABLE; Schema: library; Owner: jellyfin +-- + +CREATE TABLE library.item_values_map ( + item_id uuid CONSTRAINT "ItemValuesMap_ItemId_not_null" NOT NULL, + item_value_id uuid CONSTRAINT "ItemValuesMap_ItemValueId_not_null" NOT NULL +); + + +ALTER TABLE library.item_values_map OWNER TO jellyfin; + +-- +-- Name: keyframe_data; Type: TABLE; Schema: library; Owner: jellyfin +-- + +CREATE TABLE library.keyframe_data ( + item_id uuid CONSTRAINT "KeyframeData_ItemId_not_null" NOT NULL, + total_duration bigint CONSTRAINT "KeyframeData_TotalDuration_not_null" NOT NULL, + keyframe_ticks bigint[] +); + + +ALTER TABLE library.keyframe_data OWNER TO jellyfin; + +-- +-- Name: library_options; Type: TABLE; Schema: library; Owner: postgres +-- + +CREATE TABLE library.library_options ( + library_path text CONSTRAINT "LibraryOptions_LibraryPath_not_null" NOT NULL, + options_json jsonb CONSTRAINT "LibraryOptions_OptionsJson_not_null" NOT NULL, + version integer DEFAULT 1 CONSTRAINT "LibraryOptions_Version_not_null" NOT NULL, + date_created timestamp with time zone DEFAULT now() CONSTRAINT "LibraryOptions_DateCreated_not_null" NOT NULL, + date_modified timestamp with time zone DEFAULT now() CONSTRAINT "LibraryOptions_DateModified_not_null" NOT NULL +); + + +ALTER TABLE library.library_options OWNER TO postgres; + +-- +-- Name: media_stream_infos; Type: TABLE; Schema: library; Owner: jellyfin +-- + +CREATE TABLE library.media_stream_infos ( + item_id uuid CONSTRAINT "MediaStreamInfos_ItemId_not_null" NOT NULL, + stream_index integer CONSTRAINT "MediaStreamInfos_StreamIndex_not_null" NOT NULL, + stream_type integer CONSTRAINT "MediaStreamInfos_StreamType_not_null" NOT NULL, + codec text, + language text, + profile text, + path text, + bit_rate integer, + is_default boolean CONSTRAINT "MediaStreamInfos_IsDefault_not_null" NOT NULL, + is_forced boolean CONSTRAINT "MediaStreamInfos_IsForced_not_null" NOT NULL, + is_external boolean CONSTRAINT "MediaStreamInfos_IsExternal_not_null" NOT NULL, + level real, + codec_tag text, + comment text, + is_avc boolean, + title text, + time_base text, + codec_time_base text +); + + +ALTER TABLE library.media_stream_infos OWNER TO jellyfin; + +-- +-- Name: video_stream_details; Type: TABLE; Schema: library; Owner: postgres +-- + +CREATE TABLE library.video_stream_details ( + item_id uuid CONSTRAINT "VideoStreamDetails_ItemId_not_null" NOT NULL, + stream_index integer CONSTRAINT "VideoStreamDetails_StreamIndex_not_null" NOT NULL, + aspect_ratio text, + is_interlaced boolean, + height integer, + width integer, + average_frame_rate real, + real_frame_rate real, + pixel_format text, + bit_depth integer, + is_anamorphic boolean, + ref_frames integer, + nal_length_size text, + color_primaries text, + color_space text, + color_transfer text, + dv_version_major integer, + dv_version_minor integer, + dv_profile integer, + dv_level integer, + rpu_present_flag integer, + el_present_flag integer, + bl_present_flag integer, + dv_bl_signal_compatibility_id integer, + rotation integer, + key_frames text, + hdr10_plus_present_flag boolean +); + + +ALTER TABLE library.video_stream_details OWNER TO postgres; + +-- +-- Name: library_summary_v; Type: VIEW; Schema: library; Owner: postgres +-- + +CREATE VIEW library.library_summary_v AS + WITH primary_video AS ( + SELECT DISTINCT ON (m.item_id) m.item_id, + vd.height, + vd.dv_profile, + vd.hdr10_plus_present_flag, + vd.color_transfer + FROM (library.media_stream_infos m + JOIN library.video_stream_details vd ON (((vd.item_id = m.item_id) AND (vd.stream_index = m.stream_index)))) + WHERE (m.stream_type = 1) + ORDER BY m.item_id, m.stream_index + ) + SELECT b.type, + count(*) AS item_count, + count(*) FILTER (WHERE (b.production_year IS NOT NULL)) AS with_year, + min(b.production_year) AS oldest_year, + max(b.production_year) AS newest_year, + round((avg(b.community_rating))::numeric, 2) AS avg_community_rating, + sum(b.run_time_ticks) AS total_run_time_ticks, + round((COALESCE(sum(b.run_time_ticks), (0)::numeric) / 600000000.0), 1) AS total_runtime_hours, + sum(b.size) AS total_size_bytes, + round((COALESCE(sum(b.size), (0)::numeric) / (1024.0 ^ (3)::numeric)), 2) AS total_size_gb, + count(*) FILTER (WHERE (pv.height >= 2160)) AS count4_k, + count(*) FILTER (WHERE ((pv.height >= 1080) AND (pv.height <= 2159))) AS count1080p, + count(*) FILTER (WHERE ((pv.height >= 720) AND (pv.height <= 1079))) AS count720p, + count(*) FILTER (WHERE ((pv.height < 720) AND (pv.height IS NOT NULL))) AS count_sd, + count(*) FILTER (WHERE (pv.dv_profile IS NOT NULL)) AS count_dolby_vision, + count(*) FILTER (WHERE (pv.hdr10_plus_present_flag = true)) AS count_hdr10_plus, + count(*) FILTER (WHERE ((pv.color_transfer = 'smpte2084'::text) AND (pv.dv_profile IS NULL) AND (pv.hdr10_plus_present_flag IS NOT TRUE))) AS count_hdr10 + FROM (library.base_items b + LEFT JOIN primary_video pv ON ((pv.item_id = b.id))) + WHERE ((b.is_virtual_item = false) AND (b.is_folder = false)) + GROUP BY b.type + ORDER BY (count(*)) DESC; + + +ALTER VIEW library.library_summary_v OWNER TO postgres; + +-- +-- Name: media_segments; Type: TABLE; Schema: library; Owner: jellyfin +-- + +CREATE TABLE library.media_segments ( + id uuid CONSTRAINT "MediaSegments_Id_not_null" NOT NULL, + item_id uuid CONSTRAINT "MediaSegments_ItemId_not_null" NOT NULL, + type integer CONSTRAINT "MediaSegments_Type_not_null" NOT NULL, + end_ticks bigint CONSTRAINT "MediaSegments_EndTicks_not_null" NOT NULL, + start_ticks bigint CONSTRAINT "MediaSegments_StartTicks_not_null" NOT NULL, + segment_provider_id text CONSTRAINT "MediaSegments_SegmentProviderId_not_null" NOT NULL +); + + +ALTER TABLE library.media_segments OWNER TO jellyfin; + +-- +-- Name: media_stream_infos_v; Type: VIEW; Schema: library; Owner: postgres +-- + +CREATE VIEW library.media_stream_infos_v AS + SELECT m.item_id, + m.stream_index, + m.stream_type, + m.codec, + m.language, + m.profile, + m.path, + m.bit_rate, + m.is_default, + m.is_forced, + m.is_external, + m.level, + m.codec_tag, + m.comment, + m.is_avc, + m.title, + m.time_base, + m.codec_time_base, + a.channel_layout, + a.channels, + a.sample_rate, + a.is_hearing_impaired, + v.aspect_ratio, + v.is_interlaced, + v.height, + v.width, + v.average_frame_rate, + v.real_frame_rate, + v.pixel_format, + v.bit_depth, + v.is_anamorphic, + v.ref_frames, + v.nal_length_size, + v.color_primaries, + v.color_space, + v.color_transfer, + v.dv_version_major, + v.dv_version_minor, + v.dv_profile, + v.dv_level, + v.rpu_present_flag, + v.el_present_flag, + v.bl_present_flag, + v.dv_bl_signal_compatibility_id, + v.rotation, + v.key_frames, + v.hdr10_plus_present_flag + FROM ((library.media_stream_infos m + LEFT JOIN library.audio_stream_details a ON (((m.item_id = a.item_id) AND (m.stream_index = a.stream_index)))) + LEFT JOIN library.video_stream_details v ON (((m.item_id = v.item_id) AND (m.stream_index = v.stream_index)))); + + +ALTER VIEW library.media_stream_infos_v OWNER TO postgres; + +-- +-- Name: trickplay_infos; Type: TABLE; Schema: library; Owner: jellyfin +-- + +CREATE TABLE library.trickplay_infos ( + item_id uuid CONSTRAINT "TrickplayInfos_ItemId_not_null" NOT NULL, + width integer CONSTRAINT "TrickplayInfos_Width_not_null" NOT NULL, + height integer CONSTRAINT "TrickplayInfos_Height_not_null" NOT NULL, + tile_width integer CONSTRAINT "TrickplayInfos_TileWidth_not_null" NOT NULL, + tile_height integer CONSTRAINT "TrickplayInfos_TileHeight_not_null" NOT NULL, + thumbnail_count integer CONSTRAINT "TrickplayInfos_ThumbnailCount_not_null" NOT NULL, + "interval" integer CONSTRAINT "TrickplayInfos_Interval_not_null" NOT NULL, + bandwidth integer CONSTRAINT "TrickplayInfos_Bandwidth_not_null" NOT NULL +); + + +ALTER TABLE library.trickplay_infos OWNER TO jellyfin; + +-- +-- Name: user_data; Type: TABLE; Schema: library; Owner: jellyfin +-- + +CREATE TABLE library.user_data ( + custom_data_key text CONSTRAINT "UserData_CustomDataKey_not_null" NOT NULL, + item_id uuid CONSTRAINT "UserData_ItemId_not_null" NOT NULL, + user_id uuid CONSTRAINT "UserData_UserId_not_null" NOT NULL, + rating double precision, + playback_position_ticks bigint CONSTRAINT "UserData_PlaybackPositionTicks_not_null" NOT NULL, + play_count integer CONSTRAINT "UserData_PlayCount_not_null" NOT NULL, + is_favorite boolean CONSTRAINT "UserData_IsFavorite_not_null" NOT NULL, + last_played_date timestamp with time zone, + played boolean CONSTRAINT "UserData_Played_not_null" NOT NULL, + audio_stream_index integer, + subtitle_stream_index integer, + likes boolean, + retention_date timestamp with time zone +); + + +ALTER TABLE library.user_data OWNER TO jellyfin; + +-- +-- Name: users; Type: TABLE; Schema: users; Owner: jellyfin +-- + +CREATE TABLE users.users ( + id uuid CONSTRAINT "Users_Id_not_null" NOT NULL, + username character varying(255) CONSTRAINT "Users_Username_not_null" NOT NULL, + password character varying(65535), + must_update_password boolean CONSTRAINT "Users_MustUpdatePassword_not_null" NOT NULL, + audio_language_preference character varying(255), + authentication_provider_id character varying(255) CONSTRAINT "Users_AuthenticationProviderId_not_null" NOT NULL, + password_reset_provider_id character varying(255) CONSTRAINT "Users_PasswordResetProviderId_not_null" NOT NULL, + invalid_login_attempt_count integer CONSTRAINT "Users_InvalidLoginAttemptCount_not_null" NOT NULL, + last_activity_date timestamp with time zone, + last_login_date timestamp with time zone, + login_attempts_before_lockout integer, + max_active_sessions integer CONSTRAINT "Users_MaxActiveSessions_not_null" NOT NULL, + subtitle_mode integer CONSTRAINT "Users_SubtitleMode_not_null" NOT NULL, + play_default_audio_track boolean CONSTRAINT "Users_PlayDefaultAudioTrack_not_null" NOT NULL, + subtitle_language_preference character varying(255), + display_missing_episodes boolean CONSTRAINT "Users_DisplayMissingEpisodes_not_null" NOT NULL, + display_collections_view boolean CONSTRAINT "Users_DisplayCollectionsView_not_null" NOT NULL, + enable_local_password boolean CONSTRAINT "Users_EnableLocalPassword_not_null" NOT NULL, + hide_played_in_latest boolean CONSTRAINT "Users_HidePlayedInLatest_not_null" NOT NULL, + remember_audio_selections boolean CONSTRAINT "Users_RememberAudioSelections_not_null" NOT NULL, + remember_subtitle_selections boolean CONSTRAINT "Users_RememberSubtitleSelections_not_null" NOT NULL, + enable_next_episode_auto_play boolean CONSTRAINT "Users_EnableNextEpisodeAutoPlay_not_null" NOT NULL, + enable_auto_login boolean CONSTRAINT "Users_EnableAutoLogin_not_null" NOT NULL, + enable_user_preference_access boolean CONSTRAINT "Users_EnableUserPreferenceAccess_not_null" NOT NULL, + max_parental_rating_score integer, + max_parental_rating_sub_score integer, + remote_client_bitrate_limit integer, + internal_id bigint CONSTRAINT "Users_InternalId_not_null" NOT NULL, + sync_play_access integer CONSTRAINT "Users_SyncPlayAccess_not_null" NOT NULL, + cast_receiver_id character varying(32), + row_version bigint CONSTRAINT "Users_RowVersion_not_null" NOT NULL +); + + +ALTER TABLE users.users OWNER TO jellyfin; + +-- +-- Name: user_playback_history_v; Type: VIEW; Schema: library; Owner: postgres +-- + +CREATE VIEW library.user_playback_history_v AS + SELECT u.username, + u.id AS user_id, + b.name AS item_name, + b.type AS item_type, + tv.series_name, + tv.season_name, + b.index_number AS episode_number, + b.parent_index_number AS season_number, + b.production_year, + b.run_time_ticks, + ud.item_id, + ud.played, + ud.play_count, + ud.last_played_date, + ud.playback_position_ticks, + CASE + WHEN (b.run_time_ticks > 0) THEN round((((ud.playback_position_ticks)::numeric * (100)::numeric) / (b.run_time_ticks)::numeric), 1) + ELSE NULL::numeric + END AS progress_pct, + ud.is_favorite, + ud.rating, + ud.audio_stream_index, + ud.subtitle_stream_index + FROM (((library.user_data ud + JOIN library.base_items b ON ((ud.item_id = b.id))) + JOIN users.users u ON ((ud.user_id = u.id))) + LEFT JOIN library.base_item_tv_extras tv ON ((tv.item_id = b.id))) + WHERE (ud.custom_data_key = ''::text); + + +ALTER VIEW library.user_playback_history_v OWNER TO postgres; + +-- +-- Name: video_items_v; Type: VIEW; Schema: library; Owner: postgres +-- + +CREATE VIEW library.video_items_v AS + SELECT b.id AS item_id, + b.type, + b.name, + b.original_title, + b.production_year, + b.official_rating, + b.community_rating, + b.run_time_ticks, + b.path, + b.date_created, + b.date_modified, + tv.series_name, + tv.season_name, + b.index_number AS episode_number, + b.parent_index_number AS season_number, + b.total_bitrate, + b.size, + m.codec AS video_codec, + m.profile AS video_profile, + vd.width, + vd.height, + vd.average_frame_rate, + vd.bit_depth, + vd.pixel_format, + vd.color_space, + vd.color_transfer, + vd.color_primaries, + vd.is_interlaced, + vd.is_anamorphic, + vd.aspect_ratio, + (vd.dv_profile IS NOT NULL) AS is_dolby_vision, + vd.hdr10_plus_present_flag AS is_hdr10_plus, + CASE + WHEN (vd.dv_profile IS NOT NULL) THEN 'Dolby Vision'::text + WHEN (vd.hdr10_plus_present_flag = true) THEN 'HDR10+'::text + WHEN (vd.color_transfer = 'smpte2084'::text) THEN 'HDR10'::text + WHEN (vd.color_transfer = 'arib-std-b67'::text) THEN 'HLG'::text + ELSE 'SDR'::text + END AS hdr_format, + ( SELECT count(*) AS count + FROM library.media_stream_infos ms + WHERE ((ms.item_id = b.id) AND (ms.stream_type = 0))) AS audio_track_count, + ( SELECT count(*) AS count + FROM library.media_stream_infos ms + WHERE ((ms.item_id = b.id) AND (ms.stream_type = 2))) AS subtitle_track_count + FROM (((library.base_items b + JOIN LATERAL ( SELECT ms.stream_index, + ms.codec, + ms.profile + FROM library.media_stream_infos ms + WHERE ((ms.item_id = b.id) AND (ms.stream_type = 1)) + ORDER BY ms.stream_index + LIMIT 1) m ON (true)) + JOIN library.video_stream_details vd ON (((vd.item_id = b.id) AND (vd.stream_index = m.stream_index)))) + LEFT JOIN library.base_item_tv_extras tv ON ((tv.item_id = b.id))) + WHERE ((b.is_virtual_item = false) AND (b.is_folder = false)); + + +ALTER VIEW library.video_items_v OWNER TO postgres; + +-- +-- Name: __ef_migrations_history; Type: TABLE; Schema: public; Owner: jellyfin +-- + +CREATE TABLE public.__ef_migrations_history ( + migration_id character varying(150) CONSTRAINT "__EFMigrationsHistory_MigrationId_not_null" NOT NULL, + product_version character varying(32) CONSTRAINT "__EFMigrationsHistory_ProductVersion_not_null" NOT NULL +); + + +ALTER TABLE public.__ef_migrations_history OWNER TO jellyfin; -- -- Name: bloat_tables; Type: TABLE; Schema: public; Owner: jellyfin @@ -767,25 +1252,25 @@ CREATE TABLE public.bloat_tables ( ALTER TABLE public.bloat_tables OWNER TO jellyfin; -- --- Name: AccessSchedules; Type: TABLE; Schema: users; Owner: jellyfin +-- Name: access_schedules; Type: TABLE; Schema: users; Owner: jellyfin -- -CREATE TABLE users."AccessSchedules" ( - "Id" integer NOT NULL, - "UserId" uuid NOT NULL, - "DayOfWeek" integer NOT NULL, - "StartHour" double precision NOT NULL, - "EndHour" double precision NOT NULL +CREATE TABLE users.access_schedules ( + id integer CONSTRAINT "AccessSchedules_Id_not_null" NOT NULL, + user_id uuid CONSTRAINT "AccessSchedules_UserId_not_null" NOT NULL, + day_of_week integer CONSTRAINT "AccessSchedules_DayOfWeek_not_null" NOT NULL, + start_hour double precision CONSTRAINT "AccessSchedules_StartHour_not_null" NOT NULL, + end_hour double precision CONSTRAINT "AccessSchedules_EndHour_not_null" NOT NULL ); -ALTER TABLE users."AccessSchedules" OWNER TO jellyfin; +ALTER TABLE users.access_schedules OWNER TO jellyfin; -- -- Name: AccessSchedules_Id_seq; Type: SEQUENCE; Schema: users; Owner: jellyfin -- -ALTER TABLE users."AccessSchedules" ALTER COLUMN "Id" ADD GENERATED BY DEFAULT AS IDENTITY ( +ALTER TABLE users.access_schedules ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY ( SEQUENCE NAME users."AccessSchedules_Id_seq" START WITH 1 INCREMENT BY 1 @@ -796,26 +1281,26 @@ ALTER TABLE users."AccessSchedules" ALTER COLUMN "Id" ADD GENERATED BY DEFAULT A -- --- Name: Permissions; Type: TABLE; Schema: users; Owner: jellyfin +-- Name: permissions; Type: TABLE; Schema: users; Owner: jellyfin -- -CREATE TABLE users."Permissions" ( - "Id" integer NOT NULL, - "UserId" uuid, - "Kind" integer NOT NULL, - "Value" boolean NOT NULL, - "RowVersion" bigint NOT NULL, - "Permission_Permissions_Guid" uuid +CREATE TABLE users.permissions ( + id integer CONSTRAINT "Permissions_Id_not_null" NOT NULL, + user_id uuid, + kind integer CONSTRAINT "Permissions_Kind_not_null" NOT NULL, + value boolean CONSTRAINT "Permissions_Value_not_null" NOT NULL, + row_version bigint CONSTRAINT "Permissions_RowVersion_not_null" NOT NULL, + permission_permissions_guid uuid ); -ALTER TABLE users."Permissions" OWNER TO jellyfin; +ALTER TABLE users.permissions OWNER TO jellyfin; -- -- Name: Permissions_Id_seq; Type: SEQUENCE; Schema: users; Owner: jellyfin -- -ALTER TABLE users."Permissions" ALTER COLUMN "Id" ADD GENERATED BY DEFAULT AS IDENTITY ( +ALTER TABLE users.permissions ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY ( SEQUENCE NAME users."Permissions_Id_seq" START WITH 1 INCREMENT BY 1 @@ -826,26 +1311,26 @@ ALTER TABLE users."Permissions" ALTER COLUMN "Id" ADD GENERATED BY DEFAULT AS ID -- --- Name: Preferences; Type: TABLE; Schema: users; Owner: jellyfin +-- Name: preferences; Type: TABLE; Schema: users; Owner: jellyfin -- -CREATE TABLE users."Preferences" ( - "Id" integer NOT NULL, - "UserId" uuid, - "Kind" integer NOT NULL, - "Value" character varying(65535) NOT NULL, - "RowVersion" bigint NOT NULL, - "Preference_Preferences_Guid" uuid +CREATE TABLE users.preferences ( + id integer CONSTRAINT "Preferences_Id_not_null" NOT NULL, + user_id uuid, + kind integer CONSTRAINT "Preferences_Kind_not_null" NOT NULL, + value character varying(65535) CONSTRAINT "Preferences_Value_not_null" NOT NULL, + row_version bigint CONSTRAINT "Preferences_RowVersion_not_null" NOT NULL, + preference_preferences_guid uuid ); -ALTER TABLE users."Preferences" OWNER TO jellyfin; +ALTER TABLE users.preferences OWNER TO jellyfin; -- -- Name: Preferences_Id_seq; Type: SEQUENCE; Schema: users; Owner: jellyfin -- -ALTER TABLE users."Preferences" ALTER COLUMN "Id" ADD GENERATED BY DEFAULT AS IDENTITY ( +ALTER TABLE users.preferences ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY ( SEQUENCE NAME users."Preferences_Id_seq" START WITH 1 INCREMENT BY 1 @@ -856,788 +1341,822 @@ ALTER TABLE users."Preferences" ALTER COLUMN "Id" ADD GENERATED BY DEFAULT AS ID -- --- Name: Users; Type: TABLE; Schema: users; Owner: jellyfin +-- Name: activity_logs PK_ActivityLogs; Type: CONSTRAINT; Schema: activitylog; Owner: jellyfin -- -CREATE TABLE users."Users" ( - "Id" uuid NOT NULL, - "Username" character varying(255) NOT NULL, - "Password" character varying(65535), - "MustUpdatePassword" boolean NOT NULL, - "AudioLanguagePreference" character varying(255), - "AuthenticationProviderId" character varying(255) NOT NULL, - "PasswordResetProviderId" character varying(255) NOT NULL, - "InvalidLoginAttemptCount" integer NOT NULL, - "LastActivityDate" timestamp with time zone, - "LastLoginDate" timestamp with time zone, - "LoginAttemptsBeforeLockout" integer, - "MaxActiveSessions" integer NOT NULL, - "SubtitleMode" integer NOT NULL, - "PlayDefaultAudioTrack" boolean NOT NULL, - "SubtitleLanguagePreference" character varying(255), - "DisplayMissingEpisodes" boolean NOT NULL, - "DisplayCollectionsView" boolean NOT NULL, - "EnableLocalPassword" boolean NOT NULL, - "HidePlayedInLatest" boolean NOT NULL, - "RememberAudioSelections" boolean NOT NULL, - "RememberSubtitleSelections" boolean NOT NULL, - "EnableNextEpisodeAutoPlay" boolean NOT NULL, - "EnableAutoLogin" boolean NOT NULL, - "EnableUserPreferenceAccess" boolean NOT NULL, - "MaxParentalRatingScore" integer, - "MaxParentalRatingSubScore" integer, - "RemoteClientBitrateLimit" integer, - "InternalId" bigint NOT NULL, - "SyncPlayAccess" integer NOT NULL, - "CastReceiverId" character varying(32), - "RowVersion" bigint NOT NULL -); - - -ALTER TABLE users."Users" OWNER TO jellyfin; - --- --- Name: ActivityLogs PK_ActivityLogs; Type: CONSTRAINT; Schema: activitylog; Owner: jellyfin --- - -ALTER TABLE ONLY activitylog."ActivityLogs" - ADD CONSTRAINT "PK_ActivityLogs" PRIMARY KEY ("Id"); +ALTER TABLE ONLY activitylog.activity_logs + ADD CONSTRAINT "PK_ActivityLogs" PRIMARY KEY (id); -- --- Name: ApiKeys PK_ApiKeys; Type: CONSTRAINT; Schema: authentication; Owner: jellyfin +-- Name: api_keys PK_ApiKeys; Type: CONSTRAINT; Schema: authentication; Owner: jellyfin -- -ALTER TABLE ONLY authentication."ApiKeys" - ADD CONSTRAINT "PK_ApiKeys" PRIMARY KEY ("Id"); +ALTER TABLE ONLY authentication.api_keys + ADD CONSTRAINT "PK_ApiKeys" PRIMARY KEY (id); -- --- Name: DeviceOptions PK_DeviceOptions; Type: CONSTRAINT; Schema: authentication; Owner: jellyfin +-- Name: device_options PK_DeviceOptions; Type: CONSTRAINT; Schema: authentication; Owner: jellyfin -- -ALTER TABLE ONLY authentication."DeviceOptions" - ADD CONSTRAINT "PK_DeviceOptions" PRIMARY KEY ("Id"); +ALTER TABLE ONLY authentication.device_options + ADD CONSTRAINT "PK_DeviceOptions" PRIMARY KEY (id); -- --- Name: Devices PK_Devices; Type: CONSTRAINT; Schema: authentication; Owner: jellyfin +-- Name: devices PK_Devices; Type: CONSTRAINT; Schema: authentication; Owner: jellyfin -- -ALTER TABLE ONLY authentication."Devices" - ADD CONSTRAINT "PK_Devices" PRIMARY KEY ("Id"); +ALTER TABLE ONLY authentication.devices + ADD CONSTRAINT "PK_Devices" PRIMARY KEY (id); -- --- Name: CustomItemDisplayPreferences PK_CustomItemDisplayPreferences; Type: CONSTRAINT; Schema: displaypreferences; Owner: jellyfin +-- Name: custom_item_display_preferences PK_CustomItemDisplayPreferences; Type: CONSTRAINT; Schema: displaypreferences; Owner: jellyfin -- -ALTER TABLE ONLY displaypreferences."CustomItemDisplayPreferences" - ADD CONSTRAINT "PK_CustomItemDisplayPreferences" PRIMARY KEY ("Id"); +ALTER TABLE ONLY displaypreferences.custom_item_display_preferences + ADD CONSTRAINT "PK_CustomItemDisplayPreferences" PRIMARY KEY (id); -- --- Name: DisplayPreferences PK_DisplayPreferences; Type: CONSTRAINT; Schema: displaypreferences; Owner: jellyfin +-- Name: display_preferences PK_DisplayPreferences; Type: CONSTRAINT; Schema: displaypreferences; Owner: jellyfin -- -ALTER TABLE ONLY displaypreferences."DisplayPreferences" - ADD CONSTRAINT "PK_DisplayPreferences" PRIMARY KEY ("Id"); +ALTER TABLE ONLY displaypreferences.display_preferences + ADD CONSTRAINT "PK_DisplayPreferences" PRIMARY KEY (id); -- --- Name: HomeSection PK_HomeSection; Type: CONSTRAINT; Schema: displaypreferences; Owner: jellyfin +-- Name: home_sections PK_HomeSection; Type: CONSTRAINT; Schema: displaypreferences; Owner: jellyfin -- -ALTER TABLE ONLY displaypreferences."HomeSection" - ADD CONSTRAINT "PK_HomeSection" PRIMARY KEY ("Id"); +ALTER TABLE ONLY displaypreferences.home_sections + ADD CONSTRAINT "PK_HomeSection" PRIMARY KEY (id); -- --- Name: ItemDisplayPreferences PK_ItemDisplayPreferences; Type: CONSTRAINT; Schema: displaypreferences; Owner: jellyfin +-- Name: item_display_preferences PK_ItemDisplayPreferences; Type: CONSTRAINT; Schema: displaypreferences; Owner: jellyfin -- -ALTER TABLE ONLY displaypreferences."ItemDisplayPreferences" - ADD CONSTRAINT "PK_ItemDisplayPreferences" PRIMARY KEY ("Id"); +ALTER TABLE ONLY displaypreferences.item_display_preferences + ADD CONSTRAINT "PK_ItemDisplayPreferences" PRIMARY KEY (id); -- --- Name: AncestorIds PK_AncestorIds; Type: CONSTRAINT; Schema: library; Owner: jellyfin +-- Name: base_item_image_infos BaseItemImageInfos_pkey; Type: CONSTRAINT; Schema: library; Owner: jellyfin -- -ALTER TABLE ONLY library."AncestorIds" - ADD CONSTRAINT "PK_AncestorIds" PRIMARY KEY ("ItemId", "ParentItemId"); +ALTER TABLE ONLY library.base_item_image_infos + ADD CONSTRAINT "BaseItemImageInfos_pkey" PRIMARY KEY (id); -- --- Name: AttachmentStreamInfos PK_AttachmentStreamInfos; Type: CONSTRAINT; Schema: library; Owner: jellyfin +-- Name: ancestor_ids PK_AncestorIds; Type: CONSTRAINT; Schema: library; Owner: jellyfin -- -ALTER TABLE ONLY library."AttachmentStreamInfos" - ADD CONSTRAINT "PK_AttachmentStreamInfos" PRIMARY KEY ("ItemId", "Index"); +ALTER TABLE ONLY library.ancestor_ids + ADD CONSTRAINT "PK_AncestorIds" PRIMARY KEY (item_id, parent_item_id); -- --- Name: BaseItemMetadataFields PK_BaseItemMetadataFields; Type: CONSTRAINT; Schema: library; Owner: jellyfin +-- Name: attachment_stream_infos PK_AttachmentStreamInfos; Type: CONSTRAINT; Schema: library; Owner: jellyfin -- -ALTER TABLE ONLY library."BaseItemMetadataFields" - ADD CONSTRAINT "PK_BaseItemMetadataFields" PRIMARY KEY ("Id", "ItemId"); +ALTER TABLE ONLY library.attachment_stream_infos + ADD CONSTRAINT "PK_AttachmentStreamInfos" PRIMARY KEY (item_id, index); -- --- Name: BaseItemProviders PK_BaseItemProviders; Type: CONSTRAINT; Schema: library; Owner: jellyfin +-- Name: audio_stream_details PK_AudioStreamDetails; Type: CONSTRAINT; Schema: library; Owner: postgres -- -ALTER TABLE ONLY library."BaseItemProviders" - ADD CONSTRAINT "PK_BaseItemProviders" PRIMARY KEY ("ItemId", "ProviderId"); +ALTER TABLE ONLY library.audio_stream_details + ADD CONSTRAINT "PK_AudioStreamDetails" PRIMARY KEY (item_id, stream_index); -- --- Name: BaseItemTrailerTypes PK_BaseItemTrailerTypes; Type: CONSTRAINT; Schema: library; Owner: jellyfin +-- Name: base_item_audio_extras PK_BaseItemAudioExtras; Type: CONSTRAINT; Schema: library; Owner: postgres -- -ALTER TABLE ONLY library."BaseItemTrailerTypes" - ADD CONSTRAINT "PK_BaseItemTrailerTypes" PRIMARY KEY ("Id", "ItemId"); +ALTER TABLE ONLY library.base_item_audio_extras + ADD CONSTRAINT "PK_BaseItemAudioExtras" PRIMARY KEY (item_id); -- --- Name: BaseItems PK_BaseItems; Type: CONSTRAINT; Schema: library; Owner: jellyfin +-- Name: base_item_live_tv_extras PK_BaseItemLiveTvExtras; Type: CONSTRAINT; Schema: library; Owner: postgres -- -ALTER TABLE ONLY library."BaseItems" - ADD CONSTRAINT "PK_BaseItems" PRIMARY KEY ("Id"); +ALTER TABLE ONLY library.base_item_live_tv_extras + ADD CONSTRAINT "PK_BaseItemLiveTvExtras" PRIMARY KEY (item_id); -- --- Name: Chapters PK_Chapters; Type: CONSTRAINT; Schema: library; Owner: jellyfin +-- Name: base_item_metadata_fields PK_BaseItemMetadataFields; Type: CONSTRAINT; Schema: library; Owner: jellyfin -- -ALTER TABLE ONLY library."Chapters" - ADD CONSTRAINT "PK_Chapters" PRIMARY KEY ("ItemId", "ChapterIndex"); +ALTER TABLE ONLY library.base_item_metadata_fields + ADD CONSTRAINT "PK_BaseItemMetadataFields" PRIMARY KEY (id, item_id); -- --- Name: ImageInfos PK_ImageInfos; Type: CONSTRAINT; Schema: library; Owner: jellyfin +-- Name: base_item_providers PK_BaseItemProviders; Type: CONSTRAINT; Schema: library; Owner: jellyfin -- -ALTER TABLE ONLY library."ImageInfos" - ADD CONSTRAINT "PK_ImageInfos" PRIMARY KEY ("Id"); +ALTER TABLE ONLY library.base_item_providers + ADD CONSTRAINT "PK_BaseItemProviders" PRIMARY KEY (item_id, provider_id); -- --- Name: ItemValues PK_ItemValues; Type: CONSTRAINT; Schema: library; Owner: jellyfin +-- Name: base_item_trailer_types PK_BaseItemTrailerTypes; Type: CONSTRAINT; Schema: library; Owner: jellyfin -- -ALTER TABLE ONLY library."ItemValues" - ADD CONSTRAINT "PK_ItemValues" PRIMARY KEY ("ItemValueId"); +ALTER TABLE ONLY library.base_item_trailer_types + ADD CONSTRAINT "PK_BaseItemTrailerTypes" PRIMARY KEY (id, item_id); -- --- Name: KeyframeData PK_KeyframeData; Type: CONSTRAINT; Schema: library; Owner: jellyfin +-- Name: base_item_tv_extras PK_BaseItemTvExtras; Type: CONSTRAINT; Schema: library; Owner: postgres -- -ALTER TABLE ONLY library."KeyframeData" - ADD CONSTRAINT "PK_KeyframeData" PRIMARY KEY ("ItemId"); +ALTER TABLE ONLY library.base_item_tv_extras + ADD CONSTRAINT "PK_BaseItemTvExtras" PRIMARY KEY (item_id); -- --- Name: LibraryOptions PK_LibraryOptions; Type: CONSTRAINT; Schema: library; Owner: postgres +-- Name: base_items PK_BaseItems; Type: CONSTRAINT; Schema: library; Owner: jellyfin -- -ALTER TABLE ONLY library."LibraryOptions" - ADD CONSTRAINT "PK_LibraryOptions" PRIMARY KEY ("LibraryPath"); +ALTER TABLE ONLY library.base_items + ADD CONSTRAINT "PK_BaseItems" PRIMARY KEY (id); -- --- Name: MediaSegments PK_MediaSegments; Type: CONSTRAINT; Schema: library; Owner: jellyfin +-- Name: chapters PK_Chapters; Type: CONSTRAINT; Schema: library; Owner: jellyfin -- -ALTER TABLE ONLY library."MediaSegments" - ADD CONSTRAINT "PK_MediaSegments" PRIMARY KEY ("Id"); +ALTER TABLE ONLY library.chapters + ADD CONSTRAINT "PK_Chapters" PRIMARY KEY (item_id, chapter_index); -- --- Name: Peoples PK_Peoples; Type: CONSTRAINT; Schema: library; Owner: jellyfin +-- Name: image_infos PK_ImageInfos; Type: CONSTRAINT; Schema: library; Owner: jellyfin -- -ALTER TABLE ONLY library."Peoples" - ADD CONSTRAINT "PK_Peoples" PRIMARY KEY ("Id"); +ALTER TABLE ONLY library.image_infos + ADD CONSTRAINT "PK_ImageInfos" PRIMARY KEY (id); -- --- Name: TrickplayInfos PK_TrickplayInfos; Type: CONSTRAINT; Schema: library; Owner: jellyfin +-- Name: item_values PK_ItemValues; Type: CONSTRAINT; Schema: library; Owner: jellyfin -- -ALTER TABLE ONLY library."TrickplayInfos" - ADD CONSTRAINT "PK_TrickplayInfos" PRIMARY KEY ("ItemId", "Width"); +ALTER TABLE ONLY library.item_values + ADD CONSTRAINT "PK_ItemValues" PRIMARY KEY (item_value_id); -- --- Name: UserData PK_UserData; Type: CONSTRAINT; Schema: library; Owner: jellyfin +-- Name: keyframe_data PK_KeyframeData; Type: CONSTRAINT; Schema: library; Owner: jellyfin -- -ALTER TABLE ONLY library."UserData" - ADD CONSTRAINT "PK_UserData" PRIMARY KEY ("ItemId", "UserId", "CustomDataKey"); +ALTER TABLE ONLY library.keyframe_data + ADD CONSTRAINT "PK_KeyframeData" PRIMARY KEY (item_id); -- --- Name: __EFMigrationsHistory PK___EFMigrationsHistory; Type: CONSTRAINT; Schema: public; Owner: jellyfin +-- Name: library_options PK_LibraryOptions; Type: CONSTRAINT; Schema: library; Owner: postgres -- -ALTER TABLE ONLY public."__EFMigrationsHistory" - ADD CONSTRAINT "PK___EFMigrationsHistory" PRIMARY KEY ("MigrationId"); +ALTER TABLE ONLY library.library_options + ADD CONSTRAINT "PK_LibraryOptions" PRIMARY KEY (library_path); -- --- Name: AccessSchedules PK_AccessSchedules; Type: CONSTRAINT; Schema: users; Owner: jellyfin +-- Name: media_segments PK_MediaSegments; Type: CONSTRAINT; Schema: library; Owner: jellyfin -- -ALTER TABLE ONLY users."AccessSchedules" - ADD CONSTRAINT "PK_AccessSchedules" PRIMARY KEY ("Id"); +ALTER TABLE ONLY library.media_segments + ADD CONSTRAINT "PK_MediaSegments" PRIMARY KEY (id); -- --- Name: Permissions PK_Permissions; Type: CONSTRAINT; Schema: users; Owner: jellyfin +-- Name: media_stream_infos PK_MediaStreamInfos; Type: CONSTRAINT; Schema: library; Owner: jellyfin -- -ALTER TABLE ONLY users."Permissions" - ADD CONSTRAINT "PK_Permissions" PRIMARY KEY ("Id"); +ALTER TABLE ONLY library.media_stream_infos + ADD CONSTRAINT "PK_MediaStreamInfos" PRIMARY KEY (item_id, stream_index); -- --- Name: Preferences PK_Preferences; Type: CONSTRAINT; Schema: users; Owner: jellyfin +-- Name: peoples PK_Peoples; Type: CONSTRAINT; Schema: library; Owner: jellyfin -- -ALTER TABLE ONLY users."Preferences" - ADD CONSTRAINT "PK_Preferences" PRIMARY KEY ("Id"); +ALTER TABLE ONLY library.peoples + ADD CONSTRAINT "PK_Peoples" PRIMARY KEY (id); -- --- Name: Users PK_Users; Type: CONSTRAINT; Schema: users; Owner: jellyfin +-- Name: trickplay_infos PK_TrickplayInfos; Type: CONSTRAINT; Schema: library; Owner: jellyfin -- -ALTER TABLE ONLY users."Users" - ADD CONSTRAINT "PK_Users" PRIMARY KEY ("Id"); +ALTER TABLE ONLY library.trickplay_infos + ADD CONSTRAINT "PK_TrickplayInfos" PRIMARY KEY (item_id, width); + + +-- +-- Name: user_data PK_UserData; Type: CONSTRAINT; Schema: library; Owner: jellyfin +-- + +ALTER TABLE ONLY library.user_data + ADD CONSTRAINT "PK_UserData" PRIMARY KEY (item_id, user_id, custom_data_key); + + +-- +-- Name: video_stream_details PK_VideoStreamDetails; Type: CONSTRAINT; Schema: library; Owner: postgres +-- + +ALTER TABLE ONLY library.video_stream_details + ADD CONSTRAINT "PK_VideoStreamDetails" PRIMARY KEY (item_id, stream_index); + + +-- +-- Name: __ef_migrations_history PK___EFMigrationsHistory; Type: CONSTRAINT; Schema: public; Owner: jellyfin +-- + +ALTER TABLE ONLY public.__ef_migrations_history + ADD CONSTRAINT "PK___EFMigrationsHistory" PRIMARY KEY (migration_id); + + +-- +-- Name: access_schedules PK_AccessSchedules; Type: CONSTRAINT; Schema: users; Owner: jellyfin +-- + +ALTER TABLE ONLY users.access_schedules + ADD CONSTRAINT "PK_AccessSchedules" PRIMARY KEY (id); + + +-- +-- Name: permissions PK_Permissions; Type: CONSTRAINT; Schema: users; Owner: jellyfin +-- + +ALTER TABLE ONLY users.permissions + ADD CONSTRAINT "PK_Permissions" PRIMARY KEY (id); + + +-- +-- Name: preferences PK_Preferences; Type: CONSTRAINT; Schema: users; Owner: jellyfin +-- + +ALTER TABLE ONLY users.preferences + ADD CONSTRAINT "PK_Preferences" PRIMARY KEY (id); + + +-- +-- Name: users PK_Users; Type: CONSTRAINT; Schema: users; Owner: jellyfin +-- + +ALTER TABLE ONLY users.users + ADD CONSTRAINT "PK_Users" PRIMARY KEY (id); -- -- Name: IX_ActivityLogs_DateCreated; Type: INDEX; Schema: activitylog; Owner: jellyfin -- -CREATE INDEX "IX_ActivityLogs_DateCreated" ON activitylog."ActivityLogs" USING btree ("DateCreated"); +CREATE INDEX "IX_ActivityLogs_DateCreated" ON activitylog.activity_logs USING btree (date_created); -- -- Name: idx_activitylogs_userid_datecreated; Type: INDEX; Schema: activitylog; Owner: jellyfin -- -CREATE INDEX idx_activitylogs_userid_datecreated ON activitylog."ActivityLogs" USING btree ("UserId", "DateCreated" DESC) WHERE ("UserId" IS NOT NULL); +CREATE INDEX idx_activitylogs_userid_datecreated ON activitylog.activity_logs USING btree (user_id, date_created DESC) WHERE (user_id IS NOT NULL); -- -- Name: IX_ApiKeys_AccessToken; Type: INDEX; Schema: authentication; Owner: jellyfin -- -CREATE UNIQUE INDEX "IX_ApiKeys_AccessToken" ON authentication."ApiKeys" USING btree ("AccessToken"); +CREATE UNIQUE INDEX "IX_ApiKeys_AccessToken" ON authentication.api_keys USING btree (access_token); -- -- Name: IX_DeviceOptions_DeviceId; Type: INDEX; Schema: authentication; Owner: jellyfin -- -CREATE UNIQUE INDEX "IX_DeviceOptions_DeviceId" ON authentication."DeviceOptions" USING btree ("DeviceId"); +CREATE UNIQUE INDEX "IX_DeviceOptions_DeviceId" ON authentication.device_options USING btree (device_id); -- -- Name: IX_Devices_AccessToken_DateLastActivity; Type: INDEX; Schema: authentication; Owner: jellyfin -- -CREATE INDEX "IX_Devices_AccessToken_DateLastActivity" ON authentication."Devices" USING btree ("AccessToken", "DateLastActivity"); +CREATE INDEX "IX_Devices_AccessToken_DateLastActivity" ON authentication.devices USING btree (access_token, date_last_activity); -- -- Name: IX_Devices_DeviceId; Type: INDEX; Schema: authentication; Owner: jellyfin -- -CREATE INDEX "IX_Devices_DeviceId" ON authentication."Devices" USING btree ("DeviceId"); +CREATE INDEX "IX_Devices_DeviceId" ON authentication.devices USING btree (device_id); -- -- Name: IX_Devices_DeviceId_DateLastActivity; Type: INDEX; Schema: authentication; Owner: jellyfin -- -CREATE INDEX "IX_Devices_DeviceId_DateLastActivity" ON authentication."Devices" USING btree ("DeviceId", "DateLastActivity"); +CREATE INDEX "IX_Devices_DeviceId_DateLastActivity" ON authentication.devices USING btree (device_id, date_last_activity); -- -- Name: IX_Devices_UserId_DeviceId; Type: INDEX; Schema: authentication; Owner: jellyfin -- -CREATE INDEX "IX_Devices_UserId_DeviceId" ON authentication."Devices" USING btree ("UserId", "DeviceId"); +CREATE INDEX "IX_Devices_UserId_DeviceId" ON authentication.devices USING btree (user_id, device_id); -- -- Name: IX_CustomItemDisplayPreferences_UserId_ItemId_Client_Key; Type: INDEX; Schema: displaypreferences; Owner: jellyfin -- -CREATE UNIQUE INDEX "IX_CustomItemDisplayPreferences_UserId_ItemId_Client_Key" ON displaypreferences."CustomItemDisplayPreferences" USING btree ("UserId", "ItemId", "Client", "Key"); +CREATE UNIQUE INDEX "IX_CustomItemDisplayPreferences_UserId_ItemId_Client_Key" ON displaypreferences.custom_item_display_preferences USING btree (user_id, item_id, client, key); -- -- Name: IX_DisplayPreferences_UserId_ItemId_Client; Type: INDEX; Schema: displaypreferences; Owner: jellyfin -- -CREATE UNIQUE INDEX "IX_DisplayPreferences_UserId_ItemId_Client" ON displaypreferences."DisplayPreferences" USING btree ("UserId", "ItemId", "Client"); +CREATE UNIQUE INDEX "IX_DisplayPreferences_UserId_ItemId_Client" ON displaypreferences.display_preferences USING btree (user_id, item_id, client); -- -- Name: IX_HomeSection_DisplayPreferencesId; Type: INDEX; Schema: displaypreferences; Owner: jellyfin -- -CREATE INDEX "IX_HomeSection_DisplayPreferencesId" ON displaypreferences."HomeSection" USING btree ("DisplayPreferencesId"); +CREATE INDEX "IX_HomeSection_DisplayPreferencesId" ON displaypreferences.home_sections USING btree (display_preferences_id); -- -- Name: IX_ItemDisplayPreferences_UserId; Type: INDEX; Schema: displaypreferences; Owner: jellyfin -- -CREATE INDEX "IX_ItemDisplayPreferences_UserId" ON displaypreferences."ItemDisplayPreferences" USING btree ("UserId"); +CREATE INDEX "IX_ItemDisplayPreferences_UserId" ON displaypreferences.item_display_preferences USING btree (user_id); -- -- Name: IX_BaseItemImageInfos_ItemId; Type: INDEX; Schema: library; Owner: jellyfin -- -CREATE INDEX "IX_BaseItemImageInfos_ItemId" ON library."BaseItemImageInfos" USING btree ("ItemId"); +CREATE INDEX "IX_BaseItemImageInfos_ItemId" ON library.base_item_image_infos USING btree (item_id); + + +-- +-- Name: IX_BaseItemLiveTvExtras_EndDate; Type: INDEX; Schema: library; Owner: postgres +-- + +CREATE INDEX "IX_BaseItemLiveTvExtras_EndDate" ON library.base_item_live_tv_extras USING btree (end_date); + + +-- +-- Name: IX_BaseItemLiveTvExtras_StartDate; Type: INDEX; Schema: library; Owner: postgres +-- + +CREATE INDEX "IX_BaseItemLiveTvExtras_StartDate" ON library.base_item_live_tv_extras USING btree (start_date); -- -- Name: IX_BaseItemMetadataFields_ItemId; Type: INDEX; Schema: library; Owner: jellyfin -- -CREATE INDEX "IX_BaseItemMetadataFields_ItemId" ON library."BaseItemMetadataFields" USING btree ("ItemId"); +CREATE INDEX "IX_BaseItemMetadataFields_ItemId" ON library.base_item_metadata_fields USING btree (item_id); -- -- Name: IX_BaseItemTrailerTypes_ItemId; Type: INDEX; Schema: library; Owner: jellyfin -- -CREATE INDEX "IX_BaseItemTrailerTypes_ItemId" ON library."BaseItemTrailerTypes" USING btree ("ItemId"); +CREATE INDEX "IX_BaseItemTrailerTypes_ItemId" ON library.base_item_trailer_types USING btree (item_id); + + +-- +-- Name: IX_BaseItemTvExtras_SeriesId; Type: INDEX; Schema: library; Owner: postgres +-- + +CREATE INDEX "IX_BaseItemTvExtras_SeriesId" ON library.base_item_tv_extras USING btree (series_id); + + +-- +-- Name: IX_BaseItemTvExtras_SeriesPresentationUniqueKey; Type: INDEX; Schema: library; Owner: postgres +-- + +CREATE INDEX "IX_BaseItemTvExtras_SeriesPresentationUniqueKey" ON library.base_item_tv_extras USING btree (series_presentation_unique_key); -- -- Name: IX_BaseItems_Id_Type_IsFolder_IsVirtualItem; Type: INDEX; Schema: library; Owner: jellyfin -- -CREATE INDEX "IX_BaseItems_Id_Type_IsFolder_IsVirtualItem" ON library."BaseItems" USING btree ("Id", "Type", "IsFolder", "IsVirtualItem"); +CREATE INDEX "IX_BaseItems_Id_Type_IsFolder_IsVirtualItem" ON library.base_items USING btree (id, type, is_folder, is_virtual_item); -- -- Name: IX_BaseItems_ParentId; Type: INDEX; Schema: library; Owner: jellyfin -- -CREATE INDEX "IX_BaseItems_ParentId" ON library."BaseItems" USING btree ("ParentId"); - - --- --- Name: IX_BaseItems_Type_SeriesPresentationUniqueKey_IsFolder_IsVirtu~; Type: INDEX; Schema: library; Owner: jellyfin --- - -CREATE INDEX "IX_BaseItems_Type_SeriesPresentationUniqueKey_IsFolder_IsVirtu~" ON library."BaseItems" USING btree ("Type", "SeriesPresentationUniqueKey", "IsFolder", "IsVirtualItem"); - - --- --- Name: IX_BaseItems_Type_SeriesPresentationUniqueKey_PresentationUniq~; Type: INDEX; Schema: library; Owner: jellyfin --- - -CREATE INDEX "IX_BaseItems_Type_SeriesPresentationUniqueKey_PresentationUniq~" ON library."BaseItems" USING btree ("Type", "SeriesPresentationUniqueKey", "PresentationUniqueKey", "SortName"); +CREATE INDEX "IX_BaseItems_ParentId" ON library.base_items USING btree (parent_id); -- -- Name: IX_BaseItems_Type_TopParentId_Id; Type: INDEX; Schema: library; Owner: jellyfin -- -CREATE INDEX "IX_BaseItems_Type_TopParentId_Id" ON library."BaseItems" USING btree ("Type", "TopParentId", "Id"); - - --- --- Name: IX_BaseItems_Type_TopParentId_StartDate; Type: INDEX; Schema: library; Owner: jellyfin --- - -CREATE INDEX "IX_BaseItems_Type_TopParentId_StartDate" ON library."BaseItems" USING btree ("Type", "TopParentId", "StartDate"); +CREATE INDEX "IX_BaseItems_Type_TopParentId_Id" ON library.base_items USING btree (type, top_parent_id, id); -- -- Name: IX_ImageInfos_UserId; Type: INDEX; Schema: library; Owner: jellyfin -- -CREATE UNIQUE INDEX "IX_ImageInfos_UserId" ON library."ImageInfos" USING btree ("UserId"); - - --- --- Name: IX_ItemValuesMap_ItemId; Type: INDEX; Schema: library; Owner: jellyfin --- - -CREATE INDEX "IX_ItemValuesMap_ItemId" ON library."ItemValuesMap" USING btree ("ItemId"); +CREATE UNIQUE INDEX "IX_ImageInfos_UserId" ON library.image_infos USING btree (user_id); -- -- Name: IX_ItemValues_Type_CleanValue; Type: INDEX; Schema: library; Owner: jellyfin -- -CREATE INDEX "IX_ItemValues_Type_CleanValue" ON library."ItemValues" USING btree ("Type", "CleanValue"); +CREATE INDEX "IX_ItemValues_Type_CleanValue" ON library.item_values USING btree (type, clean_value); -- -- Name: IX_ItemValues_Type_Value; Type: INDEX; Schema: library; Owner: jellyfin -- -CREATE UNIQUE INDEX "IX_ItemValues_Type_Value" ON library."ItemValues" USING btree ("Type", "Value"); +CREATE UNIQUE INDEX "IX_ItemValues_Type_Value" ON library.item_values USING btree (type, value); -- -- Name: IX_LibraryOptions_DateModified; Type: INDEX; Schema: library; Owner: postgres -- -CREATE INDEX "IX_LibraryOptions_DateModified" ON library."LibraryOptions" USING btree ("DateModified" DESC); +CREATE INDEX "IX_LibraryOptions_DateModified" ON library.library_options USING btree (date_modified DESC); -- -- Name: IX_UserData_ItemId_UserId_IsFavorite; Type: INDEX; Schema: library; Owner: jellyfin -- -CREATE INDEX "IX_UserData_ItemId_UserId_IsFavorite" ON library."UserData" USING btree ("ItemId", "UserId", "IsFavorite"); +CREATE INDEX "IX_UserData_ItemId_UserId_IsFavorite" ON library.user_data USING btree (item_id, user_id, is_favorite); -- -- Name: IX_UserData_ItemId_UserId_LastPlayedDate; Type: INDEX; Schema: library; Owner: jellyfin -- -CREATE INDEX "IX_UserData_ItemId_UserId_LastPlayedDate" ON library."UserData" USING btree ("ItemId", "UserId", "LastPlayedDate"); +CREATE INDEX "IX_UserData_ItemId_UserId_LastPlayedDate" ON library.user_data USING btree (item_id, user_id, last_played_date); -- -- Name: IX_UserData_ItemId_UserId_PlaybackPositionTicks; Type: INDEX; Schema: library; Owner: jellyfin -- -CREATE INDEX "IX_UserData_ItemId_UserId_PlaybackPositionTicks" ON library."UserData" USING btree ("ItemId", "UserId", "PlaybackPositionTicks"); +CREATE INDEX "IX_UserData_ItemId_UserId_PlaybackPositionTicks" ON library.user_data USING btree (item_id, user_id, playback_position_ticks); -- -- Name: IX_UserData_ItemId_UserId_Played; Type: INDEX; Schema: library; Owner: jellyfin -- -CREATE INDEX "IX_UserData_ItemId_UserId_Played" ON library."UserData" USING btree ("ItemId", "UserId", "Played"); - - --- --- Name: baseitems_seriespresentationuniquekey_idx; Type: INDEX; Schema: library; Owner: jellyfin --- - -CREATE INDEX baseitems_seriespresentationuniquekey_idx ON library."BaseItems" USING btree ("SeriesPresentationUniqueKey", "IndexNumber", "ParentIndexNumber"); - - --- --- Name: idx_baseitems_folder_virtual_media_sort; Type: INDEX; Schema: library; Owner: jellyfin --- - -CREATE INDEX idx_baseitems_folder_virtual_media_sort ON library."BaseItems" USING btree ("IsFolder", "IsVirtualItem", "MediaType", "SortName") INCLUDE ("Id", "PresentationUniqueKey", "SeriesPresentationUniqueKey"); - - --- --- Name: idx_baseitems_type_virtual_media_sort; Type: INDEX; Schema: library; Owner: jellyfin --- - -CREATE INDEX idx_baseitems_type_virtual_media_sort ON library."BaseItems" USING btree ("Type", "IsVirtualItem", "MediaType", "SortName") INCLUDE ("Id", "PresentationUniqueKey", "SeriesPresentationUniqueKey"); +CREATE INDEX "IX_UserData_ItemId_UserId_Played" ON library.user_data USING btree (item_id, user_id, played); -- -- Name: idx_itemvalues_cleanvalue; Type: INDEX; Schema: library; Owner: jellyfin -- -CREATE INDEX idx_itemvalues_cleanvalue ON library."ItemValues" USING btree ("CleanValue") WHERE ("CleanValue" IS NOT NULL); +CREATE INDEX idx_itemvalues_cleanvalue ON library.item_values USING btree (clean_value) WHERE (clean_value IS NOT NULL); -- -- Name: idx_itemvalues_id_cleanvalue; Type: INDEX; Schema: library; Owner: jellyfin -- -CREATE INDEX idx_itemvalues_id_cleanvalue ON library."ItemValues" USING btree ("ItemValueId", "CleanValue"); +CREATE INDEX idx_itemvalues_id_cleanvalue ON library.item_values USING btree (item_value_id, clean_value); -- -- Name: idx_itemvalues_type_value_expr; Type: INDEX; Schema: library; Owner: jellyfin -- -CREATE INDEX idx_itemvalues_type_value_expr ON library."ItemValues" USING btree (((("Type")::text || "Value"))); +CREATE INDEX idx_itemvalues_type_value_expr ON library.item_values USING btree ((((type)::text || value))); -- -- Name: idx_itemvalues_value; Type: INDEX; Schema: library; Owner: jellyfin -- -CREATE INDEX idx_itemvalues_value ON library."ItemValues" USING btree ("Value") WHERE ("Value" IS NOT NULL); +CREATE INDEX idx_itemvalues_value ON library.item_values USING btree (value) WHERE (value IS NOT NULL); -- -- Name: idx_itemvaluesmap_itemvalueid_itemid; Type: INDEX; Schema: library; Owner: jellyfin -- -CREATE INDEX idx_itemvaluesmap_itemvalueid_itemid ON library."ItemValuesMap" USING btree ("ItemValueId", "ItemId"); +CREATE INDEX idx_itemvaluesmap_itemvalueid_itemid ON library.item_values_map USING btree (item_value_id, item_id); -- -- Name: mediastreaminfos_itemid_idx; Type: INDEX; Schema: library; Owner: jellyfin -- -CREATE INDEX mediastreaminfos_itemid_idx ON library."MediaStreamInfos" USING btree ("ItemId", "StreamType"); +CREATE INDEX mediastreaminfos_itemid_idx ON library.media_stream_infos USING btree (item_id, stream_type); -- -- Name: peoplebaseitemmap_itemid_idx; Type: INDEX; Schema: library; Owner: jellyfin -- -CREATE INDEX peoplebaseitemmap_itemid_idx ON library."PeopleBaseItemMap" USING btree ("ItemId", "PeopleId"); +CREATE INDEX peoplebaseitemmap_itemid_idx ON library.people_base_item_map USING btree (item_id, people_id); -- -- Name: peoplebaseitemmap_peopleid_idx; Type: INDEX; Schema: library; Owner: jellyfin -- -CREATE INDEX peoplebaseitemmap_peopleid_idx ON library."PeopleBaseItemMap" USING btree ("PeopleId", "ItemId"); +CREATE INDEX peoplebaseitemmap_peopleid_idx ON library.people_base_item_map USING btree (people_id, item_id); -- -- Name: IX_AccessSchedules_UserId; Type: INDEX; Schema: users; Owner: jellyfin -- -CREATE INDEX "IX_AccessSchedules_UserId" ON users."AccessSchedules" USING btree ("UserId"); +CREATE INDEX "IX_AccessSchedules_UserId" ON users.access_schedules USING btree (user_id); -- -- Name: IX_Permissions_UserId_Kind; Type: INDEX; Schema: users; Owner: jellyfin -- -CREATE UNIQUE INDEX "IX_Permissions_UserId_Kind" ON users."Permissions" USING btree ("UserId", "Kind") WHERE ("UserId" IS NOT NULL); +CREATE UNIQUE INDEX "IX_Permissions_UserId_Kind" ON users.permissions USING btree (user_id, kind) WHERE (user_id IS NOT NULL); -- -- Name: IX_Preferences_UserId_Kind; Type: INDEX; Schema: users; Owner: jellyfin -- -CREATE UNIQUE INDEX "IX_Preferences_UserId_Kind" ON users."Preferences" USING btree ("UserId", "Kind") WHERE ("UserId" IS NOT NULL); +CREATE UNIQUE INDEX "IX_Preferences_UserId_Kind" ON users.preferences USING btree (user_id, kind) WHERE (user_id IS NOT NULL); -- -- Name: IX_Users_Username; Type: INDEX; Schema: users; Owner: jellyfin -- -CREATE UNIQUE INDEX "IX_Users_Username" ON users."Users" USING btree ("Username"); +CREATE UNIQUE INDEX "IX_Users_Username" ON users.users USING btree (username); -- --- Name: Devices FK_Devices_Users_UserId; Type: FK CONSTRAINT; Schema: authentication; Owner: jellyfin +-- Name: devices FK_Devices_Users_UserId; Type: FK CONSTRAINT; Schema: authentication; Owner: jellyfin -- -ALTER TABLE ONLY authentication."Devices" - ADD CONSTRAINT "FK_Devices_Users_UserId" FOREIGN KEY ("UserId") REFERENCES users."Users"("Id") ON DELETE CASCADE; +ALTER TABLE ONLY authentication.devices + ADD CONSTRAINT "FK_Devices_Users_UserId" FOREIGN KEY (user_id) REFERENCES users.users(id) ON DELETE CASCADE; -- --- Name: DisplayPreferences FK_DisplayPreferences_Users_UserId; Type: FK CONSTRAINT; Schema: displaypreferences; Owner: jellyfin +-- Name: display_preferences FK_DisplayPreferences_Users_UserId; Type: FK CONSTRAINT; Schema: displaypreferences; Owner: jellyfin -- -ALTER TABLE ONLY displaypreferences."DisplayPreferences" - ADD CONSTRAINT "FK_DisplayPreferences_Users_UserId" FOREIGN KEY ("UserId") REFERENCES users."Users"("Id") ON DELETE CASCADE; +ALTER TABLE ONLY displaypreferences.display_preferences + ADD CONSTRAINT "FK_DisplayPreferences_Users_UserId" FOREIGN KEY (user_id) REFERENCES users.users(id) ON DELETE CASCADE; -- --- Name: HomeSection FK_HomeSection_DisplayPreferences_DisplayPreferencesId; Type: FK CONSTRAINT; Schema: displaypreferences; Owner: jellyfin +-- Name: home_sections FK_HomeSection_DisplayPreferences_DisplayPreferencesId; Type: FK CONSTRAINT; Schema: displaypreferences; Owner: jellyfin -- -ALTER TABLE ONLY displaypreferences."HomeSection" - ADD CONSTRAINT "FK_HomeSection_DisplayPreferences_DisplayPreferencesId" FOREIGN KEY ("DisplayPreferencesId") REFERENCES displaypreferences."DisplayPreferences"("Id") ON DELETE CASCADE; +ALTER TABLE ONLY displaypreferences.home_sections + ADD CONSTRAINT "FK_HomeSection_DisplayPreferences_DisplayPreferencesId" FOREIGN KEY (display_preferences_id) REFERENCES displaypreferences.display_preferences(id) ON DELETE CASCADE; -- --- Name: ItemDisplayPreferences FK_ItemDisplayPreferences_Users_UserId; Type: FK CONSTRAINT; Schema: displaypreferences; Owner: jellyfin +-- Name: item_display_preferences FK_ItemDisplayPreferences_Users_UserId; Type: FK CONSTRAINT; Schema: displaypreferences; Owner: jellyfin -- -ALTER TABLE ONLY displaypreferences."ItemDisplayPreferences" - ADD CONSTRAINT "FK_ItemDisplayPreferences_Users_UserId" FOREIGN KEY ("UserId") REFERENCES users."Users"("Id") ON DELETE CASCADE; +ALTER TABLE ONLY displaypreferences.item_display_preferences + ADD CONSTRAINT "FK_ItemDisplayPreferences_Users_UserId" FOREIGN KEY (user_id) REFERENCES users.users(id) ON DELETE CASCADE; -- --- Name: AncestorIds FK_AncestorIds_BaseItems_ItemId; Type: FK CONSTRAINT; Schema: library; Owner: jellyfin +-- Name: ancestor_ids FK_AncestorIds_BaseItems_ItemId; Type: FK CONSTRAINT; Schema: library; Owner: jellyfin -- -ALTER TABLE ONLY library."AncestorIds" - ADD CONSTRAINT "FK_AncestorIds_BaseItems_ItemId" FOREIGN KEY ("ItemId") REFERENCES library."BaseItems"("Id") ON DELETE CASCADE; +ALTER TABLE ONLY library.ancestor_ids + ADD CONSTRAINT "FK_AncestorIds_BaseItems_ItemId" FOREIGN KEY (item_id) REFERENCES library.base_items(id) ON DELETE CASCADE; -- --- Name: AncestorIds FK_AncestorIds_BaseItems_ParentItemId; Type: FK CONSTRAINT; Schema: library; Owner: jellyfin +-- Name: ancestor_ids FK_AncestorIds_BaseItems_ParentItemId; Type: FK CONSTRAINT; Schema: library; Owner: jellyfin -- -ALTER TABLE ONLY library."AncestorIds" - ADD CONSTRAINT "FK_AncestorIds_BaseItems_ParentItemId" FOREIGN KEY ("ParentItemId") REFERENCES library."BaseItems"("Id") ON DELETE CASCADE; +ALTER TABLE ONLY library.ancestor_ids + ADD CONSTRAINT "FK_AncestorIds_BaseItems_ParentItemId" FOREIGN KEY (parent_item_id) REFERENCES library.base_items(id) ON DELETE CASCADE; -- --- Name: AttachmentStreamInfos FK_AttachmentStreamInfos_BaseItems_ItemId; Type: FK CONSTRAINT; Schema: library; Owner: jellyfin +-- Name: attachment_stream_infos FK_AttachmentStreamInfos_BaseItems_ItemId; Type: FK CONSTRAINT; Schema: library; Owner: jellyfin -- -ALTER TABLE ONLY library."AttachmentStreamInfos" - ADD CONSTRAINT "FK_AttachmentStreamInfos_BaseItems_ItemId" FOREIGN KEY ("ItemId") REFERENCES library."BaseItems"("Id") ON DELETE CASCADE; +ALTER TABLE ONLY library.attachment_stream_infos + ADD CONSTRAINT "FK_AttachmentStreamInfos_BaseItems_ItemId" FOREIGN KEY (item_id) REFERENCES library.base_items(id) ON DELETE CASCADE; -- --- Name: BaseItemImageInfos FK_BaseItemImageInfos_BaseItems_ItemId; Type: FK CONSTRAINT; Schema: library; Owner: jellyfin +-- Name: audio_stream_details FK_AudioStreamDetails_MediaStreamInfos_ItemId_StreamIndex; Type: FK CONSTRAINT; Schema: library; Owner: postgres -- -ALTER TABLE ONLY library."BaseItemImageInfos" - ADD CONSTRAINT "FK_BaseItemImageInfos_BaseItems_ItemId" FOREIGN KEY ("ItemId") REFERENCES library."BaseItems"("Id") ON DELETE CASCADE; +ALTER TABLE ONLY library.audio_stream_details + ADD CONSTRAINT "FK_AudioStreamDetails_MediaStreamInfos_ItemId_StreamIndex" FOREIGN KEY (item_id, stream_index) REFERENCES library.media_stream_infos(item_id, stream_index) ON DELETE CASCADE; -- --- Name: BaseItemMetadataFields FK_BaseItemMetadataFields_BaseItems_ItemId; Type: FK CONSTRAINT; Schema: library; Owner: jellyfin +-- Name: base_item_audio_extras FK_BaseItemAudioExtras_BaseItems_ItemId; Type: FK CONSTRAINT; Schema: library; Owner: postgres -- -ALTER TABLE ONLY library."BaseItemMetadataFields" - ADD CONSTRAINT "FK_BaseItemMetadataFields_BaseItems_ItemId" FOREIGN KEY ("ItemId") REFERENCES library."BaseItems"("Id") ON DELETE CASCADE; +ALTER TABLE ONLY library.base_item_audio_extras + ADD CONSTRAINT "FK_BaseItemAudioExtras_BaseItems_ItemId" FOREIGN KEY (item_id) REFERENCES library.base_items(id) ON DELETE CASCADE; -- --- Name: BaseItemProviders FK_BaseItemProviders_BaseItems_ItemId; Type: FK CONSTRAINT; Schema: library; Owner: jellyfin +-- Name: base_item_image_infos FK_BaseItemImageInfos_BaseItems_ItemId; Type: FK CONSTRAINT; Schema: library; Owner: jellyfin -- -ALTER TABLE ONLY library."BaseItemProviders" - ADD CONSTRAINT "FK_BaseItemProviders_BaseItems_ItemId" FOREIGN KEY ("ItemId") REFERENCES library."BaseItems"("Id") ON DELETE CASCADE; +ALTER TABLE ONLY library.base_item_image_infos + ADD CONSTRAINT "FK_BaseItemImageInfos_BaseItems_ItemId" FOREIGN KEY (item_id) REFERENCES library.base_items(id) ON DELETE CASCADE; -- --- Name: BaseItemTrailerTypes FK_BaseItemTrailerTypes_BaseItems_ItemId; Type: FK CONSTRAINT; Schema: library; Owner: jellyfin +-- Name: base_item_live_tv_extras FK_BaseItemLiveTvExtras_BaseItems_ItemId; Type: FK CONSTRAINT; Schema: library; Owner: postgres -- -ALTER TABLE ONLY library."BaseItemTrailerTypes" - ADD CONSTRAINT "FK_BaseItemTrailerTypes_BaseItems_ItemId" FOREIGN KEY ("ItemId") REFERENCES library."BaseItems"("Id") ON DELETE CASCADE; +ALTER TABLE ONLY library.base_item_live_tv_extras + ADD CONSTRAINT "FK_BaseItemLiveTvExtras_BaseItems_ItemId" FOREIGN KEY (item_id) REFERENCES library.base_items(id) ON DELETE CASCADE; -- --- Name: BaseItems FK_BaseItems_BaseItems_ParentId; Type: FK CONSTRAINT; Schema: library; Owner: jellyfin +-- Name: base_item_metadata_fields FK_BaseItemMetadataFields_BaseItems_ItemId; Type: FK CONSTRAINT; Schema: library; Owner: jellyfin -- -ALTER TABLE ONLY library."BaseItems" - ADD CONSTRAINT "FK_BaseItems_BaseItems_ParentId" FOREIGN KEY ("ParentId") REFERENCES library."BaseItems"("Id") ON DELETE CASCADE; +ALTER TABLE ONLY library.base_item_metadata_fields + ADD CONSTRAINT "FK_BaseItemMetadataFields_BaseItems_ItemId" FOREIGN KEY (item_id) REFERENCES library.base_items(id) ON DELETE CASCADE; -- --- Name: Chapters FK_Chapters_BaseItems_ItemId; Type: FK CONSTRAINT; Schema: library; Owner: jellyfin +-- Name: base_item_providers FK_BaseItemProviders_BaseItems_ItemId; Type: FK CONSTRAINT; Schema: library; Owner: jellyfin -- -ALTER TABLE ONLY library."Chapters" - ADD CONSTRAINT "FK_Chapters_BaseItems_ItemId" FOREIGN KEY ("ItemId") REFERENCES library."BaseItems"("Id") ON DELETE CASCADE; +ALTER TABLE ONLY library.base_item_providers + ADD CONSTRAINT "FK_BaseItemProviders_BaseItems_ItemId" FOREIGN KEY (item_id) REFERENCES library.base_items(id) ON DELETE CASCADE; -- --- Name: ImageInfos FK_ImageInfos_Users_UserId; Type: FK CONSTRAINT; Schema: library; Owner: jellyfin +-- Name: base_item_trailer_types FK_BaseItemTrailerTypes_BaseItems_ItemId; Type: FK CONSTRAINT; Schema: library; Owner: jellyfin -- -ALTER TABLE ONLY library."ImageInfos" - ADD CONSTRAINT "FK_ImageInfos_Users_UserId" FOREIGN KEY ("UserId") REFERENCES users."Users"("Id") ON DELETE CASCADE; +ALTER TABLE ONLY library.base_item_trailer_types + ADD CONSTRAINT "FK_BaseItemTrailerTypes_BaseItems_ItemId" FOREIGN KEY (item_id) REFERENCES library.base_items(id) ON DELETE CASCADE; -- --- Name: ItemValuesMap FK_ItemValuesMap_BaseItems_ItemId; Type: FK CONSTRAINT; Schema: library; Owner: jellyfin +-- Name: base_item_tv_extras FK_BaseItemTvExtras_BaseItems_ItemId; Type: FK CONSTRAINT; Schema: library; Owner: postgres -- -ALTER TABLE ONLY library."ItemValuesMap" - ADD CONSTRAINT "FK_ItemValuesMap_BaseItems_ItemId" FOREIGN KEY ("ItemId") REFERENCES library."BaseItems"("Id") ON DELETE CASCADE; +ALTER TABLE ONLY library.base_item_tv_extras + ADD CONSTRAINT "FK_BaseItemTvExtras_BaseItems_ItemId" FOREIGN KEY (item_id) REFERENCES library.base_items(id) ON DELETE CASCADE; -- --- Name: ItemValuesMap FK_ItemValuesMap_ItemValues_ItemValueId; Type: FK CONSTRAINT; Schema: library; Owner: jellyfin +-- Name: base_items FK_BaseItems_BaseItems_ParentId; Type: FK CONSTRAINT; Schema: library; Owner: jellyfin -- -ALTER TABLE ONLY library."ItemValuesMap" - ADD CONSTRAINT "FK_ItemValuesMap_ItemValues_ItemValueId" FOREIGN KEY ("ItemValueId") REFERENCES library."ItemValues"("ItemValueId") ON DELETE CASCADE; +ALTER TABLE ONLY library.base_items + ADD CONSTRAINT "FK_BaseItems_BaseItems_ParentId" FOREIGN KEY (parent_id) REFERENCES library.base_items(id) ON DELETE CASCADE; -- --- Name: KeyframeData FK_KeyframeData_BaseItems_ItemId; Type: FK CONSTRAINT; Schema: library; Owner: jellyfin +-- Name: chapters FK_Chapters_BaseItems_ItemId; Type: FK CONSTRAINT; Schema: library; Owner: jellyfin -- -ALTER TABLE ONLY library."KeyframeData" - ADD CONSTRAINT "FK_KeyframeData_BaseItems_ItemId" FOREIGN KEY ("ItemId") REFERENCES library."BaseItems"("Id") ON DELETE CASCADE; +ALTER TABLE ONLY library.chapters + ADD CONSTRAINT "FK_Chapters_BaseItems_ItemId" FOREIGN KEY (item_id) REFERENCES library.base_items(id) ON DELETE CASCADE; -- --- Name: MediaStreamInfos FK_MediaStreamInfos_BaseItems_ItemId; Type: FK CONSTRAINT; Schema: library; Owner: jellyfin +-- Name: image_infos FK_ImageInfos_Users_UserId; Type: FK CONSTRAINT; Schema: library; Owner: jellyfin -- -ALTER TABLE ONLY library."MediaStreamInfos" - ADD CONSTRAINT "FK_MediaStreamInfos_BaseItems_ItemId" FOREIGN KEY ("ItemId") REFERENCES library."BaseItems"("Id") ON DELETE CASCADE; +ALTER TABLE ONLY library.image_infos + ADD CONSTRAINT "FK_ImageInfos_Users_UserId" FOREIGN KEY (user_id) REFERENCES users.users(id) ON DELETE CASCADE; -- --- Name: PeopleBaseItemMap FK_PeopleBaseItemMap_BaseItems_ItemId; Type: FK CONSTRAINT; Schema: library; Owner: jellyfin +-- Name: item_values_map FK_ItemValuesMap_BaseItems_ItemId; Type: FK CONSTRAINT; Schema: library; Owner: jellyfin -- -ALTER TABLE ONLY library."PeopleBaseItemMap" - ADD CONSTRAINT "FK_PeopleBaseItemMap_BaseItems_ItemId" FOREIGN KEY ("ItemId") REFERENCES library."BaseItems"("Id") ON DELETE CASCADE; +ALTER TABLE ONLY library.item_values_map + ADD CONSTRAINT "FK_ItemValuesMap_BaseItems_ItemId" FOREIGN KEY (item_id) REFERENCES library.base_items(id) ON DELETE CASCADE; -- --- Name: PeopleBaseItemMap FK_PeopleBaseItemMap_Peoples_PeopleId; Type: FK CONSTRAINT; Schema: library; Owner: jellyfin +-- Name: item_values_map FK_ItemValuesMap_ItemValues_ItemValueId; Type: FK CONSTRAINT; Schema: library; Owner: jellyfin -- -ALTER TABLE ONLY library."PeopleBaseItemMap" - ADD CONSTRAINT "FK_PeopleBaseItemMap_Peoples_PeopleId" FOREIGN KEY ("PeopleId") REFERENCES library."Peoples"("Id") ON DELETE CASCADE; +ALTER TABLE ONLY library.item_values_map + ADD CONSTRAINT "FK_ItemValuesMap_ItemValues_ItemValueId" FOREIGN KEY (item_value_id) REFERENCES library.item_values(item_value_id) ON DELETE CASCADE; -- --- Name: UserData FK_UserData_BaseItems_ItemId; Type: FK CONSTRAINT; Schema: library; Owner: jellyfin +-- Name: keyframe_data FK_KeyframeData_BaseItems_ItemId; Type: FK CONSTRAINT; Schema: library; Owner: jellyfin -- -ALTER TABLE ONLY library."UserData" - ADD CONSTRAINT "FK_UserData_BaseItems_ItemId" FOREIGN KEY ("ItemId") REFERENCES library."BaseItems"("Id") ON DELETE CASCADE; +ALTER TABLE ONLY library.keyframe_data + ADD CONSTRAINT "FK_KeyframeData_BaseItems_ItemId" FOREIGN KEY (item_id) REFERENCES library.base_items(id) ON DELETE CASCADE; -- --- Name: UserData FK_UserData_Users_UserId; Type: FK CONSTRAINT; Schema: library; Owner: jellyfin +-- Name: media_stream_infos FK_MediaStreamInfos_BaseItems_ItemId; Type: FK CONSTRAINT; Schema: library; Owner: jellyfin -- -ALTER TABLE ONLY library."UserData" - ADD CONSTRAINT "FK_UserData_Users_UserId" FOREIGN KEY ("UserId") REFERENCES users."Users"("Id") ON DELETE CASCADE; +ALTER TABLE ONLY library.media_stream_infos + ADD CONSTRAINT "FK_MediaStreamInfos_BaseItems_ItemId" FOREIGN KEY (item_id) REFERENCES library.base_items(id) ON DELETE CASCADE; -- --- Name: AccessSchedules FK_AccessSchedules_Users_UserId; Type: FK CONSTRAINT; Schema: users; Owner: jellyfin +-- Name: people_base_item_map FK_PeopleBaseItemMap_BaseItems_ItemId; Type: FK CONSTRAINT; Schema: library; Owner: jellyfin -- -ALTER TABLE ONLY users."AccessSchedules" - ADD CONSTRAINT "FK_AccessSchedules_Users_UserId" FOREIGN KEY ("UserId") REFERENCES users."Users"("Id") ON DELETE CASCADE; +ALTER TABLE ONLY library.people_base_item_map + ADD CONSTRAINT "FK_PeopleBaseItemMap_BaseItems_ItemId" FOREIGN KEY (item_id) REFERENCES library.base_items(id) ON DELETE CASCADE; -- --- Name: Permissions FK_Permissions_Users_UserId; Type: FK CONSTRAINT; Schema: users; Owner: jellyfin +-- Name: people_base_item_map FK_PeopleBaseItemMap_Peoples_PeopleId; Type: FK CONSTRAINT; Schema: library; Owner: jellyfin -- -ALTER TABLE ONLY users."Permissions" - ADD CONSTRAINT "FK_Permissions_Users_UserId" FOREIGN KEY ("UserId") REFERENCES users."Users"("Id") ON DELETE CASCADE; +ALTER TABLE ONLY library.people_base_item_map + ADD CONSTRAINT "FK_PeopleBaseItemMap_Peoples_PeopleId" FOREIGN KEY (people_id) REFERENCES library.peoples(id) ON DELETE CASCADE; -- --- Name: Preferences FK_Preferences_Users_UserId; Type: FK CONSTRAINT; Schema: users; Owner: jellyfin +-- Name: user_data FK_UserData_BaseItems_ItemId; Type: FK CONSTRAINT; Schema: library; Owner: jellyfin -- -ALTER TABLE ONLY users."Preferences" - ADD CONSTRAINT "FK_Preferences_Users_UserId" FOREIGN KEY ("UserId") REFERENCES users."Users"("Id") ON DELETE CASCADE; +ALTER TABLE ONLY library.user_data + ADD CONSTRAINT "FK_UserData_BaseItems_ItemId" FOREIGN KEY (item_id) REFERENCES library.base_items(id) ON DELETE CASCADE; + + +-- +-- Name: user_data FK_UserData_Users_UserId; Type: FK CONSTRAINT; Schema: library; Owner: jellyfin +-- + +ALTER TABLE ONLY library.user_data + ADD CONSTRAINT "FK_UserData_Users_UserId" FOREIGN KEY (user_id) REFERENCES users.users(id) ON DELETE CASCADE; + + +-- +-- Name: video_stream_details FK_VideoStreamDetails_MediaStreamInfos_ItemId_StreamIndex; Type: FK CONSTRAINT; Schema: library; Owner: postgres +-- + +ALTER TABLE ONLY library.video_stream_details + ADD CONSTRAINT "FK_VideoStreamDetails_MediaStreamInfos_ItemId_StreamIndex" FOREIGN KEY (item_id, stream_index) REFERENCES library.media_stream_infos(item_id, stream_index) ON DELETE CASCADE; + + +-- +-- Name: access_schedules FK_AccessSchedules_Users_UserId; Type: FK CONSTRAINT; Schema: users; Owner: jellyfin +-- + +ALTER TABLE ONLY users.access_schedules + ADD CONSTRAINT "FK_AccessSchedules_Users_UserId" FOREIGN KEY (user_id) REFERENCES users.users(id) ON DELETE CASCADE; + + +-- +-- Name: permissions FK_Permissions_Users_UserId; Type: FK CONSTRAINT; Schema: users; Owner: jellyfin +-- + +ALTER TABLE ONLY users.permissions + ADD CONSTRAINT "FK_Permissions_Users_UserId" FOREIGN KEY (user_id) REFERENCES users.users(id) ON DELETE CASCADE; + + +-- +-- Name: preferences FK_Preferences_Users_UserId; Type: FK CONSTRAINT; Schema: users; Owner: jellyfin +-- + +ALTER TABLE ONLY users.preferences + ADD CONSTRAINT "FK_Preferences_Users_UserId" FOREIGN KEY (user_id) REFERENCES users.users(id) ON DELETE CASCADE; -- -- PostgreSQL database dump complete -- -\unrestrict 7yQHzelyscgVdVnHcclaahZ3bSdtHCyhzvmlksdJIsj2eWF8f38OCYThpGtIjiX +\unrestrict Vwcqwiq0T7Wa2mK8KvZhGZRaSeFcgOrgunEbjWSCbLeRLSwJLeXqBprmQroWe9O diff --git a/sql/schema_init/jellyfin_schema_03152026.sql b/sql/schema_init/jellyfin_schema_03152026.sql deleted file mode 100644 index 5a989fe8..00000000 Binary files a/sql/schema_init/jellyfin_schema_03152026.sql and /dev/null differ