-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master' into issue/4250-subject-…
…set-remover
- Loading branch information
Showing
8 changed files
with
156 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
class AddTsvToUserGroups < ActiveRecord::Migration[6.1] | ||
def up | ||
add_column :user_groups, :tsv, :tsvector | ||
end | ||
|
||
def down | ||
remove_column :user_groups, :tsv | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
class AddIndexTsvToUserGroups < ActiveRecord::Migration[6.1] | ||
# Adding an index non-concurrently blocks writes. Therefore we need to disable ddl transaction | ||
|
||
disable_ddl_transaction! | ||
|
||
def up | ||
add_index :user_groups, :tsv, using: "gin", algorithm: :concurrently | ||
end | ||
|
||
def down | ||
remove_index :user_groups, :tsv | ||
end | ||
end |
24 changes: 24 additions & 0 deletions
24
db/migrate/20240216171937_create_sql_trigger_to_update_tsv_vector.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
class CreateSqlTriggerToUpdateTsvVector < ActiveRecord::Migration[6.1] | ||
disable_ddl_transaction! | ||
|
||
def up | ||
safety_assured { | ||
execute <<-SQL | ||
CREATE TRIGGER tsvectorupdate BEFORE INSERT OR UPDATE | ||
ON user_groups FOR EACH ROW EXECUTE PROCEDURE | ||
tsvector_update_trigger( | ||
tsv, 'pg_catalog.english', display_name | ||
); | ||
SQL | ||
} | ||
end | ||
|
||
def down | ||
safety_assured { | ||
execute <<-SQL | ||
DROP TRIGGER tsvectorupdate | ||
ON user_groups; | ||
SQL | ||
} | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters