Skip to content

Commit e994926

Browse files
authored
Merge pull request rails#27997 from kamipo/should_keep_pk_column_order
Should keep the primary key column order
2 parents a778a0d + 2693c86 commit e994926

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,7 @@ def primary_keys(table_name) # :nodoc:
441441
WHERE constraint_type = 'PRIMARY KEY'
442442
AND kcu.table_name = #{quote(name.identifier)}
443443
AND kcu.table_schema = #{name.schema ? quote(name.schema) : "ANY (current_schemas(false))"}
444+
ORDER BY kcu.ordinal_position
444445
SQL
445446
end
446447

0 commit comments

Comments
 (0)