Skip to content
This repository has been archived by the owner on Jul 13, 2023. It is now read-only.

updating migration for specificities around mysql and postgres #2643

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 9 additions & 1 deletion MIGRATING.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,17 @@ class ConvertToActiveStorage < ActiveRecord::Migration[5.2]
# sqlite
# get_blob_id = 'LAST_INSERT_ROWID()'

# mysql
# active_storage_blob_statement = ActiveRecord::Base.connection.raw_connection.prepare('active_storage_blob_statement', <<-SQL)
# INSERT INTO active_storage_blobs (
# `key`, filename, content_type, metadata, byte_size, checksum, created_at
# ) VALUES ($1, $2, $3, '{}', $4, $5, $6)
# SQL

# postgres
active_storage_blob_statement = ActiveRecord::Base.connection.raw_connection.prepare('active_storage_blob_statement', <<-SQL)
INSERT INTO active_storage_blobs (
`key`, filename, content_type, metadata, byte_size, checksum, created_at
"key", filename, content_type, metadata, byte_size, checksum, created_at
) VALUES ($1, $2, $3, '{}', $4, $5, $6)
SQL

Expand Down