Sha256: 27d038d59dcf591cb91e76df3b02a8b454e2b91862cfb5b1d74936e0b0b7cad0

Contents?: true

Size: 588 Bytes

Versions: 3

Compression:

Stored size: 588 Bytes

Contents

# frozen_string_literal: true

class CreateCompactChannel < ActiveRecord::Migration[7.2]
  def change
    change_column :solid_cable_messages, :channel, :binary, limit: 1024, null: false
    add_column :solid_cable_messages, :channel_hash, :integer, limit: 8, if_not_exists: true
    add_index :solid_cable_messages, :channel_hash, if_not_exists: true
    change_column :solid_cable_messages, :payload, :binary, limit: 536_870_912, null: false

    SolidCable::Message.find_each do |msg|
      msg.update(channel_hash: SolidCable::Message.channel_hash_for(msg.channel))
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
solid_cable-3.0.2 lib/generators/solid_cable/update/templates/db/migrate/create_compact_channel.rb
solid_cable-3.0.1 lib/generators/solid_cable/update/templates/db/migrate/create_compact_channel.rb
solid_cable-3.0.0 lib/generators/solid_cable/update/templates/db/migrate/create_compact_channel.rb