Skip to content

Commit

Permalink
index dump should not include full text indexes. Thanks Ken Mayer for…
Browse files Browse the repository at this point in the history
… the original patch! [#4949 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
  • Loading branch information
tenderlove authored and josevalim committed Jun 25, 2010
1 parent 65aa6a7 commit 4464d10
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -609,9 +609,7 @@ def indexes(table_name, name = nil)
SQL


indexes = []

indexes = result.map do |row|
result.map do |row|
index_name = row[0]
unique = row[1] == 't'
indkey = row[2].split(" ")
Expand All @@ -625,11 +623,8 @@ def indexes(table_name, name = nil)
SQL

column_names = indkey.map {|attnum| columns[attnum] }
IndexDefinition.new(table_name, index_name, unique, column_names)

end

indexes
column_names.compact.empty? ? nil : IndexDefinition.new(table_name, index_name, unique, column_names)
end.compact
end

# Returns the list of all column definitions for a table.
Expand Down
4 changes: 4 additions & 0 deletions activerecord/test/cases/adapters/postgresql/schema_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ class SchemaTest < ActiveRecord::TestCase
CAPITALIZED_TABLE_NAME = 'Things'
INDEX_A_NAME = 'a_index_things_on_name'
INDEX_B_NAME = 'b_index_things_on_different_columns_in_each_schema'
INDEX_C_NAME = 'c_index_full_text_search'
INDEX_A_COLUMN = 'name'
INDEX_B_COLUMN_S1 = 'email'
INDEX_B_COLUMN_S2 = 'moment'
INDEX_C_COLUMN = %q{(to_tsvector('english', coalesce(things.name, '')))}
COLUMNS = [
'id integer',
'name character varying(50)',
Expand Down Expand Up @@ -45,6 +47,8 @@ def setup
@connection.execute "CREATE INDEX #{INDEX_A_NAME} ON #{SCHEMA2_NAME}.#{TABLE_NAME} USING btree (#{INDEX_A_COLUMN});"
@connection.execute "CREATE INDEX #{INDEX_B_NAME} ON #{SCHEMA_NAME}.#{TABLE_NAME} USING btree (#{INDEX_B_COLUMN_S1});"
@connection.execute "CREATE INDEX #{INDEX_B_NAME} ON #{SCHEMA2_NAME}.#{TABLE_NAME} USING btree (#{INDEX_B_COLUMN_S2});"
@connection.execute "CREATE INDEX #{INDEX_C_NAME} ON #{SCHEMA_NAME}.#{TABLE_NAME} USING gin (#{INDEX_C_COLUMN});"
@connection.execute "CREATE INDEX #{INDEX_C_NAME} ON #{SCHEMA2_NAME}.#{TABLE_NAME} USING gin (#{INDEX_C_COLUMN});"
end

def teardown
Expand Down

0 comments on commit 4464d10

Please sign in to comment.