Skip to content

Fix undefined format_options method in SchemaDumper for MySQL db

Dmytro Zaporozhets (DZ) requested to merge dz-fix-mysql-schema into master

What does this MR do?

Fixes invalid db/schema.rb generation for MySQL:

# Could not dump table "application_settings" because of following NoMethodError
# undefined method `format_options' for #<ActiveRecord::SchemaDumper:0x00007fdca8b9ead8>

# Could not dump table "audit_events" because of following NoMethodError
# undefined method `format_options' for #<ActiveRecord::SchemaDumper:0x00007fdca8b9ead8>

# Could not dump table "award_emoji" because of following NoMethodError
# undefined method `format_options' for #<ActiveRecord::SchemaDumper:0x00007fdca8b9ead8>

# Could not dump table "badges" because of following NoMethodError
# undefined method `format_options' for #<ActiveRecord::SchemaDumper:0x00007fdca8b9ead8>

# Could not dump table "boards" because of following NoMethodError
# undefined method `format_options' for #<ActiveRecord::SchemaDumper:0x00007fdca8b9ead8>

# Could not dump table "broadcast_messages" because of following NoMethodError
# undefined method `format_options' for #<ActiveRecord::SchemaDumper:0x00007fdca8b9ead8>

The problem appeared after we updated our opclasses support with Rails 5 code in https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/21416. There is no format_options method in https://github.com/rails/rails/blob/4-2-stable/activerecord/lib/active_record/schema_dumper.rb. For some reason it fails only in MySQL ¯_(ツ)_/¯

What are the relevant issue numbers?

Does this MR meet the acceptance criteria?

Edited by Dmytro Zaporozhets (DZ)

Merge request reports