My project is set up to use db/structure.sql to track database migrations. Prior to Rails 7.1, the order of the rows under INSERT INTO "schema_migrations" (version) VALUES was in date ascending order. Snippet from db/structure.sql is below.
The data in a table has no intrinsic order. Rows in a table are an unordered set. Order only matters when retrieving or modifying that data, and that order is defined on a query-by-query basis.
(We sometimes think of a table as having the order of its primary key, in this case the version column, but this is an operational detail and a mental shortcut, not a feature of the table itself.)
In this case, there is no theoretical difference which order the rows appear in this INSERT query. They could be forwards, backwards, or random; all that matters is that the set of values being inserted is correct. When they’re retrieved with a SELECT, the ORDER BY clause used in that query will be the only thing determining the order (and if there isn’t one, the order is undefined).
So apparently its to address the two line diff from adding a new migration, because of the semicolon… and instead it’s a single line change. I guess that’s better