]> git.openstreetmap.org Git - rails.git/blob - db/migrate/20260223105922_create_noticed_tables.noticed.rb
Merge remote-tracking branch 'upstream/pull/7053'
[rails.git] / db / migrate / 20260223105922_create_noticed_tables.noticed.rb
1 # frozen_string_literal: true
2
3 # This is a composite of the migrations generated by the gem Noticed
4 # with `rails noticed:install:migrations`. They are as per version 3.0
5 # of the gem: https://github.com/excid3/noticed/tree/v3.0.0/db/migrate,
6 # plus some tweaks to remove unnecessary code.
7 class CreateNoticedTables < ActiveRecord::Migration[8.1]
8   def change
9     create_table :noticed_events do |t|
10       t.string :type
11       t.belongs_to :record, :polymorphic => true
12       t.integer :notifications_count
13
14       if t.respond_to?(:jsonb)
15         t.jsonb :params
16       else
17         t.json :params
18       end
19
20       t.timestamps
21     end
22
23     create_table :noticed_notifications do |t|
24       t.string :type
25       t.belongs_to :event, :null => false
26       t.belongs_to :recipient, :polymorphic => true, :null => false
27       t.datetime :read_at
28       t.datetime :seen_at
29
30       t.timestamps
31     end
32   end
33 end