db(migration): add pieces_jointes_seen_at to follows
This commit is contained in:
parent
0006b6f504
commit
5153b9a3ff
3 changed files with 27 additions and 0 deletions
|
@ -0,0 +1,12 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddPiecesJointesSeenAtToFollows < ActiveRecord::Migration[7.0]
|
||||
def up
|
||||
add_column :follows, :pieces_jointes_seen_at, :datetime
|
||||
change_column_default :follows, :pieces_jointes_seen_at, from: nil, to: 'CURRENT_TIMESTAMP'
|
||||
end
|
||||
|
||||
def down
|
||||
remove_column :follows, :pieces_jointes_seen_at
|
||||
end
|
||||
end
|
|
@ -0,0 +1,14 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class BackfillFollowsWithPiecesJointesSeenAt < ActiveRecord::Migration[7.0]
|
||||
disable_ddl_transaction!
|
||||
def up
|
||||
Follow.in_batches do |relation|
|
||||
relation.update_all pieces_jointes_seen_at: Time.zone.now
|
||||
sleep(0.001) # throttle
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
end
|
||||
end
|
|
@ -691,6 +691,7 @@ ActiveRecord::Schema[7.0].define(version: 2024_09_23_125619) do
|
|||
t.integer "dossier_id", null: false
|
||||
t.integer "instructeur_id", null: false
|
||||
t.datetime "messagerie_seen_at", precision: nil, null: false
|
||||
t.datetime "pieces_jointes_seen_at"
|
||||
t.datetime "unfollowed_at", precision: nil
|
||||
t.datetime "updated_at", precision: nil
|
||||
t.index ["dossier_id"], name: "index_follows_on_dossier_id"
|
||||
|
|
Loading…
Reference in a new issue