Skip to content

chore: cleanup todos (waiting for CRDB v23 EOL) #343

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -77,21 +77,15 @@ def pk_and_sequence_for(table) # :nodoc:
pg_attribute attr,
pg_depend dep,
pg_constraint cons,
pg_namespace nsp,
-- TODO: use the pg_catalog.pg_attribute(attishidden) column when
-- it is added instead of joining on crdb_internal.
-- See https://github.com/cockroachdb/cockroach/pull/126397
crdb_internal.table_columns tc
pg_namespace nsp
WHERE seq.oid = dep.objid
AND seq.relkind = 'S'
AND attr.attrelid = dep.refobjid
AND attr.attnum = dep.refobjsubid
AND attr.attrelid = cons.conrelid
AND attr.attnum = cons.conkey[1]
AND seq.relnamespace = nsp.oid
AND attr.attrelid = tc.descriptor_id
AND attr.attname = tc.column_name
AND tc.hidden = false
AND attr.attishidden = false
AND cons.contype = 'p'
AND dep.classid = 'pg_class'::regclass
AND dep.refobjid = #{quote(quote_table_name(table))}::regclass
Expand Down
5 changes: 1 addition & 4 deletions lib/active_record/connection_adapters/cockroachdb_adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -414,11 +414,8 @@ def column_definitions(table_name)
fields.delete_if do |field|
# Don't include rowid column if it is hidden and the primary key
# is not defined (meaning CRDB implicitly created it).
if field[0] == CockroachDBAdapter::DEFAULT_PRIMARY_KEY
field[0] == CockroachDBAdapter::DEFAULT_PRIMARY_KEY &&
field[10] && !primary_key(table_name)
else
false # Keep this entry.
end
end
end

Expand Down
2 changes: 1 addition & 1 deletion test/cases/helper_cockroachdb.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def current_adapter?(...)
module LoadSchemaHelperExt
def load_schema
# TODO: Remove this const_set mess once https://github.com/rails/rails/commit/d5c2ff8345c9d23b7326edb2bbe72b6e86a63140
# is part of a rails release.
# is part of a rails release (likely 8.0.0).
old_helper = ActiveRecord::TestCase
ActiveRecord.const_set(:TestCase, NoPGSchemaTestCase.new(ActiveRecord::TestCase))
return if ENV['COCKROACH_LOAD_FROM_TEMPLATE']
Expand Down
50 changes: 0 additions & 50 deletions test/cases/migration/columns_test.rb

This file was deleted.

8 changes: 5 additions & 3 deletions test/excludes/ActiveRecord/AdapterTest.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
exclude :test_indexes, "Rails transactional tests are being used while making schema changes. See https://www.cockroachlabs.com/docs/stable/online-schema-changes.html#limited-support-for-schema-changes-within-transactions."
exclude :test_remove_index_when_name_and_wrong_column_name_specified, "Rails transactional tests are being used while making schema changes. See https://www.cockroachlabs.com/docs/stable/online-schema-changes.html#limited-support-for-schema-changes-within-transactions."
exclude :test_remove_index_when_name_and_wrong_column_name_specified_positional_argument, "Rails transactional tests are being used while making schema changes. See https://www.cockroachlabs.com/docs/stable/online-schema-changes.html#limited-support-for-schema-changes-within-transactions."
transactional_test_msg = "Rails transactional tests are being used while making schema changes. " \
"See https://www.cockroachlabs.com/docs/stable/online-schema-changes.html#limited-support-for-schema-changes-within-transactions."
exclude :test_indexes, transactional_test_msg
exclude :test_remove_index_when_name_and_wrong_column_name_specified, transactional_test_msg
exclude :test_remove_index_when_name_and_wrong_column_name_specified_positional_argument, transactional_test_msg
4 changes: 0 additions & 4 deletions test/excludes/ActiveRecord/Migration/ColumnsTest.rb

This file was deleted.

2 changes: 0 additions & 2 deletions test/excludes/AttributeMethodsTest.rb

This file was deleted.

9 changes: 5 additions & 4 deletions test/excludes/BulkAlterTableMigrationsTest.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
exclude :test_changing_columns, "Type conversion from DATE to TIMESTAMP requires overwriting existing values which is not yet implemented. https://github.com/cockroachdb/cockroach/issues/9851"
exclude :test_changing_column_null_with_default, "Type conversion from DATE to TIMESTAMP requires overwriting existing values which is not yet implemented. https://github.com/cockroachdb/cockroach/issues/9851"

exclude :test_adding_indexes, "Need to reference the specific query count for CockroachDB"
exclude :test_removing_index, "Need to reference the specific query count for CockroachDB"
exclude :test_adding_multiple_columns, "Need to reference the specific query count for CockroachDB"
exclude :test_changing_index, "Need to reference the specific query count for CockroachDB"
query_count_msg = "Need to reference the specific query count for CockroachDB. Fixed in test/cases/migration_test.rb"
exclude :test_adding_indexes, query_count_msg
exclude :test_removing_index, query_count_msg
exclude :test_adding_multiple_columns, query_count_msg
exclude :test_changing_index, query_count_msg
2 changes: 1 addition & 1 deletion test/excludes/PostgresqlNetworkTest.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def on_send(node)
case node
in [:send, [:const, nil, :PostgresqlNetworkAddress], /create|new/, [:hash, *pairs]]

pairs.each_with_index do |pair, i|
pairs.each do |pair|
if pair in [:pair, [:sym, /(cidr|mac)_address/], *]
expr = pair.location.expression
large_expr = expr.resize(expr.size + 1)
Expand Down
Loading