Files
MatchLiveTv/backend/db/migrate/20260831193000_create_stream_concurrency_violations.rb
eminuxandCursor d52434fb2e Limita una diretta attiva per account e valorizza la copertina Premium Full.
Blocca la seconda diretta sullo stesso utente, registra gli abusi in admin e presenta la copertina come grafica caricata dalla società, con demo Team MLTV.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-01 12:52:26 +02:00

33 lines
1.5 KiB
Ruby

# frozen_string_literal: true
class CreateStreamConcurrencyViolations < ActiveRecord::Migration[7.2]
def change
create_table :stream_concurrency_violations, id: :uuid, default: -> { "gen_random_uuid()" } do |t|
t.references :user, type: :uuid, foreign_key: { on_delete: :nullify }
t.references :occupying_session, type: :uuid, foreign_key: { to_table: :stream_sessions, on_delete: :nullify }
t.references :attempted_session, type: :uuid, foreign_key: { to_table: :stream_sessions, on_delete: :nullify }
t.references :occupying_club, type: :uuid, foreign_key: { to_table: :clubs, on_delete: :nullify }
t.references :attempted_club, type: :uuid, foreign_key: { to_table: :clubs, on_delete: :nullify }
t.string :attempt_action, null: false, default: "start"
t.string :user_email, null: false
t.string :user_name
t.string :occupying_club_name
t.string :attempted_club_name
t.string :occupying_match_label, null: false
t.string :attempted_match_label, null: false
t.string :occupying_status
t.string :occupying_device
t.string :attempted_device
t.boolean :devices_differ, null: false, default: false
t.jsonb :metadata, null: false, default: {}
t.datetime :created_at, null: false
end
add_index :stream_concurrency_violations, :created_at
add_index :stream_concurrency_violations, :devices_differ
add_index :stream_sessions, %i[user_id status], name: "index_stream_sessions_on_user_id_and_status"
end
end