Skip to content
This repository was archived by the owner on Jul 22, 2025. It is now read-only.

Commit c5b323f

Browse files
authored
DEV: Fix mismatched column types in tests (#826)
The primary key is usually a bigint column, but the foreign key columns usually are of integer type. This can lead to issues when joining these columns due to mismatched types and different value ranges. In a recent core change, all bigint sequences will start at a very high value in the test environment to surface this type of errors. The same change also added a temporary API that changes the column type to bigint in order to allow for the tests to run. The plugin API is only temporary and it is important for these plugins to migrate their columns to bigint to avoid issues in the future.
1 parent 95e7047 commit c5b323f

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

spec/plugin_helper.rb

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,14 @@ def assign_fake_provider_to(setting_name)
1414
end
1515
end
1616

17-
RSpec.configure { |c| c.include DiscourseAi::ChatBotHelper }
17+
RSpec.configure do |config|
18+
config.include DiscourseAi::ChatBotHelper
19+
20+
config.before(:suite) do
21+
if defined?(migrate_column_to_bigint)
22+
migrate_column_to_bigint(RagDocumentFragment, :target_id)
23+
migrate_column_to_bigint("ai_document_fragment_embeddings", "rag_document_fragment_id")
24+
migrate_column_to_bigint(ClassificationResult, :target_id)
25+
end
26+
end
27+
end

0 commit comments

Comments
 (0)