Skip to content

Coerce partial-index rename test for SQL Server boolean predicate syntax#1388

Draft
Copilot wants to merge 1 commit into
mainfrom
copilot/fix-failing-test
Draft

Coerce partial-index rename test for SQL Server boolean predicate syntax#1388
Copilot wants to merge 1 commit into
mainfrom
copilot/fix-failing-test

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jun 6, 2026

The CI failure came from ActiveRecord::Migration::IndexTest#test_rename_index_preserves_where_clause generating a SQL Server partial index with an invalid bare boolean predicate (administrator). SQL Server requires an explicit truthy comparison for BIT columns.

  • Scope

    • Add a SQL Server-specific coerced variant of test_rename_index_preserves_where_clause in test/cases/coerced_tests.rb.
  • Behavior change

    • Use a SQL Server-compatible partial index predicate (administrator = 1) while keeping the test’s intent unchanged: verify the where clause is preserved across rename_index.
  • Why this resolves the failure

    • Avoids invalid SQL generation in this adapter context and preserves coverage of rename semantics for filtered indexes.
connection.add_index(table_name, [:foo], name: "old_idx", where: "administrator = 1")
old_where = connection.indexes(table_name).find { |i| i.name == "old_idx" }.where

connection.rename_index(table_name, "old_idx", "new_idx")

new_index = connection.indexes(table_name).find { |i| i.name == "new_idx" }
assert_equal old_where, new_index.where

Copilot AI changed the title Fix SQL Server coercion for partial index rename test Coerce partial-index rename test for SQL Server boolean predicate syntax Jun 6, 2026
Copilot AI requested a review from aidanharan June 6, 2026 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants