forked from e621ng/e621ng
[StaffNotes] Fix DB migration (#835)
This commit is contained in:
parent
3b4acda60d
commit
7afeffc647
@ -156,6 +156,3 @@ Style/TrailingCommaInArrayLiteral:
|
|||||||
|
|
||||||
Style/TrailingCommaInHashLiteral:
|
Style/TrailingCommaInHashLiteral:
|
||||||
EnforcedStyleForMultiline: consistent_comma
|
EnforcedStyleForMultiline: consistent_comma
|
||||||
|
|
||||||
Rails/NotNullColumn:
|
|
||||||
Enabled: false
|
|
||||||
|
@ -1,9 +1,13 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class SoftDeletableStaffNotes < ActiveRecord::Migration[7.1]
|
class SoftDeletableStaffNotes < ActiveRecord::Migration[7.1]
|
||||||
def change
|
def up
|
||||||
add_column :staff_notes, :is_deleted, :boolean, null: false, default: false
|
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
|
remove_column :staff_notes, :resolved, :boolean, null: false, default: false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user