From f35bc5f18d06478b2d66247816067d1e9347bcff Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Tue, 15 Oct 2019 10:20:30 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AB=9E=E8=B5=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/competition_mode_setting.rb | 3 +++ .../20191015013924_add_new_column_to_competitions.rb | 6 ++++++ ...20191015015723_create_competition_mode_settings.rb | 11 +++++++++++ spec/models/competition_mode_setting_spec.rb | 5 +++++ 4 files changed, 25 insertions(+) create mode 100644 app/models/competition_mode_setting.rb create mode 100644 db/migrate/20191015013924_add_new_column_to_competitions.rb create mode 100644 db/migrate/20191015015723_create_competition_mode_settings.rb create mode 100644 spec/models/competition_mode_setting_spec.rb diff --git a/app/models/competition_mode_setting.rb b/app/models/competition_mode_setting.rb new file mode 100644 index 000000000..b6bafa7c3 --- /dev/null +++ b/app/models/competition_mode_setting.rb @@ -0,0 +1,3 @@ +class CompetitionModeSetting < ApplicationRecord + belongs_to :course +end diff --git a/db/migrate/20191015013924_add_new_column_to_competitions.rb b/db/migrate/20191015013924_add_new_column_to_competitions.rb new file mode 100644 index 000000000..616a46059 --- /dev/null +++ b/db/migrate/20191015013924_add_new_column_to_competitions.rb @@ -0,0 +1,6 @@ +class AddNewColumnToCompetitions < ActiveRecord::Migration[5.2] + def change + add_column :competitions, :bonus, :integer, default: 0 + add_column :competitions, :mode, :integer, default: 0 + end +end diff --git a/db/migrate/20191015015723_create_competition_mode_settings.rb b/db/migrate/20191015015723_create_competition_mode_settings.rb new file mode 100644 index 000000000..5d170eeab --- /dev/null +++ b/db/migrate/20191015015723_create_competition_mode_settings.rb @@ -0,0 +1,11 @@ +class CreateCompetitionModeSettings < ActiveRecord::Migration[5.2] + def change + create_table :competition_mode_settings do |t| + t.references :course + t.datetime :start_time + t.datetime :end_time + + t.timestamps + end + end +end diff --git a/spec/models/competition_mode_setting_spec.rb b/spec/models/competition_mode_setting_spec.rb new file mode 100644 index 000000000..535767880 --- /dev/null +++ b/spec/models/competition_mode_setting_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe CompetitionModeSetting, type: :model do + pending "add some examples to (or delete) #{__FILE__}" +end