Store Session ID for Event::SynchronizedEditor

This commit is contained in:
Sebastian Serth
2023-09-08 11:22:57 +02:00
committed by Sebastian Serth
parent 02e50e9921
commit 5f99e7ee54
3 changed files with 11 additions and 1 deletions

View File

@ -31,6 +31,7 @@ class Event::SynchronizedEditor < ApplicationRecord
validates :status, presence: true, if: -> { action_connection_change? }
validates :file_id, presence: true, if: -> { action_editor_change? }
validates :session_id, presence: true, if: -> { action_editor_change? }
validates :editor_action, presence: true, if: -> { action_editor_change? }
validates :range_start_row, numericality: {only_integer: true, greater_than_or_equal_to: 0}, if: -> { action_editor_change? }
validates :range_start_column, numericality: {only_integer: true, greater_than_or_equal_to: 0}, if: -> { action_editor_change? }
@ -53,6 +54,7 @@ class Event::SynchronizedEditor < ApplicationRecord
action: event_copy.delete(:action),
editor_action: delta.delete(:action),
file_id: file[:id],
session_id: event_copy.delete(:session_id),
range_start_row: range[:start][:row],
range_start_column: range[:start][:column],
range_end_row: range[:end][:row],

View File

@ -0,0 +1,7 @@
# frozen_string_literal: true
class AddSessionIdToEventsSynrhonizedEditor < ActiveRecord::Migration[7.0]
def change
add_column :events_synchronized_editor, :session_id, :uuid, null: true
end
end

View File

@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[7.0].define(version: 2023_09_06_163923) do
ActiveRecord::Schema[7.0].define(version: 2023_09_08_091810) do
# These are extensions that must be enabled in order to support this database
enable_extension "pg_trgm"
enable_extension "pgcrypto"
@ -168,6 +168,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_09_06_163923) do
t.jsonb "data"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.uuid "session_id"
t.index ["file_id"], name: "index_events_synchronized_editor_on_file_id"
t.index ["programming_group_id"], name: "index_events_synchronized_editor_on_programming_group_id"
t.index ["study_group_id"], name: "index_events_synchronized_editor_on_study_group_id"