[StaffNotes] Fix DB migration (#835)

This commit is contained in:
clragon 2025-01-15 17:09:29 +01:00 committed by GitHub
parent 3b4acda60d
commit 7afeffc647
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 6 deletions

View File

@ -156,6 +156,3 @@ Style/TrailingCommaInArrayLiteral:
Style/TrailingCommaInHashLiteral:
EnforcedStyleForMultiline: consistent_comma
Rails/NotNullColumn:
Enabled: false

View File

@ -1,9 +1,13 @@
# frozen_string_literal: true
class SoftDeletableStaffNotes < ActiveRecord::Migration[7.1]
def change
def up
add_column :staff_notes, :is_deleted, :boolean, null: false, default: false
add_reference :staff_notes, :updater, foreign_key: { to_table: :users }, null: false
add_reference :staff_notes, :updater, foreign_key: { to_table: :users }, null: true
execute("UPDATE staff_notes SET updater_id = creator_id")
change_column_null :staff_notes, :updater_id, false
remove_column :staff_notes, :resolved, :boolean, null: false, default: false
end
end