Add notifications of severed relationships (#27511)
This commit is contained in:
parent
8a1423a474
commit
44bf7b8128
39 changed files with 781 additions and 54 deletions
|
@ -0,0 +1,15 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class CreateRelationshipSeveranceEvents < ActiveRecord::Migration[7.0]
|
||||
def change
|
||||
create_table :relationship_severance_events do |t|
|
||||
t.integer :type, null: false
|
||||
t.string :target_name, null: false
|
||||
t.boolean :purged, null: false, default: false
|
||||
|
||||
t.timestamps
|
||||
|
||||
t.index [:type, :target_name]
|
||||
end
|
||||
end
|
||||
end
|
27
db/migrate/20240312105620_create_severed_relationships.rb
Normal file
27
db/migrate/20240312105620_create_severed_relationships.rb
Normal file
|
@ -0,0 +1,27 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class CreateSeveredRelationships < ActiveRecord::Migration[7.0]
|
||||
def change
|
||||
create_table :severed_relationships do |t|
|
||||
# No need to have an index on this foreign key as it is covered by `index_severed_relationships_on_unique_tuples`
|
||||
t.references :relationship_severance_event, null: false, foreign_key: { on_delete: :cascade }, index: false
|
||||
|
||||
# No need to have an index on this foregin key as it is covered by `index_severed_relationships_on_local_account_and_event`
|
||||
t.references :local_account, null: false, foreign_key: { to_table: :accounts, on_delete: :cascade }, index: false
|
||||
t.references :remote_account, null: false, foreign_key: { to_table: :accounts, on_delete: :cascade }
|
||||
|
||||
# Used to describe whether `local_account` is the active (follower) or passive (followed) part of the relationship
|
||||
t.integer :direction, null: false
|
||||
|
||||
# Those attributes are carried over from the `follows` table
|
||||
t.boolean :show_reblogs
|
||||
t.boolean :notify
|
||||
t.string :languages, array: true
|
||||
|
||||
t.timestamps
|
||||
|
||||
t.index [:relationship_severance_event_id, :local_account_id, :direction, :remote_account_id], name: 'index_severed_relationships_on_unique_tuples', unique: true
|
||||
t.index [:local_account_id, :relationship_severance_event_id], name: 'index_severed_relationships_on_local_account_and_event'
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,14 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class CreateAccountRelationshipSeveranceEvents < ActiveRecord::Migration[7.1]
|
||||
def change
|
||||
create_table :account_relationship_severance_events do |t|
|
||||
t.belongs_to :account, foreign_key: { on_delete: :cascade }, null: false, index: { unique: true }
|
||||
t.belongs_to :relationship_severance_event, foreign_key: { on_delete: :cascade }, null: false, index: { unique: true }
|
||||
|
||||
t.integer :relationships_count, default: 0, null: false
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue