diff options
Diffstat (limited to 'spec/migrations/20230321153035_add_package_id_created_at_desc_index_to_package_files_spec.rb')
-rw-r--r-- | spec/migrations/20230321153035_add_package_id_created_at_desc_index_to_package_files_spec.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/migrations/20230321153035_add_package_id_created_at_desc_index_to_package_files_spec.rb b/spec/migrations/20230321153035_add_package_id_created_at_desc_index_to_package_files_spec.rb new file mode 100644 index 00000000000..68f3b1f23a9 --- /dev/null +++ b/spec/migrations/20230321153035_add_package_id_created_at_desc_index_to_package_files_spec.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +require 'spec_helper' +require_migration! + +RSpec.describe AddPackageIdCreatedAtDescIndexToPackageFiles, feature_category: :package_registry do + it 'correctly migrates up and down' do + reversible_migration do |migration| + migration.before -> { + expect(ActiveRecord::Base.connection.indexes('packages_package_files').map(&:name)) + .not_to include('index_packages_package_files_on_package_id_and_created_at_desc') + } + + migration.after -> { + expect(ActiveRecord::Base.connection.indexes('packages_package_files').map(&:name)) + .to include('index_packages_package_files_on_package_id_and_created_at_desc') + } + end + end +end |