Can't run rake db:migrate a tsvector GIN index for Postgresql in Rails using Railscast sample Can't run rake db:migrate a tsvector GIN index for Postgresql in Rails using Railscast sample postgresql postgresql

Can't run rake db:migrate a tsvector GIN index for Postgresql in Rails using Railscast sample


REFERENCES is a keyword used with foreign keys so you can't use it as a table name unless you double quote it:

def up  execute %q{create index references_title on "references" using gin(to_tsvector('english', title))}  execute %q{create index references_full_text on "references" using gin(to_tsvector('english', full_text))}end

You'll also have to double quote that table name anywhere you use it in an SQL snippet. ActiveRecord will do the quoting for you if it is building the SQL though. If you're expecting to use the table name in a lot of SQL snippets then I'd recommend renaming the table so that you don't have to care about the quoting issue.