Aggiunge replay YouTube temporaneo, pull registrazioni dai CPX e snapshot ingest in admin.
Così overflow Hetzner e VOD YouTube restano in archivio dopo lo spegnimento del nodo, e la colonna ingest non si svuota. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class AddTemporaryReplayFieldsToRecordings < ActiveRecord::Migration[7.2]
|
||||
def change
|
||||
change_table :recordings, bulk: true do |t|
|
||||
t.string :storage_policy, null: false, default: "retained"
|
||||
t.datetime :temp_expires_at
|
||||
t.datetime :youtube_verified_at
|
||||
t.datetime :local_media_purged_at
|
||||
end
|
||||
|
||||
add_index :recordings, %i[storage_policy temp_expires_at],
|
||||
name: "index_recordings_on_storage_policy_and_temp_expires_at"
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,51 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class AddIngestSnapshotToStreamSessions < ActiveRecord::Migration[7.2]
|
||||
def up
|
||||
add_column :stream_sessions, :ingest_slug, :string
|
||||
add_column :stream_sessions, :ingest_role, :string
|
||||
add_index :stream_sessions, :ingest_slug
|
||||
|
||||
execute <<~SQL
|
||||
UPDATE stream_sessions ss
|
||||
SET ingest_slug = sn.slug,
|
||||
ingest_role = sn.role
|
||||
FROM stream_nodes sn
|
||||
WHERE ss.stream_node_id = sn.id
|
||||
AND ss.ingest_slug IS NULL
|
||||
SQL
|
||||
|
||||
execute <<~SQL
|
||||
UPDATE stream_sessions ss
|
||||
SET ingest_slug = ev.slug
|
||||
FROM (
|
||||
SELECT DISTINCT ON (stream_session_id)
|
||||
stream_session_id,
|
||||
metadata->>'stream_node' AS slug
|
||||
FROM stream_events
|
||||
WHERE event_type = 'pairing'
|
||||
AND COALESCE(metadata->>'stream_node', '') <> ''
|
||||
ORDER BY stream_session_id, occurred_at ASC
|
||||
) ev
|
||||
WHERE ss.id = ev.stream_session_id
|
||||
AND ss.ingest_slug IS NULL
|
||||
SQL
|
||||
|
||||
execute <<~SQL
|
||||
UPDATE stream_sessions
|
||||
SET ingest_role = CASE
|
||||
WHEN ingest_slug = 'home' THEN 'home'
|
||||
WHEN ingest_slug LIKE 'ingest-lab%' THEN 'lab'
|
||||
WHEN ingest_slug LIKE 'ingest-%' THEN 'cloud'
|
||||
ELSE ingest_role
|
||||
END
|
||||
WHERE ingest_slug IS NOT NULL AND ingest_role IS NULL
|
||||
SQL
|
||||
end
|
||||
|
||||
def down
|
||||
remove_index :stream_sessions, :ingest_slug
|
||||
remove_column :stream_sessions, :ingest_role
|
||||
remove_column :stream_sessions, :ingest_slug
|
||||
end
|
||||
end
|
||||
Generated
+9
-1
@@ -10,7 +10,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema[7.2].define(version: 2026_08_26_090000) do
|
||||
ActiveRecord::Schema[7.2].define(version: 2026_08_28_124000) do
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "pgcrypto"
|
||||
enable_extension "plpgsql"
|
||||
@@ -338,10 +338,15 @@ ActiveRecord::Schema[7.2].define(version: 2026_08_26_090000) do
|
||||
t.datetime "expiry_warning_sent_at"
|
||||
t.string "youtube_video_id"
|
||||
t.datetime "youtube_published_at"
|
||||
t.string "storage_policy", default: "retained", null: false
|
||||
t.datetime "temp_expires_at"
|
||||
t.datetime "youtube_verified_at"
|
||||
t.datetime "local_media_purged_at"
|
||||
t.index ["deleted_at"], name: "index_recordings_on_deleted_at"
|
||||
t.index ["expires_at"], name: "index_recordings_on_expires_at"
|
||||
t.index ["privacy_status"], name: "index_recordings_on_privacy_status"
|
||||
t.index ["storage_key"], name: "index_recordings_on_storage_key", unique: true, where: "(storage_key IS NOT NULL)"
|
||||
t.index ["storage_policy", "temp_expires_at"], name: "index_recordings_on_storage_policy_and_temp_expires_at"
|
||||
t.index ["stream_session_id"], name: "index_recordings_on_stream_session_id", unique: true
|
||||
t.index ["team_id", "status"], name: "index_recordings_on_team_id_and_status"
|
||||
t.index ["team_id"], name: "index_recordings_on_team_id"
|
||||
@@ -434,6 +439,9 @@ ActiveRecord::Schema[7.2].define(version: 2026_08_26_090000) do
|
||||
t.string "device_model"
|
||||
t.string "os_version"
|
||||
t.string "carrier"
|
||||
t.string "ingest_slug"
|
||||
t.string "ingest_role"
|
||||
t.index ["ingest_slug"], name: "index_stream_sessions_on_ingest_slug"
|
||||
t.index ["match_id"], name: "index_stream_sessions_on_match_id"
|
||||
t.index ["publish_token"], name: "index_stream_sessions_on_publish_token", unique: true
|
||||
t.index ["regia_token_digest"], name: "index_stream_sessions_on_regia_token_digest", unique: true
|
||||
|
||||
Reference in New Issue
Block a user