Commit cf5a9d7e authored by Lukas Matt's avatar Lukas Matt Committed by Benjamin Neff

Delete all null entries before removing the column

related to #7032
Signed-off-by: default avatarLukas Matt <lukas@zauberstuhl.de>

closes #7038
parent 33b064b8
......@@ -24,11 +24,12 @@ class LinkShareVisibilitiesWithUser < ActiveRecord::Migration
remove_index :share_visibilities, name: :shareable_and_hidden_and_contact_id
remove_column :share_visibilities, :contact_id
change_column :share_visibilities, :user_id, :integer, null: false
ShareVisibility.joins("LEFT OUTER JOIN users ON users.id = share_visibilities.user_id")
.delete_all("users.id is NULL")
change_column :share_visibilities, :user_id, :integer, null: false
add_index :share_visibilities, :user_id
add_index :share_visibilities, %i(shareable_id shareable_type user_id), name: :shareable_and_user_id
add_index :share_visibilities, %i(shareable_id shareable_type hidden user_id),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment