From 33312f94584df19385bf58ac9a5be098f62cb7f5 Mon Sep 17 00:00:00 2001 From: Charlotte Van Petegem Date: Sat, 9 Nov 2024 12:48:06 +0100 Subject: [PATCH] Switch to maintained fork of annotate (#679) --- .annotaterb.yml | 58 ++++++++++++++++ Gemfile | 2 +- Gemfile.lock | 8 +-- app/models/album.rb | 9 +++ app/models/album_artist.rb | 12 ++++ app/models/album_label.rb | 11 +++ app/models/artist.rb | 9 +++ app/models/audio_file.rb | 11 +++ app/models/auth_token.rb | 9 +++ app/models/codec.rb | 4 ++ app/models/codec_conversion.rb | 9 +++ app/models/cover_filename.rb | 4 ++ app/models/genre.rb | 5 ++ app/models/image.rb | 8 +++ app/models/image_type.rb | 4 ++ app/models/label.rb | 4 ++ app/models/location.rb | 4 ++ app/models/play.rb | 11 +++ app/models/playlist.rb | 8 +++ app/models/playlist_item.rb | 9 +++ app/models/rescan_runner.rb | 8 +++ app/models/track.rb | 11 +++ app/models/track_artist.rb | 12 ++++ app/models/transcoded_item.rb | 12 ++++ app/models/user.rb | 4 ++ app/serializers/album_artist_serializer.rb | 12 ++++ app/serializers/album_label_serializer.rb | 11 +++ app/serializers/album_serializer.rb | 9 +++ app/serializers/artist_serializer.rb | 9 +++ app/serializers/auth_token_serializer.rb | 9 +++ .../codec_conversion_serializer.rb | 9 +++ app/serializers/codec_serializer.rb | 4 ++ app/serializers/cover_filename_serializer.rb | 4 ++ app/serializers/genre_serializer.rb | 5 ++ app/serializers/image_type_serializer.rb | 4 ++ app/serializers/label_serializer.rb | 4 ++ app/serializers/location_serializer.rb | 4 ++ app/serializers/play_serializer.rb | 11 +++ app/serializers/playlist_serializer.rb | 8 +++ app/serializers/rescan_runner_serializer.rb | 8 +++ app/serializers/track_artist_serializer.rb | 12 ++++ app/serializers/track_serializer.rb | 11 +++ app/serializers/user_serializer.rb | 4 ++ gemset.nix | 7 +- lib/tasks/annotate_rb.rake | 8 +++ lib/tasks/auto_annotate_models.rake | 69 ------------------- test/factories/album_artists.rb | 12 ++++ test/factories/album_labels.rb | 11 +++ test/factories/albums.rb | 9 +++ test/factories/artists.rb | 9 +++ test/factories/audio_files.rb | 11 +++ test/factories/auth_tokens.rb | 9 +++ test/factories/codec_conversions.rb | 9 +++ test/factories/codecs.rb | 4 ++ test/factories/cover_filenames.rb | 4 ++ test/factories/genres.rb | 5 ++ test/factories/image_types.rb | 4 ++ test/factories/images.rb | 8 +++ test/factories/labels.rb | 4 ++ test/factories/locations.rb | 4 ++ test/factories/playlist_items.rb | 9 +++ test/factories/playlists.rb | 8 +++ test/factories/plays.rb | 11 +++ test/factories/rescan_runners.rb | 8 +++ test/factories/track_artists.rb | 12 ++++ test/factories/tracks.rb | 11 +++ test/factories/transcoded_items.rb | 12 ++++ test/factories/users.rb | 4 ++ test/models/album_artist_test.rb | 12 ++++ test/models/album_label_test.rb | 11 +++ test/models/album_test.rb | 9 +++ test/models/artist_test.rb | 9 +++ test/models/audio_file_test.rb | 11 +++ test/models/auth_token_test.rb | 9 +++ test/models/codec_conversion_test.rb | 9 +++ test/models/codec_test.rb | 4 ++ test/models/cover_filename_test.rb | 4 ++ test/models/genre_test.rb | 5 ++ test/models/image_test.rb | 8 +++ test/models/image_type_test.rb | 4 ++ test/models/label_test.rb | 4 ++ test/models/location_test.rb | 4 ++ test/models/play_test.rb | 11 +++ test/models/playlist_item_test.rb | 9 +++ test/models/playlist_test.rb | 8 +++ test/models/rescan_runner_test.rb | 8 +++ test/models/track_artist_test.rb | 12 ++++ test/models/track_test.rb | 11 +++ test/models/transcoded_item_test.rb | 12 ++++ test/models/user_test.rb | 4 ++ 90 files changed, 745 insertions(+), 79 deletions(-) create mode 100644 .annotaterb.yml create mode 100644 lib/tasks/annotate_rb.rake delete mode 100644 lib/tasks/auto_annotate_models.rake diff --git a/.annotaterb.yml b/.annotaterb.yml new file mode 100644 index 00000000..2811be74 --- /dev/null +++ b/.annotaterb.yml @@ -0,0 +1,58 @@ +--- +:position: before +:position_in_additional_file_patterns: before +:position_in_class: before +:position_in_factory: before +:position_in_fixture: before +:position_in_routes: before +:position_in_serializer: before +:position_in_test: before +:classified_sort: true +:exclude_controllers: true +:exclude_factories: false +:exclude_fixtures: false +:exclude_helpers: true +:exclude_scaffolds: true +:exclude_serializers: false +:exclude_sti_subclasses: false +:exclude_tests: false +:force: false +:format_markdown: false +:format_rdoc: false +:format_yard: false +:frozen: false +:ignore_model_sub_dir: false +:ignore_unknown_models: false +:include_version: false +:show_check_constraints: false +:show_complete_foreign_keys: false +:show_foreign_keys: true +:show_indexes: true +:simple_indexes: false +:sort: false +:timestamp: false +:trace: false +:with_comment: true +:with_column_comments: true +:with_table_comments: true +:active_admin: false +:command: +:debug: false +:hide_default_column_types: '' +:hide_limit_column_types: '' +:ignore_columns: +:ignore_routes: +:models: true +:routes: false +:skip_on_db_migrate: false +:target_action: :do_annotations +:wrapper: +:wrapper_close: +:wrapper_open: +:classes_default_to_s: [] +:additional_file_patterns: [] +:model_dir: +- app/models +:require: [] +:root_dir: +- '' diff --git a/Gemfile b/Gemfile index 0b22fbf8..6a21b4ba 100644 --- a/Gemfile +++ b/Gemfile @@ -48,7 +48,7 @@ group :development, :test do end group :development do - gem 'annotate', '~> 3.2', require: false # Remove workaround in lib/tasks/annotate.rb when https://github.com/ctran/annotate_models/issues/696 is fixed + gem 'annotaterb', '~> 4.13', require: false gem 'rubocop', '~> 1.68', require: false gem 'rubocop-factory_bot', '~> 2.26', require: false gem 'rubocop-minitest', '~> 0.36.0', require: false diff --git a/Gemfile.lock b/Gemfile.lock index 0d602765..2b567f7d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -77,9 +77,7 @@ GEM minitest (>= 5.1) securerandom (>= 0.3) tzinfo (~> 2.0, >= 2.0.5) - annotate (3.2.0) - activerecord (>= 3.2, < 8.0) - rake (>= 10.4, < 14.0) + annotaterb (4.13.0) ast (2.4.2) base64 (0.2.0) bcrypt (3.1.20) @@ -293,7 +291,7 @@ PLATFORMS DEPENDENCIES active_model_serializers (~> 0.10) - annotate (~> 3.2) + annotaterb (~> 4.13) bcrypt (~> 3.1) bootsnap (~> 1.18.4) brakeman @@ -324,4 +322,4 @@ RUBY VERSION ruby 3.3.0p0 BUNDLED WITH - 2.5.11 + 2.5.16 diff --git a/app/models/album.rb b/app/models/album.rb index 6ab81dc1..0c9011b3 100644 --- a/app/models/album.rb +++ b/app/models/album.rb @@ -13,6 +13,15 @@ # updated_at :datetime not null # image_id :bigint # +# Indexes +# +# index_albums_on_image_id (image_id) UNIQUE +# index_albums_on_normalized_title (normalized_title) +# +# Foreign Keys +# +# fk_rails_... (image_id => images.id) +# class Album < ApplicationRecord include HasImage diff --git a/app/models/album_artist.rb b/app/models/album_artist.rb index 6f99061a..34867691 100644 --- a/app/models/album_artist.rb +++ b/app/models/album_artist.rb @@ -10,6 +10,18 @@ # album_id :bigint not null # artist_id :bigint not null # +# Indexes +# +# index_album_artists_on_album_id (album_id) +# index_album_artists_on_album_id_and_artist_id_and_name (album_id,artist_id,name) UNIQUE +# index_album_artists_on_artist_id (artist_id) +# index_album_artists_on_normalized_name (normalized_name) +# +# Foreign Keys +# +# fk_rails_... (album_id => albums.id) +# fk_rails_... (artist_id => artists.id) +# class AlbumArtist < ApplicationRecord include HasNormalized diff --git a/app/models/album_label.rb b/app/models/album_label.rb index 846a86d5..0c988491 100644 --- a/app/models/album_label.rb +++ b/app/models/album_label.rb @@ -7,6 +7,17 @@ # album_id :bigint not null # label_id :bigint not null # +# Indexes +# +# index_album_labels_on_album_id (album_id) +# index_album_labels_on_album_id_and_label_id (album_id,label_id) UNIQUE +# index_album_labels_on_label_id (label_id) +# +# Foreign Keys +# +# fk_rails_... (album_id => albums.id) +# fk_rails_... (label_id => labels.id) +# class AlbumLabel < ApplicationRecord belongs_to :album diff --git a/app/models/artist.rb b/app/models/artist.rb index 23777cd0..5f9de9e8 100644 --- a/app/models/artist.rb +++ b/app/models/artist.rb @@ -10,6 +10,15 @@ # updated_at :datetime not null # image_id :bigint # +# Indexes +# +# index_artists_on_image_id (image_id) UNIQUE +# index_artists_on_normalized_name (normalized_name) +# +# Foreign Keys +# +# fk_rails_... (image_id => images.id) +# class Artist < ApplicationRecord include HasImage diff --git a/app/models/audio_file.rb b/app/models/audio_file.rb index 36013d24..983cfe62 100644 --- a/app/models/audio_file.rb +++ b/app/models/audio_file.rb @@ -13,6 +13,17 @@ # codec_id :bigint not null # location_id :bigint not null # +# Indexes +# +# index_audio_files_on_codec_id (codec_id) +# index_audio_files_on_location_id (location_id) +# index_audio_files_on_location_id_and_filename (location_id,filename) UNIQUE +# +# Foreign Keys +# +# fk_rails_... (codec_id => codecs.id) +# fk_rails_... (location_id => locations.id) +# class AudioFile < ApplicationRecord class FailedTranscode < StandardError; end diff --git a/app/models/auth_token.rb b/app/models/auth_token.rb index c7a3fd24..a1406df4 100644 --- a/app/models/auth_token.rb +++ b/app/models/auth_token.rb @@ -9,6 +9,15 @@ # device_id :string not null # user_id :bigint not null # +# Indexes +# +# index_auth_tokens_on_device_id (device_id) UNIQUE +# index_auth_tokens_on_user_id (user_id) +# +# Foreign Keys +# +# fk_rails_... (user_id => users.id) +# class AuthToken < ApplicationRecord belongs_to :user diff --git a/app/models/codec.rb b/app/models/codec.rb index 2b09d6eb..cac2dbfb 100644 --- a/app/models/codec.rb +++ b/app/models/codec.rb @@ -6,6 +6,10 @@ # extension :string not null # mimetype :string not null # +# Indexes +# +# index_codecs_on_extension (extension) UNIQUE +# class Codec < ApplicationRecord has_many :audio_files, dependent: :restrict_with_error diff --git a/app/models/codec_conversion.rb b/app/models/codec_conversion.rb index 132bdc79..87640fcc 100644 --- a/app/models/codec_conversion.rb +++ b/app/models/codec_conversion.rb @@ -7,6 +7,15 @@ # name :string not null # resulting_codec_id :bigint not null # +# Indexes +# +# index_codec_conversions_on_name (name) UNIQUE +# index_codec_conversions_on_resulting_codec_id (resulting_codec_id) +# +# Foreign Keys +# +# fk_rails_... (resulting_codec_id => codecs.id) +# class CodecConversion < ApplicationRecord belongs_to :resulting_codec, class_name: 'Codec' diff --git a/app/models/cover_filename.rb b/app/models/cover_filename.rb index 746c5ce5..ae8a8293 100644 --- a/app/models/cover_filename.rb +++ b/app/models/cover_filename.rb @@ -5,6 +5,10 @@ # id :bigint not null, primary key # filename :string not null # +# Indexes +# +# index_cover_filenames_on_filename (filename) UNIQUE +# class CoverFilename < ApplicationRecord validates :filename, presence: true, uniqueness: true diff --git a/app/models/genre.rb b/app/models/genre.rb index 0dfda6bf..adc24222 100644 --- a/app/models/genre.rb +++ b/app/models/genre.rb @@ -6,6 +6,11 @@ # name :string not null # normalized_name :string not null # +# Indexes +# +# index_genres_on_name (name) UNIQUE +# index_genres_on_normalized_name (normalized_name) +# class Genre < ApplicationRecord include HasNormalized diff --git a/app/models/image.rb b/app/models/image.rb index 39003119..6cc28e66 100644 --- a/app/models/image.rb +++ b/app/models/image.rb @@ -5,6 +5,14 @@ # id :bigint not null, primary key # image_type_id :bigint not null # +# Indexes +# +# index_images_on_image_type_id (image_type_id) +# +# Foreign Keys +# +# fk_rails_... (image_type_id => image_types.id) +# class Image < ApplicationRecord has_one_attached :image diff --git a/app/models/image_type.rb b/app/models/image_type.rb index e64067ef..3e43ba8c 100644 --- a/app/models/image_type.rb +++ b/app/models/image_type.rb @@ -6,6 +6,10 @@ # extension :string not null # mimetype :string not null # +# Indexes +# +# index_image_types_on_extension (extension) UNIQUE +# class ImageType < ApplicationRecord validates :mimetype, presence: true diff --git a/app/models/label.rb b/app/models/label.rb index bf79f523..39891b22 100644 --- a/app/models/label.rb +++ b/app/models/label.rb @@ -6,6 +6,10 @@ # name :string not null # normalized_name :string not null # +# Indexes +# +# index_labels_on_normalized_name (normalized_name) +# class Label < ApplicationRecord include HasNormalized diff --git a/app/models/location.rb b/app/models/location.rb index 7801205e..ad875098 100644 --- a/app/models/location.rb +++ b/app/models/location.rb @@ -5,6 +5,10 @@ # id :bigint not null, primary key # path :string not null # +# Indexes +# +# index_locations_on_path (path) UNIQUE +# class Location < ApplicationRecord has_many :audio_files, dependent: :destroy diff --git a/app/models/play.rb b/app/models/play.rb index c29610b1..e0255af9 100644 --- a/app/models/play.rb +++ b/app/models/play.rb @@ -7,6 +7,17 @@ # track_id :bigint not null # user_id :bigint not null # +# Indexes +# +# index_plays_on_track_id (track_id) +# index_plays_on_user_id (user_id) +# index_plays_on_user_id_and_track_id (user_id,track_id) +# +# Foreign Keys +# +# fk_rails_... (track_id => tracks.id) +# fk_rails_... (user_id => users.id) +# class Play < ApplicationRecord belongs_to :track belongs_to :user diff --git a/app/models/playlist.rb b/app/models/playlist.rb index d1181d46..28558888 100644 --- a/app/models/playlist.rb +++ b/app/models/playlist.rb @@ -11,6 +11,14 @@ # updated_at :datetime not null # user_id :bigint not null # +# Indexes +# +# index_playlists_on_user_id (user_id) +# +# Foreign Keys +# +# fk_rails_... (user_id => users.id) +# class Playlist < ApplicationRecord belongs_to :user has_many :items, class_name: 'PlaylistItem', dependent: :destroy diff --git a/app/models/playlist_item.rb b/app/models/playlist_item.rb index 9266bedd..010d27b3 100644 --- a/app/models/playlist_item.rb +++ b/app/models/playlist_item.rb @@ -10,6 +10,15 @@ # item_id :integer not null # playlist_id :bigint not null # +# Indexes +# +# index_playlist_items_on_playlist_id (playlist_id) +# index_playlist_items_on_playlist_id_and_item_id (playlist_id,item_id) UNIQUE +# +# Foreign Keys +# +# fk_rails_... (playlist_id => playlists.id) +# class PlaylistItem < ApplicationRecord belongs_to :playlist belongs_to :item, polymorphic: true diff --git a/app/models/rescan_runner.rb b/app/models/rescan_runner.rb index f7aebefe..7bc67a22 100644 --- a/app/models/rescan_runner.rb +++ b/app/models/rescan_runner.rb @@ -10,6 +10,14 @@ # warning_text :text # location_id :bigint not null # +# Indexes +# +# index_rescan_runners_on_location_id (location_id) +# +# Foreign Keys +# +# fk_rails_... (location_id => locations.id) +# class RescanRunner < ApplicationRecord belongs_to :location diff --git a/app/models/track.rb b/app/models/track.rb index c9f14c85..c9b30db8 100644 --- a/app/models/track.rb +++ b/app/models/track.rb @@ -12,6 +12,17 @@ # album_id :bigint not null # audio_file_id :bigint # +# Indexes +# +# index_tracks_on_album_id (album_id) +# index_tracks_on_audio_file_id (audio_file_id) UNIQUE +# index_tracks_on_normalized_title (normalized_title) +# +# Foreign Keys +# +# fk_rails_... (album_id => albums.id) +# fk_rails_... (audio_file_id => audio_files.id) +# class Track < ApplicationRecord include HasNormalized diff --git a/app/models/track_artist.rb b/app/models/track_artist.rb index 65eecdeb..e0221cab 100644 --- a/app/models/track_artist.rb +++ b/app/models/track_artist.rb @@ -11,6 +11,18 @@ # artist_id :bigint not null # track_id :bigint not null # +# Indexes +# +# index_track_artists_on_artist_id (artist_id) +# index_track_artists_on_normalized_name (normalized_name) +# index_track_artists_on_track_id (track_id) +# index_track_artists_on_track_id_and_artist_id_and_name_and_role (track_id,artist_id,name,role) UNIQUE +# +# Foreign Keys +# +# fk_rails_... (artist_id => artists.id) +# fk_rails_... (track_id => tracks.id) +# class TrackArtist < ApplicationRecord include HasNormalized diff --git a/app/models/transcoded_item.rb b/app/models/transcoded_item.rb index 68bc0a98..4d7dd846 100644 --- a/app/models/transcoded_item.rb +++ b/app/models/transcoded_item.rb @@ -9,6 +9,18 @@ # audio_file_id :bigint not null # codec_conversion_id :bigint not null # +# Indexes +# +# index_transcoded_items_on_audio_file_id (audio_file_id) +# index_transcoded_items_on_audio_file_id_and_codec_conversion_id (audio_file_id,codec_conversion_id) UNIQUE +# index_transcoded_items_on_codec_conversion_id (codec_conversion_id) +# index_transcoded_items_on_codec_conversion_id_and_uuid (codec_conversion_id,uuid) UNIQUE +# +# Foreign Keys +# +# fk_rails_... (audio_file_id => audio_files.id) +# fk_rails_... (codec_conversion_id => codec_conversions.id) +# class TranscodedItem < ApplicationRecord BASE_PATH = Rails.configuration.transcode_storage_path diff --git a/app/models/user.rb b/app/models/user.rb index ab0838b1..ab31a3ba 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -7,6 +7,10 @@ # password_digest :string not null # permission :integer default("user"), not null # +# Indexes +# +# index_users_on_name (name) UNIQUE +# class User < ApplicationRecord enum :permission, { user: 0, moderator: 1, admin: 2 } diff --git a/app/serializers/album_artist_serializer.rb b/app/serializers/album_artist_serializer.rb index 724261d1..fcd4e5fb 100644 --- a/app/serializers/album_artist_serializer.rb +++ b/app/serializers/album_artist_serializer.rb @@ -10,6 +10,18 @@ # album_id :bigint not null # artist_id :bigint not null # +# Indexes +# +# index_album_artists_on_album_id (album_id) +# index_album_artists_on_album_id_and_artist_id_and_name (album_id,artist_id,name) UNIQUE +# index_album_artists_on_artist_id (artist_id) +# index_album_artists_on_normalized_name (normalized_name) +# +# Foreign Keys +# +# fk_rails_... (album_id => albums.id) +# fk_rails_... (artist_id => artists.id) +# class AlbumArtistSerializer < ActiveModel::Serializer attributes :artist_id, :name, :normalized_name, :order, :separator end diff --git a/app/serializers/album_label_serializer.rb b/app/serializers/album_label_serializer.rb index 6e020a1b..9b72ea16 100644 --- a/app/serializers/album_label_serializer.rb +++ b/app/serializers/album_label_serializer.rb @@ -7,6 +7,17 @@ # album_id :bigint not null # label_id :bigint not null # +# Indexes +# +# index_album_labels_on_album_id (album_id) +# index_album_labels_on_album_id_and_label_id (album_id,label_id) UNIQUE +# index_album_labels_on_label_id (label_id) +# +# Foreign Keys +# +# fk_rails_... (album_id => albums.id) +# fk_rails_... (label_id => labels.id) +# class AlbumLabelSerializer < ActiveModel::Serializer attributes :label_id, :catalogue_number end diff --git a/app/serializers/album_serializer.rb b/app/serializers/album_serializer.rb index edc9768e..1951d0ec 100644 --- a/app/serializers/album_serializer.rb +++ b/app/serializers/album_serializer.rb @@ -13,6 +13,15 @@ # updated_at :datetime not null # image_id :bigint # +# Indexes +# +# index_albums_on_image_id (image_id) UNIQUE +# index_albums_on_normalized_title (normalized_title) +# +# Foreign Keys +# +# fk_rails_... (image_id => images.id) +# class AlbumSerializer < ActiveModel::Serializer include Rails.application.routes.url_helpers diff --git a/app/serializers/artist_serializer.rb b/app/serializers/artist_serializer.rb index 16fd83e2..9cabcffc 100644 --- a/app/serializers/artist_serializer.rb +++ b/app/serializers/artist_serializer.rb @@ -10,6 +10,15 @@ # updated_at :datetime not null # image_id :bigint # +# Indexes +# +# index_artists_on_image_id (image_id) UNIQUE +# index_artists_on_normalized_name (normalized_name) +# +# Foreign Keys +# +# fk_rails_... (image_id => images.id) +# class ArtistSerializer < ActiveModel::Serializer include Rails.application.routes.url_helpers diff --git a/app/serializers/auth_token_serializer.rb b/app/serializers/auth_token_serializer.rb index 7bd5fce8..aed1e323 100644 --- a/app/serializers/auth_token_serializer.rb +++ b/app/serializers/auth_token_serializer.rb @@ -9,6 +9,15 @@ # device_id :string not null # user_id :bigint not null # +# Indexes +# +# index_auth_tokens_on_device_id (device_id) UNIQUE +# index_auth_tokens_on_user_id (user_id) +# +# Foreign Keys +# +# fk_rails_... (user_id => users.id) +# class AuthTokenSerializer < ActiveModel::Serializer attributes :id, :device_id, :user_id, :user_agent, :application end diff --git a/app/serializers/codec_conversion_serializer.rb b/app/serializers/codec_conversion_serializer.rb index 8c15b542..9cce9cd3 100644 --- a/app/serializers/codec_conversion_serializer.rb +++ b/app/serializers/codec_conversion_serializer.rb @@ -7,6 +7,15 @@ # name :string not null # resulting_codec_id :bigint not null # +# Indexes +# +# index_codec_conversions_on_name (name) UNIQUE +# index_codec_conversions_on_resulting_codec_id (resulting_codec_id) +# +# Foreign Keys +# +# fk_rails_... (resulting_codec_id => codecs.id) +# class CodecConversionSerializer < ActiveModel::Serializer attributes :id, :name, :ffmpeg_params, :resulting_codec_id end diff --git a/app/serializers/codec_serializer.rb b/app/serializers/codec_serializer.rb index c5a30b74..6c47775d 100644 --- a/app/serializers/codec_serializer.rb +++ b/app/serializers/codec_serializer.rb @@ -6,6 +6,10 @@ # extension :string not null # mimetype :string not null # +# Indexes +# +# index_codecs_on_extension (extension) UNIQUE +# class CodecSerializer < ActiveModel::Serializer attributes :id, :mimetype, :extension end diff --git a/app/serializers/cover_filename_serializer.rb b/app/serializers/cover_filename_serializer.rb index 3f78ac99..f76faeda 100644 --- a/app/serializers/cover_filename_serializer.rb +++ b/app/serializers/cover_filename_serializer.rb @@ -5,6 +5,10 @@ # id :bigint not null, primary key # filename :string not null # +# Indexes +# +# index_cover_filenames_on_filename (filename) UNIQUE +# class CoverFilenameSerializer < ActiveModel::Serializer attributes :id, :filename end diff --git a/app/serializers/genre_serializer.rb b/app/serializers/genre_serializer.rb index 8f88a38b..2ad1139f 100644 --- a/app/serializers/genre_serializer.rb +++ b/app/serializers/genre_serializer.rb @@ -6,6 +6,11 @@ # name :string not null # normalized_name :string not null # +# Indexes +# +# index_genres_on_name (name) UNIQUE +# index_genres_on_normalized_name (normalized_name) +# class GenreSerializer < ActiveModel::Serializer attributes :id, :name, :normalized_name end diff --git a/app/serializers/image_type_serializer.rb b/app/serializers/image_type_serializer.rb index 7d3d1825..81cded3b 100644 --- a/app/serializers/image_type_serializer.rb +++ b/app/serializers/image_type_serializer.rb @@ -6,6 +6,10 @@ # extension :string not null # mimetype :string not null # +# Indexes +# +# index_image_types_on_extension (extension) UNIQUE +# class ImageTypeSerializer < ActiveModel::Serializer attributes :id, :extension, :mimetype end diff --git a/app/serializers/label_serializer.rb b/app/serializers/label_serializer.rb index 2331e4ed..1819b66c 100644 --- a/app/serializers/label_serializer.rb +++ b/app/serializers/label_serializer.rb @@ -6,6 +6,10 @@ # name :string not null # normalized_name :string not null # +# Indexes +# +# index_labels_on_normalized_name (normalized_name) +# class LabelSerializer < ActiveModel::Serializer attributes :id, :name, :normalized_name end diff --git a/app/serializers/location_serializer.rb b/app/serializers/location_serializer.rb index 9d29870f..75aee012 100644 --- a/app/serializers/location_serializer.rb +++ b/app/serializers/location_serializer.rb @@ -5,6 +5,10 @@ # id :bigint not null, primary key # path :string not null # +# Indexes +# +# index_locations_on_path (path) UNIQUE +# class LocationSerializer < ActiveModel::Serializer attributes :id, :path end diff --git a/app/serializers/play_serializer.rb b/app/serializers/play_serializer.rb index 5d93b120..317bffb4 100644 --- a/app/serializers/play_serializer.rb +++ b/app/serializers/play_serializer.rb @@ -7,6 +7,17 @@ # track_id :bigint not null # user_id :bigint not null # +# Indexes +# +# index_plays_on_track_id (track_id) +# index_plays_on_user_id (user_id) +# index_plays_on_user_id_and_track_id (user_id,track_id) +# +# Foreign Keys +# +# fk_rails_... (track_id => tracks.id) +# fk_rails_... (user_id => users.id) +# class PlaySerializer < ActiveModel::Serializer attributes :id, :played_at, :track_id, :user_id end diff --git a/app/serializers/playlist_serializer.rb b/app/serializers/playlist_serializer.rb index f65f4104..a449ddfd 100644 --- a/app/serializers/playlist_serializer.rb +++ b/app/serializers/playlist_serializer.rb @@ -11,6 +11,14 @@ # updated_at :datetime not null # user_id :bigint not null # +# Indexes +# +# index_playlists_on_user_id (user_id) +# +# Foreign Keys +# +# fk_rails_... (user_id => users.id) +# class PlaylistSerializer < ActiveModel::Serializer attributes :id, :name, :description, :user_id, :playlist_type, :created_at, :updated_at, :item_ids, :access end diff --git a/app/serializers/rescan_runner_serializer.rb b/app/serializers/rescan_runner_serializer.rb index e2a507bf..ebf96a2c 100644 --- a/app/serializers/rescan_runner_serializer.rb +++ b/app/serializers/rescan_runner_serializer.rb @@ -10,6 +10,14 @@ # warning_text :text # location_id :bigint not null # +# Indexes +# +# index_rescan_runners_on_location_id (location_id) +# +# Foreign Keys +# +# fk_rails_... (location_id => locations.id) +# class RescanRunnerSerializer < ActiveModel::Serializer attributes :id, :error_text, :warning_text, :processed, :running, :finished_at, :location_id end diff --git a/app/serializers/track_artist_serializer.rb b/app/serializers/track_artist_serializer.rb index c094d13a..8cdc1c8a 100644 --- a/app/serializers/track_artist_serializer.rb +++ b/app/serializers/track_artist_serializer.rb @@ -11,6 +11,18 @@ # artist_id :bigint not null # track_id :bigint not null # +# Indexes +# +# index_track_artists_on_artist_id (artist_id) +# index_track_artists_on_normalized_name (normalized_name) +# index_track_artists_on_track_id (track_id) +# index_track_artists_on_track_id_and_artist_id_and_name_and_role (track_id,artist_id,name,role) UNIQUE +# +# Foreign Keys +# +# fk_rails_... (artist_id => artists.id) +# fk_rails_... (track_id => tracks.id) +# class TrackArtistSerializer < ActiveModel::Serializer attributes :artist_id, :name, :normalized_name, :role, :order, :hidden end diff --git a/app/serializers/track_serializer.rb b/app/serializers/track_serializer.rb index 1944c906..9d8c4bff 100644 --- a/app/serializers/track_serializer.rb +++ b/app/serializers/track_serializer.rb @@ -12,6 +12,17 @@ # album_id :bigint not null # audio_file_id :bigint # +# Indexes +# +# index_tracks_on_album_id (album_id) +# index_tracks_on_audio_file_id (audio_file_id) UNIQUE +# index_tracks_on_normalized_title (normalized_title) +# +# Foreign Keys +# +# fk_rails_... (album_id => albums.id) +# fk_rails_... (audio_file_id => audio_files.id) +# class TrackSerializer < ActiveModel::Serializer attributes :id, :title, :normalized_title, :number, :album_id, :review_comment, :created_at, :updated_at, :genre_ids, :codec_id, :length, :bitrate, :location_id, :audio_file_id diff --git a/app/serializers/user_serializer.rb b/app/serializers/user_serializer.rb index b21afc9f..10418092 100644 --- a/app/serializers/user_serializer.rb +++ b/app/serializers/user_serializer.rb @@ -7,6 +7,10 @@ # password_digest :string not null # permission :integer default("user"), not null # +# Indexes +# +# index_users_on_name (name) UNIQUE +# class UserSerializer < ActiveModel::Serializer attributes :id, :name, :permission end diff --git a/gemset.nix b/gemset.nix index 7974e45a..0554f241 100644 --- a/gemset.nix +++ b/gemset.nix @@ -131,16 +131,15 @@ }; version = "7.2.2"; }; - annotate = { - dependencies = ["activerecord" "rake"]; + annotaterb = { groups = ["development"]; platforms = []; source = { remotes = ["https://rubygems.org"]; - sha256 = "1lw0fxb5mirsdp3bp20gjyvs7clvi19jbxnrm2ihm20kzfhvlqcs"; + sha256 = "1w9gdd5cqygm0ppsfxpv3szlw4yh8zg34havcqssgvrg0092jivg"; type = "gem"; }; - version = "3.2.0"; + version = "4.13.0"; }; ast = { groups = ["default" "development"]; diff --git a/lib/tasks/annotate_rb.rake b/lib/tasks/annotate_rb.rake new file mode 100644 index 00000000..2c54aa32 --- /dev/null +++ b/lib/tasks/annotate_rb.rake @@ -0,0 +1,8 @@ +# This rake task was added by annotate_rb gem. + +# Can set `ANNOTATERB_SKIP_ON_DB_TASKS` to be anything to skip this +if Rails.env.development? && ENV['ANNOTATERB_SKIP_ON_DB_TASKS'].nil? + require 'annotate_rb' + + AnnotateRb::Core.load_rake_tasks +end diff --git a/lib/tasks/auto_annotate_models.rake b/lib/tasks/auto_annotate_models.rake deleted file mode 100644 index 97eeca1a..00000000 --- a/lib/tasks/auto_annotate_models.rake +++ /dev/null @@ -1,69 +0,0 @@ -# NOTE: only doing this in development as some production environments (Heroku) -# NOTE: are sensitive to local FS writes, and besides -- it's just not proper -# NOTE: to have a dev-mode tool do its thing in production. -if Rails.env.development? - require 'annotate' - # rubocop:disable Rails/RakeEnvironment - # We don't depend on the rails environment here (we don't use models/controllers/whatever) - task :set_annotation_options do - # You can override any of these by setting an environment variable of the - # same name. - Annotate.set_defaults( - 'additional_file_patterns' => [], - 'routes' => 'true', - 'models' => 'true', - 'position_in_routes' => 'before', - 'position_in_class' => 'before', - 'position_in_test' => 'before', - 'position_in_fixture' => 'before', - 'position_in_factory' => 'before', - 'position_in_serializer' => 'before', - 'show_foreign_keys' => 'false', - 'show_complete_foreign_keys' => 'false', - 'show_indexes' => 'false', - 'simple_indexes' => 'false', - 'model_dir' => 'app/models', - 'root_dir' => '', - 'include_version' => 'false', - 'require' => '', - 'exclude_tests' => 'false', - 'exclude_fixtures' => 'false', - 'exclude_factories' => 'false', - 'exclude_serializers' => 'false', - 'exclude_scaffolds' => 'true', - 'exclude_controllers' => 'true', - 'exclude_helpers' => 'true', - 'exclude_sti_subclasses' => 'false', - 'ignore_model_sub_dir' => 'false', - 'ignore_columns' => nil, - 'ignore_routes' => nil, - 'ignore_unknown_models' => 'false', - 'hide_limit_column_types' => 'integer,bigint,boolean', - 'hide_default_column_types' => 'json,jsonb,hstore', - 'skip_on_db_migrate' => 'false', - 'format_bare' => 'true', - 'format_rdoc' => 'false', - 'format_markdown' => 'false', - 'sort' => 'false', - 'force' => 'false', - 'frozen' => 'false', - 'classified_sort' => 'true', - 'trace' => 'false', - 'wrapper_open' => nil, - 'wrapper_close' => nil, - 'with_comment' => 'true' - ) - end - - # We manually fix the routes command until https://github.com/ctran/annotate_models/pull/843 is merged - task :routes do - require 'rails/commands/routes/routes_command' - Rails.application.require_environment! - cmd = Rails::Command::RoutesCommand.new - cmd.perform - end - - # rubocop:enable Rails/RakeEnvironment - - Annotate.load_tasks -end diff --git a/test/factories/album_artists.rb b/test/factories/album_artists.rb index ea9cbb5c..7be7461e 100644 --- a/test/factories/album_artists.rb +++ b/test/factories/album_artists.rb @@ -10,6 +10,18 @@ # album_id :bigint not null # artist_id :bigint not null # +# Indexes +# +# index_album_artists_on_album_id (album_id) +# index_album_artists_on_album_id_and_artist_id_and_name (album_id,artist_id,name) UNIQUE +# index_album_artists_on_artist_id (artist_id) +# index_album_artists_on_normalized_name (normalized_name) +# +# Foreign Keys +# +# fk_rails_... (album_id => albums.id) +# fk_rails_... (artist_id => artists.id) +# FactoryBot.define do factory :album_artist do diff --git a/test/factories/album_labels.rb b/test/factories/album_labels.rb index a0a41899..060df559 100644 --- a/test/factories/album_labels.rb +++ b/test/factories/album_labels.rb @@ -7,6 +7,17 @@ # album_id :bigint not null # label_id :bigint not null # +# Indexes +# +# index_album_labels_on_album_id (album_id) +# index_album_labels_on_album_id_and_label_id (album_id,label_id) UNIQUE +# index_album_labels_on_label_id (label_id) +# +# Foreign Keys +# +# fk_rails_... (album_id => albums.id) +# fk_rails_... (label_id => labels.id) +# FactoryBot.define do factory :album_label do diff --git a/test/factories/albums.rb b/test/factories/albums.rb index a03b3abb..b953d924 100644 --- a/test/factories/albums.rb +++ b/test/factories/albums.rb @@ -13,6 +13,15 @@ # updated_at :datetime not null # image_id :bigint # +# Indexes +# +# index_albums_on_image_id (image_id) UNIQUE +# index_albums_on_normalized_title (normalized_title) +# +# Foreign Keys +# +# fk_rails_... (image_id => images.id) +# FactoryBot.define do factory :album do diff --git a/test/factories/artists.rb b/test/factories/artists.rb index b190898a..c3c5e5b5 100644 --- a/test/factories/artists.rb +++ b/test/factories/artists.rb @@ -10,6 +10,15 @@ # updated_at :datetime not null # image_id :bigint # +# Indexes +# +# index_artists_on_image_id (image_id) UNIQUE +# index_artists_on_normalized_name (normalized_name) +# +# Foreign Keys +# +# fk_rails_... (image_id => images.id) +# FactoryBot.define do factory :artist do diff --git a/test/factories/audio_files.rb b/test/factories/audio_files.rb index b5ad63d9..cbbccdbf 100644 --- a/test/factories/audio_files.rb +++ b/test/factories/audio_files.rb @@ -11,6 +11,17 @@ # codec_id :bigint not null # location_id :bigint not null # +# Indexes +# +# index_audio_files_on_codec_id (codec_id) +# index_audio_files_on_location_id (location_id) +# index_audio_files_on_location_id_and_filename (location_id,filename) UNIQUE +# +# Foreign Keys +# +# fk_rails_... (codec_id => codecs.id) +# fk_rails_... (location_id => locations.id) +# FactoryBot.define do factory :audio_file do diff --git a/test/factories/auth_tokens.rb b/test/factories/auth_tokens.rb index 6180a6d8..b43792a9 100644 --- a/test/factories/auth_tokens.rb +++ b/test/factories/auth_tokens.rb @@ -9,6 +9,15 @@ # device_id :string not null # user_id :bigint not null # +# Indexes +# +# index_auth_tokens_on_device_id (device_id) UNIQUE +# index_auth_tokens_on_user_id (user_id) +# +# Foreign Keys +# +# fk_rails_... (user_id => users.id) +# FactoryBot.define do factory :auth_token do diff --git a/test/factories/codec_conversions.rb b/test/factories/codec_conversions.rb index 2053a582..899a12c8 100644 --- a/test/factories/codec_conversions.rb +++ b/test/factories/codec_conversions.rb @@ -7,6 +7,15 @@ # name :string not null # resulting_codec_id :bigint not null # +# Indexes +# +# index_codec_conversions_on_name (name) UNIQUE +# index_codec_conversions_on_resulting_codec_id (resulting_codec_id) +# +# Foreign Keys +# +# fk_rails_... (resulting_codec_id => codecs.id) +# FactoryBot.define do factory :codec_conversion do diff --git a/test/factories/codecs.rb b/test/factories/codecs.rb index 3af6925c..0d694670 100644 --- a/test/factories/codecs.rb +++ b/test/factories/codecs.rb @@ -6,6 +6,10 @@ # extension :string not null # mimetype :string not null # +# Indexes +# +# index_codecs_on_extension (extension) UNIQUE +# FactoryBot.define do factory :codec do diff --git a/test/factories/cover_filenames.rb b/test/factories/cover_filenames.rb index 4ef69eb2..cba1e820 100644 --- a/test/factories/cover_filenames.rb +++ b/test/factories/cover_filenames.rb @@ -5,6 +5,10 @@ # id :bigint not null, primary key # filename :string not null # +# Indexes +# +# index_cover_filenames_on_filename (filename) UNIQUE +# FactoryBot.define do factory :cover_filename do diff --git a/test/factories/genres.rb b/test/factories/genres.rb index ddfb7a6d..bb2ad66d 100644 --- a/test/factories/genres.rb +++ b/test/factories/genres.rb @@ -6,6 +6,11 @@ # name :string not null # normalized_name :string not null # +# Indexes +# +# index_genres_on_name (name) UNIQUE +# index_genres_on_normalized_name (normalized_name) +# FactoryBot.define do factory :genre do diff --git a/test/factories/image_types.rb b/test/factories/image_types.rb index 4eb27dcc..3f55c19b 100644 --- a/test/factories/image_types.rb +++ b/test/factories/image_types.rb @@ -6,6 +6,10 @@ # extension :string not null # mimetype :string not null # +# Indexes +# +# index_image_types_on_extension (extension) UNIQUE +# FactoryBot.define do factory :image_type do diff --git a/test/factories/images.rb b/test/factories/images.rb index b7de503d..a0be4b44 100644 --- a/test/factories/images.rb +++ b/test/factories/images.rb @@ -5,6 +5,14 @@ # id :bigint not null, primary key # image_type_id :bigint not null # +# Indexes +# +# index_images_on_image_type_id (image_type_id) +# +# Foreign Keys +# +# fk_rails_... (image_type_id => image_types.id) +# FactoryBot.define do factory :image do diff --git a/test/factories/labels.rb b/test/factories/labels.rb index ed391a8b..82c7e4b9 100644 --- a/test/factories/labels.rb +++ b/test/factories/labels.rb @@ -6,6 +6,10 @@ # name :string not null # normalized_name :string not null # +# Indexes +# +# index_labels_on_normalized_name (normalized_name) +# FactoryBot.define do factory :label do diff --git a/test/factories/locations.rb b/test/factories/locations.rb index 36b83314..7b212497 100644 --- a/test/factories/locations.rb +++ b/test/factories/locations.rb @@ -5,6 +5,10 @@ # id :bigint not null, primary key # path :string not null # +# Indexes +# +# index_locations_on_path (path) UNIQUE +# FactoryBot.define do factory :location do diff --git a/test/factories/playlist_items.rb b/test/factories/playlist_items.rb index e3b9b00b..a5e550c3 100644 --- a/test/factories/playlist_items.rb +++ b/test/factories/playlist_items.rb @@ -10,6 +10,15 @@ # item_id :integer not null # playlist_id :bigint not null # +# Indexes +# +# index_playlist_items_on_playlist_id (playlist_id) +# index_playlist_items_on_playlist_id_and_item_id (playlist_id,item_id) UNIQUE +# +# Foreign Keys +# +# fk_rails_... (playlist_id => playlists.id) +# FactoryBot.define do factory :playlist_item do for_track diff --git a/test/factories/playlists.rb b/test/factories/playlists.rb index 4fa83c62..05f4e7f6 100644 --- a/test/factories/playlists.rb +++ b/test/factories/playlists.rb @@ -11,6 +11,14 @@ # updated_at :datetime not null # user_id :bigint not null # +# Indexes +# +# index_playlists_on_user_id (user_id) +# +# Foreign Keys +# +# fk_rails_... (user_id => users.id) +# FactoryBot.define do factory :playlist do name { Faker::Lorem.word } diff --git a/test/factories/plays.rb b/test/factories/plays.rb index 5fb567e0..081db212 100644 --- a/test/factories/plays.rb +++ b/test/factories/plays.rb @@ -7,6 +7,17 @@ # track_id :bigint not null # user_id :bigint not null # +# Indexes +# +# index_plays_on_track_id (track_id) +# index_plays_on_user_id (user_id) +# index_plays_on_user_id_and_track_id (user_id,track_id) +# +# Foreign Keys +# +# fk_rails_... (track_id => tracks.id) +# fk_rails_... (user_id => users.id) +# FactoryBot.define do factory :play do track diff --git a/test/factories/rescan_runners.rb b/test/factories/rescan_runners.rb index 469836dd..707adf32 100644 --- a/test/factories/rescan_runners.rb +++ b/test/factories/rescan_runners.rb @@ -10,6 +10,14 @@ # warning_text :text # location_id :bigint not null # +# Indexes +# +# index_rescan_runners_on_location_id (location_id) +# +# Foreign Keys +# +# fk_rails_... (location_id => locations.id) +# FactoryBot.define do factory :rescan_runner do finished_at { 1.minute.ago } diff --git a/test/factories/track_artists.rb b/test/factories/track_artists.rb index 87b0c9b4..3716cd80 100644 --- a/test/factories/track_artists.rb +++ b/test/factories/track_artists.rb @@ -11,6 +11,18 @@ # artist_id :bigint not null # track_id :bigint not null # +# Indexes +# +# index_track_artists_on_artist_id (artist_id) +# index_track_artists_on_normalized_name (normalized_name) +# index_track_artists_on_track_id (track_id) +# index_track_artists_on_track_id_and_artist_id_and_name_and_role (track_id,artist_id,name,role) UNIQUE +# +# Foreign Keys +# +# fk_rails_... (artist_id => artists.id) +# fk_rails_... (track_id => tracks.id) +# FactoryBot.define do factory :track_artist do diff --git a/test/factories/tracks.rb b/test/factories/tracks.rb index a439e884..6d772e4f 100644 --- a/test/factories/tracks.rb +++ b/test/factories/tracks.rb @@ -12,6 +12,17 @@ # album_id :bigint not null # audio_file_id :bigint # +# Indexes +# +# index_tracks_on_album_id (album_id) +# index_tracks_on_audio_file_id (audio_file_id) UNIQUE +# index_tracks_on_normalized_title (normalized_title) +# +# Foreign Keys +# +# fk_rails_... (album_id => albums.id) +# fk_rails_... (audio_file_id => audio_files.id) +# FactoryBot.define do factory :track do diff --git a/test/factories/transcoded_items.rb b/test/factories/transcoded_items.rb index 11a83178..4d20869f 100644 --- a/test/factories/transcoded_items.rb +++ b/test/factories/transcoded_items.rb @@ -9,6 +9,18 @@ # audio_file_id :bigint not null # codec_conversion_id :bigint not null # +# Indexes +# +# index_transcoded_items_on_audio_file_id (audio_file_id) +# index_transcoded_items_on_audio_file_id_and_codec_conversion_id (audio_file_id,codec_conversion_id) UNIQUE +# index_transcoded_items_on_codec_conversion_id (codec_conversion_id) +# index_transcoded_items_on_codec_conversion_id_and_uuid (codec_conversion_id,uuid) UNIQUE +# +# Foreign Keys +# +# fk_rails_... (audio_file_id => audio_files.id) +# fk_rails_... (codec_conversion_id => codec_conversions.id) +# FactoryBot.define do factory :transcoded_item do uuid { SecureRandom.uuid } diff --git a/test/factories/users.rb b/test/factories/users.rb index 52a45bd6..17c11972 100644 --- a/test/factories/users.rb +++ b/test/factories/users.rb @@ -7,6 +7,10 @@ # password_digest :string not null # permission :integer default("user"), not null # +# Indexes +# +# index_users_on_name (name) UNIQUE +# FactoryBot.define do factory :user do diff --git a/test/models/album_artist_test.rb b/test/models/album_artist_test.rb index 19cfd149..76e819b7 100644 --- a/test/models/album_artist_test.rb +++ b/test/models/album_artist_test.rb @@ -10,6 +10,18 @@ # album_id :bigint not null # artist_id :bigint not null # +# Indexes +# +# index_album_artists_on_album_id (album_id) +# index_album_artists_on_album_id_and_artist_id_and_name (album_id,artist_id,name) UNIQUE +# index_album_artists_on_artist_id (artist_id) +# index_album_artists_on_normalized_name (normalized_name) +# +# Foreign Keys +# +# fk_rails_... (album_id => albums.id) +# fk_rails_... (artist_id => artists.id) +# require 'test_helper' diff --git a/test/models/album_label_test.rb b/test/models/album_label_test.rb index 6ce71657..b0e9422a 100644 --- a/test/models/album_label_test.rb +++ b/test/models/album_label_test.rb @@ -7,6 +7,17 @@ # album_id :bigint not null # label_id :bigint not null # +# Indexes +# +# index_album_labels_on_album_id (album_id) +# index_album_labels_on_album_id_and_label_id (album_id,label_id) UNIQUE +# index_album_labels_on_label_id (label_id) +# +# Foreign Keys +# +# fk_rails_... (album_id => albums.id) +# fk_rails_... (label_id => labels.id) +# require 'test_helper' diff --git a/test/models/album_test.rb b/test/models/album_test.rb index 05c35d65..36c2087d 100644 --- a/test/models/album_test.rb +++ b/test/models/album_test.rb @@ -13,6 +13,15 @@ # updated_at :datetime not null # image_id :bigint # +# Indexes +# +# index_albums_on_image_id (image_id) UNIQUE +# index_albums_on_normalized_title (normalized_title) +# +# Foreign Keys +# +# fk_rails_... (image_id => images.id) +# require 'test_helper' diff --git a/test/models/artist_test.rb b/test/models/artist_test.rb index 4bb3e305..b583c1a9 100644 --- a/test/models/artist_test.rb +++ b/test/models/artist_test.rb @@ -10,6 +10,15 @@ # updated_at :datetime not null # image_id :bigint # +# Indexes +# +# index_artists_on_image_id (image_id) UNIQUE +# index_artists_on_normalized_name (normalized_name) +# +# Foreign Keys +# +# fk_rails_... (image_id => images.id) +# require 'test_helper' diff --git a/test/models/audio_file_test.rb b/test/models/audio_file_test.rb index a13151bb..8955d76d 100644 --- a/test/models/audio_file_test.rb +++ b/test/models/audio_file_test.rb @@ -11,6 +11,17 @@ # codec_id :bigint not null # location_id :bigint not null # +# Indexes +# +# index_audio_files_on_codec_id (codec_id) +# index_audio_files_on_location_id (location_id) +# index_audio_files_on_location_id_and_filename (location_id,filename) UNIQUE +# +# Foreign Keys +# +# fk_rails_... (codec_id => codecs.id) +# fk_rails_... (location_id => locations.id) +# require 'test_helper' diff --git a/test/models/auth_token_test.rb b/test/models/auth_token_test.rb index fab6aa2d..e69711be 100644 --- a/test/models/auth_token_test.rb +++ b/test/models/auth_token_test.rb @@ -9,6 +9,15 @@ # device_id :string not null # user_id :bigint not null # +# Indexes +# +# index_auth_tokens_on_device_id (device_id) UNIQUE +# index_auth_tokens_on_user_id (user_id) +# +# Foreign Keys +# +# fk_rails_... (user_id => users.id) +# require 'test_helper' diff --git a/test/models/codec_conversion_test.rb b/test/models/codec_conversion_test.rb index 938d3264..808794a2 100644 --- a/test/models/codec_conversion_test.rb +++ b/test/models/codec_conversion_test.rb @@ -7,6 +7,15 @@ # name :string not null # resulting_codec_id :bigint not null # +# Indexes +# +# index_codec_conversions_on_name (name) UNIQUE +# index_codec_conversions_on_resulting_codec_id (resulting_codec_id) +# +# Foreign Keys +# +# fk_rails_... (resulting_codec_id => codecs.id) +# require 'test_helper' diff --git a/test/models/codec_test.rb b/test/models/codec_test.rb index 5393e623..0bda1228 100644 --- a/test/models/codec_test.rb +++ b/test/models/codec_test.rb @@ -6,6 +6,10 @@ # extension :string not null # mimetype :string not null # +# Indexes +# +# index_codecs_on_extension (extension) UNIQUE +# require 'test_helper' diff --git a/test/models/cover_filename_test.rb b/test/models/cover_filename_test.rb index 0ea8a1ba..3054f683 100644 --- a/test/models/cover_filename_test.rb +++ b/test/models/cover_filename_test.rb @@ -5,6 +5,10 @@ # id :bigint not null, primary key # filename :string not null # +# Indexes +# +# index_cover_filenames_on_filename (filename) UNIQUE +# require 'test_helper' diff --git a/test/models/genre_test.rb b/test/models/genre_test.rb index 8b1bf297..8c291710 100644 --- a/test/models/genre_test.rb +++ b/test/models/genre_test.rb @@ -6,6 +6,11 @@ # name :string not null # normalized_name :string not null # +# Indexes +# +# index_genres_on_name (name) UNIQUE +# index_genres_on_normalized_name (normalized_name) +# require 'test_helper' diff --git a/test/models/image_test.rb b/test/models/image_test.rb index 1aa48ba3..2655f475 100644 --- a/test/models/image_test.rb +++ b/test/models/image_test.rb @@ -5,6 +5,14 @@ # id :bigint not null, primary key # image_type_id :bigint not null # +# Indexes +# +# index_images_on_image_type_id (image_type_id) +# +# Foreign Keys +# +# fk_rails_... (image_type_id => image_types.id) +# require 'test_helper' diff --git a/test/models/image_type_test.rb b/test/models/image_type_test.rb index 6dadcc77..8efa7fd7 100644 --- a/test/models/image_type_test.rb +++ b/test/models/image_type_test.rb @@ -6,6 +6,10 @@ # extension :string not null # mimetype :string not null # +# Indexes +# +# index_image_types_on_extension (extension) UNIQUE +# require 'test_helper' diff --git a/test/models/label_test.rb b/test/models/label_test.rb index a67e927f..a941c467 100644 --- a/test/models/label_test.rb +++ b/test/models/label_test.rb @@ -6,6 +6,10 @@ # name :string not null # normalized_name :string not null # +# Indexes +# +# index_labels_on_normalized_name (normalized_name) +# require 'test_helper' diff --git a/test/models/location_test.rb b/test/models/location_test.rb index 0fe0119a..875baf7a 100644 --- a/test/models/location_test.rb +++ b/test/models/location_test.rb @@ -5,6 +5,10 @@ # id :bigint not null, primary key # path :string not null # +# Indexes +# +# index_locations_on_path (path) UNIQUE +# require 'test_helper' diff --git a/test/models/play_test.rb b/test/models/play_test.rb index 006e214e..3bd2fe17 100644 --- a/test/models/play_test.rb +++ b/test/models/play_test.rb @@ -7,6 +7,17 @@ # track_id :bigint not null # user_id :bigint not null # +# Indexes +# +# index_plays_on_track_id (track_id) +# index_plays_on_user_id (user_id) +# index_plays_on_user_id_and_track_id (user_id,track_id) +# +# Foreign Keys +# +# fk_rails_... (track_id => tracks.id) +# fk_rails_... (user_id => users.id) +# require 'test_helper' class PlayTest < ActiveSupport::TestCase diff --git a/test/models/playlist_item_test.rb b/test/models/playlist_item_test.rb index d2e6bba3..26d1d817 100644 --- a/test/models/playlist_item_test.rb +++ b/test/models/playlist_item_test.rb @@ -10,6 +10,15 @@ # item_id :integer not null # playlist_id :bigint not null # +# Indexes +# +# index_playlist_items_on_playlist_id (playlist_id) +# index_playlist_items_on_playlist_id_and_item_id (playlist_id,item_id) UNIQUE +# +# Foreign Keys +# +# fk_rails_... (playlist_id => playlists.id) +# require 'test_helper' class PlayListItemTest < ActiveSupport::TestCase diff --git a/test/models/playlist_test.rb b/test/models/playlist_test.rb index 61862c7d..3deebb9a 100644 --- a/test/models/playlist_test.rb +++ b/test/models/playlist_test.rb @@ -11,6 +11,14 @@ # updated_at :datetime not null # user_id :bigint not null # +# Indexes +# +# index_playlists_on_user_id (user_id) +# +# Foreign Keys +# +# fk_rails_... (user_id => users.id) +# require 'test_helper' class PlaylistTest < ActiveSupport::TestCase diff --git a/test/models/rescan_runner_test.rb b/test/models/rescan_runner_test.rb index 711cb56b..d509046a 100644 --- a/test/models/rescan_runner_test.rb +++ b/test/models/rescan_runner_test.rb @@ -10,6 +10,14 @@ # warning_text :text # location_id :bigint not null # +# Indexes +# +# index_rescan_runners_on_location_id (location_id) +# +# Foreign Keys +# +# fk_rails_... (location_id => locations.id) +# require 'test_helper' class RescanRunnerTest < ActiveSupport::TestCase diff --git a/test/models/track_artist_test.rb b/test/models/track_artist_test.rb index 478f315b..103807a0 100644 --- a/test/models/track_artist_test.rb +++ b/test/models/track_artist_test.rb @@ -11,6 +11,18 @@ # artist_id :bigint not null # track_id :bigint not null # +# Indexes +# +# index_track_artists_on_artist_id (artist_id) +# index_track_artists_on_normalized_name (normalized_name) +# index_track_artists_on_track_id (track_id) +# index_track_artists_on_track_id_and_artist_id_and_name_and_role (track_id,artist_id,name,role) UNIQUE +# +# Foreign Keys +# +# fk_rails_... (artist_id => artists.id) +# fk_rails_... (track_id => tracks.id) +# require 'test_helper' diff --git a/test/models/track_test.rb b/test/models/track_test.rb index bdbaf299..846f0331 100644 --- a/test/models/track_test.rb +++ b/test/models/track_test.rb @@ -12,6 +12,17 @@ # album_id :bigint not null # audio_file_id :bigint # +# Indexes +# +# index_tracks_on_album_id (album_id) +# index_tracks_on_audio_file_id (audio_file_id) UNIQUE +# index_tracks_on_normalized_title (normalized_title) +# +# Foreign Keys +# +# fk_rails_... (album_id => albums.id) +# fk_rails_... (audio_file_id => audio_files.id) +# require 'test_helper' diff --git a/test/models/transcoded_item_test.rb b/test/models/transcoded_item_test.rb index 01339f79..2c253676 100644 --- a/test/models/transcoded_item_test.rb +++ b/test/models/transcoded_item_test.rb @@ -9,6 +9,18 @@ # audio_file_id :bigint not null # codec_conversion_id :bigint not null # +# Indexes +# +# index_transcoded_items_on_audio_file_id (audio_file_id) +# index_transcoded_items_on_audio_file_id_and_codec_conversion_id (audio_file_id,codec_conversion_id) UNIQUE +# index_transcoded_items_on_codec_conversion_id (codec_conversion_id) +# index_transcoded_items_on_codec_conversion_id_and_uuid (codec_conversion_id,uuid) UNIQUE +# +# Foreign Keys +# +# fk_rails_... (audio_file_id => audio_files.id) +# fk_rails_... (codec_conversion_id => codec_conversions.id) +# require 'test_helper' class TranscodedItemTest < ActiveSupport::TestCase diff --git a/test/models/user_test.rb b/test/models/user_test.rb index e5067c7d..69fe260b 100644 --- a/test/models/user_test.rb +++ b/test/models/user_test.rb @@ -7,6 +7,10 @@ # password_digest :string not null # permission :integer default("user"), not null # +# Indexes +# +# index_users_on_name (name) UNIQUE +# require 'test_helper'