What is t.index used for and do the details of the functional index matter?

In schema.rb there indices are shown. During an upgrade a functional index has been reduced to an index on a column. Since I am not sure how they are used I wonder if this can cause problems later on.

I assume this could make problems in a re-initialized database for example when testing. Is there another use case? This Upgrade was from Rails 4 to Rails 6. Did something change here?

1 Like

In the Rails framework, the schema.rb file contains the definition of your database schema, including the tables, columns, and indices. During an upgrade from Rails 4 to Rails 6, it’s possible that some changes occurred in the way indices are defined, which could lead to potential issues when using a re-initialized database or during testing.

1 Like

Yes, reducing a functional index to a column index may cause problems, especially if the original index served specific queries. In the upgrade from Rails 4 to Rails 6, there may be changes in how indices are handled. Thorough testing is essential to ensure that performance and functionality remain intact.

You’ve mentioned that during the upgrade, a functional index was reduced to an index on a column. This means that a previously existing index that used a function to index data has been changed to a simple index on a single column. Functional indexes are used to index the result of an expression or function applied to the data, while column indexes index the values in a specific column directly.