Skip to content

Commit a90c1f4

Browse files
chore(CE): Migrate existing pg vector connectors to vector sub_category (#800)
Co-authored-by: TivonB-AI2 <[email protected]>
1 parent 8e3504d commit a90c1f4

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
class PopulateSubCategoryFieldInConnectors < ActiveRecord::Migration[7.1]
2+
def up
3+
Connector.find_each do |connector|
4+
sub_category_name = connector.connector_client.new.meta_data[:data][:sub_category]
5+
sub_category_name = "Vector Database" if connector.configuration["data_type"] == "vector"
6+
connector.update!(connector_sub_category: sub_category_name) if sub_category_name.present?
7+
rescue StandardError => e
8+
Rails.logger.error("Failed to update connector ##{connector.id}: #{e.message}")
9+
end
10+
end
11+
12+
def down
13+
Connector.find_each do |connector|
14+
connector.update!(connector_sub_category: "database")
15+
rescue StandardError => e
16+
Rails.logger.error("Failed to revert connector ##{connector.id} to 'data': #{e.message}")
17+
end
18+
end
19+
end

server/db/data_schema.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# frozen_string_literal: true
22

3-
DataMigrate::Data.define(version: 20250617163641)
3+
DataMigrate::Data.define(version: 20250710183353)

0 commit comments

Comments
 (0)