mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-03-25 01:14:43 +00:00
Added tournament backups to the database and added pages to restore and create backups
This commit is contained in:
@@ -8,6 +8,7 @@ class Tournament < ApplicationRecord
|
||||
has_many :matches, dependent: :destroy
|
||||
has_many :delegates, class_name: "TournamentDelegate"
|
||||
has_many :mat_assignment_rules, dependent: :destroy
|
||||
has_many :tournament_backups, dependent: :destroy
|
||||
|
||||
validates :date, :name, :tournament_type, :address, :director, :director_email , presence: true
|
||||
|
||||
@@ -227,5 +228,9 @@ class Tournament < ApplicationRecord
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def create_backup()
|
||||
TournamentBackupService.new(self, "Manual backup").create_backup
|
||||
end
|
||||
|
||||
end
|
||||
5
app/models/tournament_backup.rb
Normal file
5
app/models/tournament_backup.rb
Normal file
@@ -0,0 +1,5 @@
|
||||
class TournamentBackup < ApplicationRecord
|
||||
belongs_to :tournament
|
||||
|
||||
validates :backup_data, presence: true
|
||||
end
|
||||
Reference in New Issue
Block a user