DEV: Database backed admin notices (#26192)

This PR introduces a basic AdminNotice model to store these notices. Admin notices are categorized by their source/type (currently only notices from problem check.) They also have a priority.
This commit is contained in:
Ted Johansson
2024-05-23 09:29:08 +08:00
committed by GitHub
parent 7e8e803785
commit 3137e60653
55 changed files with 512 additions and 264 deletions

View File

@@ -0,0 +1,14 @@
# frozen_string_literal: true
class CreateAdminNotices < ActiveRecord::Migration[7.0]
def change
create_table :admin_notices do |t|
t.integer :subject, null: false, index: true
t.integer :priority, null: false
t.string :identifier, null: false, index: true
t.json :details, null: false, default: {}
t.timestamps
end
end
end

View File

@@ -0,0 +1,7 @@
# frozen_string_literal: true
class AddDetailsToProblemCheckTrackers < ActiveRecord::Migration[7.0]
def change
add_column :problem_check_trackers, :details, :json, default: {}
end
end

View File

@@ -0,0 +1,7 @@
# frozen_string_literal: true
class AddTargetToProblemCheckTrackers < ActiveRecord::Migration[7.0]
def change
add_column :problem_check_trackers, :target, :string, null: true
end
end

View File

@@ -0,0 +1,8 @@
# frozen_string_literal: true
class DisambiguateProblemCheckTrackerUniqueness < ActiveRecord::Migration[7.0]
def change
remove_index :problem_check_trackers, name: "index_problem_check_trackers_on_identifier"
add_index :problem_check_trackers, %i[identifier target], unique: true
end
end