Use SQL heredoc on long statement lines in migrations (#29112)
This commit is contained in:
parent
64300e0fe3
commit
1e0b0a3486
4 changed files with 62 additions and 7 deletions
|
@ -2,7 +2,17 @@
|
|||
|
||||
class AddSearchIndexToAccounts < ActiveRecord::Migration[5.0]
|
||||
def up
|
||||
execute 'CREATE INDEX search_index ON accounts USING gin((setweight(to_tsvector(\'simple\', accounts.display_name), \'A\') || setweight(to_tsvector(\'simple\', accounts.username), \'B\') || setweight(to_tsvector(\'simple\', coalesce(accounts.domain, \'\')), \'C\')));'
|
||||
execute <<~SQL.squish
|
||||
CREATE INDEX search_index
|
||||
ON accounts
|
||||
USING gin(
|
||||
(
|
||||
setweight(to_tsvector('simple', accounts.display_name), 'A') ||
|
||||
setweight(to_tsvector('simple', accounts.username), 'B') ||
|
||||
setweight(to_tsvector('simple', coalesce(accounts.domain, '')), 'C')
|
||||
)
|
||||
)
|
||||
SQL
|
||||
end
|
||||
|
||||
def down
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue