Fix merged tournament sync schema in tests
This commit is contained in:
parent
03947ac0ca
commit
85cff5ef85
|
|
@ -304,9 +304,8 @@ class TournamentsController < ApplicationController
|
||||||
def push_sync_if_needed!(tournament)
|
def push_sync_if_needed!(tournament)
|
||||||
TournamentSyncEnqueue.call(tournament)
|
TournamentSyncEnqueue.call(tournament)
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
def validate_set_timer_end_params
|
def validate_set_timer_end_params
|
||||||
timer_end = params[:timer_end]
|
timer_end = params[:timer_end]
|
||||||
timer_end_seconds = params[:timer_end_seconds]
|
timer_end_seconds = params[:timer_end_seconds]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
class EnsureTournamentSyncColumnsExist < ActiveRecord::Migration[7.0]
|
||||||
|
def change
|
||||||
|
add_column_if_missing :tournaments, :read_only_mode, :boolean, null: false, default: false
|
||||||
|
add_column_if_missing :tournaments, :sync_target_url, :string
|
||||||
|
add_column_if_missing :tournaments, :sync_auth_token, :string
|
||||||
|
add_column_if_missing :tournaments, :sync_source_tournament_id, :integer
|
||||||
|
add_column_if_missing :tournaments, :sync_last_pushed_at, :datetime
|
||||||
|
add_column_if_missing :tournaments, :sync_last_push_error, :string
|
||||||
|
|
||||||
|
add_column_if_missing :teams, :sync_source_id, :integer
|
||||||
|
add_column_if_missing :stages, :sync_source_id, :integer
|
||||||
|
add_column_if_missing :groups, :sync_source_id, :integer
|
||||||
|
add_column_if_missing :matches, :sync_source_id, :integer
|
||||||
|
add_column_if_missing :match_scores, :sync_source_id, :integer
|
||||||
|
add_column_if_missing :group_scores, :sync_source_id, :integer
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def add_column_if_missing(table, column, type, **options)
|
||||||
|
return if column_exists?(table, column)
|
||||||
|
|
||||||
|
add_column(table, column, type, **options)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
class EnsureTournamentSyncQueueEntriesExist < ActiveRecord::Migration[7.0]
|
||||||
|
def change
|
||||||
|
return if table_exists?(:tournament_sync_queue_entries)
|
||||||
|
|
||||||
|
create_table :tournament_sync_queue_entries do |t|
|
||||||
|
t.integer :tournament_id, null: false
|
||||||
|
t.text :snapshot_json, null: false
|
||||||
|
t.datetime :next_attempt_at, null: false
|
||||||
|
t.datetime :last_attempt_at
|
||||||
|
t.datetime :locked_at
|
||||||
|
t.string :lock_token
|
||||||
|
t.integer :attempts, default: 0, null: false
|
||||||
|
t.string :status, default: 'pending', null: false
|
||||||
|
t.string :last_error
|
||||||
|
t.timestamps null: false
|
||||||
|
end
|
||||||
|
|
||||||
|
add_index :tournament_sync_queue_entries, :next_attempt_at
|
||||||
|
add_index :tournament_sync_queue_entries, :status
|
||||||
|
add_index :tournament_sync_queue_entries, :tournament_id, unique: true
|
||||||
|
add_foreign_key :tournament_sync_queue_entries, :tournaments, on_delete: :cascade
|
||||||
|
end
|
||||||
|
end
|
||||||
Loading…
Reference in New Issue