-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error running migration 20230526212613_convert_to_active_storage.rb #1122
Comments
Seems related to erroneous ActiveStorage migration guide code in PaperClip - thoughtbot/paperclip#2603 Potential solution: thoughtbot/paperclip#2568 (comment) |
What database are you using to get this? |
postgresql, will check which version |
ugh i tested the active storage migration on sqlite and mysql, shouldve checked pg too :/ |
I'm not sure if this is useful, but this is a hacky change that at least the migration runs - though without prepare statements unfortunately. ActiveRecord::Base.connection.raw_connection.then do |conn|
unless conn.is_a?(PG::Connection)
ActiveRecord::Base.connection.raw_connection.prepare(<<-SQL)
INSERT INTO active_storage_blobs (
`key`, filename, content_type, metadata, byte_size, checksum, created_at
) VALUES (?, ?, ?, '{}', ?, ?, ?)
SQL
ActiveRecord::Base.connection.raw_connection.prepare(<<-SQL)
INSERT INTO active_storage_attachments (
name, record_type, record_id, blob_id, created_at
) VALUES (?, ?, ?, #{get_blob_id}, ?)
SQL
end
end |
I went through the same error. I tested both with postgres and mysql and I always have some error to do this migration |
Per request from @CloCkWeRX , the fix for this has been broken out into a separate PR (see #1137) |
…n_20230526212613_convert_to_active_storage_rb Support for Postgres prepare statement #1122
Can this be closed now #1137 is in |
Steps to reproduce:
I get the following error (truncated):
The text was updated successfully, but these errors were encountered: