Skip to content
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

Fix irreversible upgrade migration #44

Merged
merged 1 commit into from
Oct 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion bench/db/migrate/20240912235943_create_compact_channel.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

class CreateCompactChannel < ActiveRecord::Migration[7.2]
def change
def up
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
Expand All @@ -12,4 +12,10 @@ def change
msg.update(channel_hash: SolidCable::Message.channel_hash_for(msg.channel))
end
end

def down
change_column :solid_cable_messages, :channel, :text
remove_column :solid_cable_messages, :channel_hash, if_exists: true
change_column :solid_cable_messages, :payload, :text
end
end
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

class CreateCompactChannel < ActiveRecord::Migration[7.2]
def change
def up
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
Expand All @@ -11,4 +11,10 @@ def change
msg.update(channel_hash: SolidCable::Message.channel_hash_for(msg.channel))
end
end

def down
change_column :solid_cable_messages, :channel, :text
remove_column :solid_cable_messages, :channel_hash, if_exists: true
change_column :solid_cable_messages, :payload, :text
end
end