Skip to content

Rails 7.1.1: UUID support for MariaDB/MySQL is missing -> ActiveStorage setup migration fails to correctly dump the new schema.rb (with primary key type: UUID) #49752

@john-999

Description

@john-999

Steps to reproduce

After running the ActiveStorage setup, the migration producing the new schema.rb dump appears to fail, the beginning of it looking like this:

ActiveRecord::Schema[7.0].define(version: 2023_09_29_141433) do
# Could not dump table "active_storage_attachments" because of following StandardError
#   Unknown type 'uuid' for column 'id'

# Could not dump table "active_storage_blobs" because of following StandardError
#   Unknown type 'uuid' for column 'id'

# Could not dump table "active_storage_variant_records" because of following StandardError
#   Unknown type 'uuid' for column 'id'
...

In the config/application.rb file, I have added:

config.generators do |g|
  g.orm :active_record, primary_key_type: :uuid
end

However, looking at the generated DB tables in phpMyAdmin, all key and foreign-key values in the "Type" columns correctly show "uuid" (MariaDB supports the UUID data type natively).

System configuration

Rails version: 7.0.4.3
Ruby version: 3.0.1p64 (2021-04-05 revision 0fb782ee38) [x86_64-linux]
MariaDB version: 11.1.2
gem mysql2 version: 0.5.5

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions