Skip to content

Commit

Permalink
new test
Browse files Browse the repository at this point in the history
  • Loading branch information
BuonOmo committed Oct 4, 2024
1 parent 1067d43 commit 34cb6c2
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,4 @@ jobs:
done
cat ${{ github.workspace }}/setup.sql | cockroach sql --insecure
- name: Test
run: bundle exec rake test TESTOPTS='--profile=5' TEST_FILES=test/cases/reproduction_test.rb
run: bundle exec rake test TESTOPTS='--profile=5 --name=test_remove_index_with_a_hidden_column'
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def primary_keys(table_name)
end

def column_names_from_column_numbers(table_oid, column_numbers)
super unless database_version >= 24_02_02
return super unless database_version >= 24_02_02

Hash[query(<<~SQL, "SCHEMA")].values_at(*column_numbers).compact
SELECT a.attnum, a.attname
Expand Down
11 changes: 11 additions & 0 deletions test/cases/migration/hidden_column_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,17 @@ def test_add_hidden_column
output = dump_table_schema "rockets"
assert_match %r{t.uuid "new_col", hidden: true$}, output
end

# Since 24.2.2, hash sharded indexes add a hidden column to the table.
# This tests ensure that the user can still drop the index even if they
# call `#remove_index` with the column name rather than the index name.
def test_remove_index_with_a_hidden_column
@connection.execute <<-SQL
CREATE INDEX hash_idx ON rockets (name) USING HASH WITH (bucket_count=8);
SQL
@connection.remove_index :rockets, :name
# assert :ok
end
end
end
end
Expand Down

0 comments on commit 34cb6c2

Please sign in to comment.