Loading
Match gitlab:db:sos schema dump file extension to its content
What does this MR do and why?
gitlab:db:sos writes a schema dump named <db>_schema_dump.sql, but the content is Rails' Ruby schema dump (ActiveRecord::Schema[...].define) from connection.create_schema_dumper, not SQL.
This renames the emitted file to <db>_schema_dump.rb so the extension matches the content.
Resolves #595282 (closed).
How to set up and validate locally
bin/rake gitlab:db:sos- Each database directory in the resulting zip contains
<db>_schema_dump.rbwith the Ruby schema dump instead of the misnamed.sqlfile.
Supporting evidence
- The old filename appeared in exactly two places: the class and its spec. The admin docs for the rake task don't list bundle filenames, so nothing else needed updating.
- Note for Support: this renames an entry inside the sos zip. Anything externally parsing the old name should update — though anything parsing that file as SQL was already broken, since the content was never SQL.
- Considered writing real SQL instead, but that would mean shelling out to
pg_dumpon customer instances, a disproportionate behavior change for a naming papercut. bin/rspec spec/lib/gitlab/database/sos/ar_schema_dump_spec.rb spec/lib/gitlab/database/sos_spec.rb spec/lib/gitlab/database/sos/output_spec.rb→ 9 examples, 0 failures, including a new example that writes a real dump and asserts the.rbfile containsActiveRecord::Schema.- End-to-end check on a local GDK (real
Outputin zip mode, driven exactly as the rake task does, across main/ci/sec databases): the zip containsmain/main_schema_dump.rb,ci/ci_schema_dump.rb,sec/sec_schema_dump.rb, each starting with the auto-generated ActiveRecord schema header. - RuboCop clean on both changed files.
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist.