kreeti / kt-paperclip

Easy file attachment management for ActiveRecord
Other
275 stars 95 forks source link

Unfreeze Paperclip::Schema::COLUMNS #87

Closed yskkin closed 2 years ago

yskkin commented 2 years ago

kt-paperclip freezes Paperclip::Schema::COLUMNS in #14.

We did the following in migration for preserving column type generated by old paperclip. Freezing Paperclip::Schema::COLUMNS breaks compatibility with original paperclip.

  def change
    Paperclip::Schema::COLUMNS[:file_size] = :integer
    create_table :table_foo do |t|
      # ......
      t.attachment :file
      t.string :file_fingerprint, null: false
      t.timestamp :file_created_at, default: -> { "CURRENT_TIMESTAMP" }, null: false
      t.text :file_meta, null: false
    end
  ensure
    Paperclip::Schema::COLUMNS[:file_size] = :bigint
  end