Description:
start migrate to 5.0
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r744:0e4dc1847f88 - - 28 files changed: 518 inserted, 371 deleted

@@ -0,0 +1,3
1 + class ApplicationRecord < ActiveRecord::Base
2 + self.abstract_class = true
3 + end
@@ -0,0 +1,3
1 + #!/usr/bin/env ruby
2 + ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3 + load Gem.bin_path('bundler', 'bundle')
@@ -0,0 +1,4
1 + #!/usr/bin/env ruby
2 + APP_PATH = File.expand_path('../config/application', __dir__)
3 + require_relative '../config/boot'
4 + require 'rails/commands'
@@ -0,0 +1,4
1 + #!/usr/bin/env ruby
2 + require_relative '../config/boot'
3 + require 'rake'
4 + Rake.application.run
@@ -0,0 +1,34
1 + #!/usr/bin/env ruby
2 + require 'pathname'
3 + require 'fileutils'
4 + include FileUtils
5 +
6 + # path to your application root.
7 + APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
8 +
9 + def system!(*args)
10 + system(*args) || abort("\n== Command #{args} failed ==")
11 + end
12 +
13 + chdir APP_ROOT do
14 + # This script is a starting point to setup your application.
15 + # Add necessary setup steps to this file.
16 +
17 + puts '== Installing dependencies =='
18 + system! 'gem install bundler --conservative'
19 + system('bundle check') || system!('bundle install')
20 +
21 + # puts "\n== Copying sample files =="
22 + # unless File.exist?('config/database.yml')
23 + # cp 'config/database.yml.sample', 'config/database.yml'
24 + # end
25 +
26 + puts "\n== Preparing database =="
27 + system! 'bin/rails db:setup'
28 +
29 + puts "\n== Removing old logs and tempfiles =="
30 + system! 'bin/rails log:clear tmp:clear'
31 +
32 + puts "\n== Restarting application server =="
33 + system! 'bin/rails restart'
34 + end
@@ -0,0 +1,29
1 + #!/usr/bin/env ruby
2 + require 'pathname'
3 + require 'fileutils'
4 + include FileUtils
5 +
6 + # path to your application root.
7 + APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
8 +
9 + def system!(*args)
10 + system(*args) || abort("\n== Command #{args} failed ==")
11 + end
12 +
13 + chdir APP_ROOT do
14 + # This script is a way to update your development environment automatically.
15 + # Add necessary update steps to this file.
16 +
17 + puts '== Installing dependencies =='
18 + system! 'gem install bundler --conservative'
19 + system('bundle check') || system!('bundle install')
20 +
21 + puts "\n== Updating database =="
22 + system! 'bin/rails db:migrate'
23 +
24 + puts "\n== Removing old logs and tempfiles =="
25 + system! 'bin/rails log:clear tmp:clear'
26 +
27 + puts "\n== Restarting application server =="
28 + system! 'bin/rails restart'
29 + end
@@ -0,0 +1,9
1 + development:
2 + adapter: async
3 +
4 + test:
5 + adapter: async
6 +
7 + production:
8 + adapter: redis
9 + url: redis://localhost:6379/1
@@ -0,0 +1,8
1 + # Be sure to restart your server when you modify this file.
2 +
3 + # ActiveSupport::Reloader.to_prepare do
4 + # ApplicationController.renderer.defaults.merge!(
5 + # http_host: 'example.org',
6 + # https: false
7 + # )
8 + # end
@@ -0,0 +1,5
1 + # Be sure to restart your server when you modify this file.
2 +
3 + # Specify a serializer for the signed and encrypted cookie jars.
4 + # Valid options are :json, :marshal, and :hybrid.
5 + Rails.application.config.action_dispatch.cookies_serializer = :marshal
@@ -0,0 +1,4
1 + # Be sure to restart your server when you modify this file.
2 +
3 + # Configure sensitive parameters which will be filtered from the log file.
4 + Rails.application.config.filter_parameters += [:password]
@@ -0,0 +1,25
1 + # Be sure to restart your server when you modify this file.
2 + #
3 + # This file contains migration options to ease your Rails 5.0 upgrade.
4 + #
5 + # Once upgraded flip defaults one by one to migrate to the new default.
6 + #
7 + # Read the Guide for Upgrading Ruby on Rails for more info on each option.
8 +
9 + Rails.application.config.action_controller.raise_on_unfiltered_parameters = true
10 +
11 + # Enable per-form CSRF tokens. Previous versions had false.
12 + Rails.application.config.action_controller.per_form_csrf_tokens = false
13 +
14 + # Enable origin-checking CSRF mitigation. Previous versions had false.
15 + Rails.application.config.action_controller.forgery_protection_origin_check = false
16 +
17 + # Make Ruby 2.4 preserve the timezone of the receiver when calling `to_time`.
18 + # Previous versions had false.
19 + ActiveSupport.to_time_preserves_timezone = false
20 +
21 + # Require `belongs_to` associations by default. Previous versions had false.
22 + Rails.application.config.active_record.belongs_to_required_by_default = false
23 +
24 + # Do not halt callback chains when a callback returns false. Previous versions had true.
25 + ActiveSupport.halt_callback_chains_on_return_false = true
@@ -0,0 +1,47
1 + # Puma can serve each request in a thread from an internal thread pool.
2 + # The `threads` method setting takes two numbers a minimum and maximum.
3 + # Any libraries that use thread pools should be configured to match
4 + # the maximum value specified for Puma. Default is set to 5 threads for minimum
5 + # and maximum, this matches the default thread size of Active Record.
6 + #
7 + threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }.to_i
8 + threads threads_count, threads_count
9 +
10 + # Specifies the `port` that Puma will listen on to receive requests, default is 3000.
11 + #
12 + port ENV.fetch("PORT") { 3000 }
13 +
14 + # Specifies the `environment` that Puma will run in.
15 + #
16 + environment ENV.fetch("RAILS_ENV") { "development" }
17 +
18 + # Specifies the number of `workers` to boot in clustered mode.
19 + # Workers are forked webserver processes. If using threads and workers together
20 + # the concurrency of the application would be max `threads` * `workers`.
21 + # Workers do not work on JRuby or Windows (both of which do not support
22 + # processes).
23 + #
24 + # workers ENV.fetch("WEB_CONCURRENCY") { 2 }
25 +
26 + # Use the `preload_app!` method when specifying a `workers` number.
27 + # This directive tells Puma to first boot the application and load code
28 + # before forking the application. This takes advantage of Copy On Write
29 + # process behavior so workers use less memory. If you use this option
30 + # you need to make sure to reconnect any threads in the `on_worker_boot`
31 + # block.
32 + #
33 + # preload_app!
34 +
35 + # The code in the `on_worker_boot` will be called if you are using
36 + # clustered mode by specifying a number of `workers`. After each worker
37 + # process is booted this block will be run, if you are using `preload_app!`
38 + # option you will want to use this block to reconnect to any threads
39 + # or connections that may have been created at application boot, Ruby
40 + # cannot share connections between processes.
41 + #
42 + # on_worker_boot do
43 + # ActiveRecord::Base.establish_connection if defined?(ActiveRecord)
44 + # end
45 +
46 + # Allow puma to be restarted by `rails restart` command.
47 + plugin :tmp_restart
@@ -0,0 +1,6
1 + %w(
2 + .ruby-version
3 + .rbenv-vars
4 + tmp/restart.txt
5 + tmp/caching-dev.txt
6 + ).each { |path| Spring.watch(path) }
@@ -1,10 +1,10
1 source 'https://rubygems.org'
1 source 'https://rubygems.org'
2
2
3 #rails
3 #rails
4 - gem 'rails', '~>4.2.0'
4 + gem 'rails', '~>5.0'
5 gem 'activerecord-session_store'
5 gem 'activerecord-session_store'
6
6
7
7
8 # Bundle edge Rails instead:
8 # Bundle edge Rails instead:
9 # gem 'rails', :git => 'git://github.com/rails/rails.git'
9 # gem 'rails', :git => 'git://github.com/rails/rails.git'
10
10
@@ -10,54 +10,57
10 remote: https://rubygems.org/
10 remote: https://rubygems.org/
11 specs:
11 specs:
12 RubyInline (3.12.4)
12 RubyInline (3.12.4)
13 ZenTest (~> 4.3)
13 ZenTest (~> 4.3)
14 ZenTest (4.11.2)
14 ZenTest (4.11.2)
15 ace-rails-ap (4.2)
15 ace-rails-ap (4.2)
16 - actionmailer (4.2.11.1)
16 + actioncable (5.0.7.2)
17 - actionpack (= 4.2.11.1)
17 + actionpack (= 5.0.7.2)
18 - actionview (= 4.2.11.1)
18 + nio4r (>= 1.2, < 3.0)
19 - activejob (= 4.2.11.1)
19 + websocket-driver (~> 0.6.1)
20 + actionmailer (5.0.7.2)
21 + actionpack (= 5.0.7.2)
22 + actionview (= 5.0.7.2)
23 + activejob (= 5.0.7.2)
20 mail (~> 2.5, >= 2.5.4)
24 mail (~> 2.5, >= 2.5.4)
21 - rails-dom-testing (~> 1.0, >= 1.0.5)
25 + rails-dom-testing (~> 2.0)
22 - actionpack (4.2.11.1)
26 + actionpack (5.0.7.2)
23 - actionview (= 4.2.11.1)
27 + actionview (= 5.0.7.2)
24 - activesupport (= 4.2.11.1)
28 + activesupport (= 5.0.7.2)
25 - rack (~> 1.6)
29 + rack (~> 2.0)
26 - rack-test (~> 0.6.2)
30 + rack-test (~> 0.6.3)
27 - rails-dom-testing (~> 1.0, >= 1.0.5)
31 + rails-dom-testing (~> 2.0)
28 rails-html-sanitizer (~> 1.0, >= 1.0.2)
32 rails-html-sanitizer (~> 1.0, >= 1.0.2)
29 - actionview (4.2.11.1)
33 + actionview (5.0.7.2)
30 - activesupport (= 4.2.11.1)
34 + activesupport (= 5.0.7.2)
31 builder (~> 3.1)
35 builder (~> 3.1)
32 erubis (~> 2.7.0)
36 erubis (~> 2.7.0)
33 - rails-dom-testing (~> 1.0, >= 1.0.5)
37 + rails-dom-testing (~> 2.0)
34 rails-html-sanitizer (~> 1.0, >= 1.0.3)
38 rails-html-sanitizer (~> 1.0, >= 1.0.3)
35 - activejob (4.2.11.1)
39 + activejob (5.0.7.2)
36 - activesupport (= 4.2.11.1)
40 + activesupport (= 5.0.7.2)
37 - globalid (>= 0.3.0)
41 + globalid (>= 0.3.6)
38 - activemodel (4.2.11.1)
42 + activemodel (5.0.7.2)
39 - activesupport (= 4.2.11.1)
43 + activesupport (= 5.0.7.2)
40 - builder (~> 3.1)
44 + activerecord (5.0.7.2)
41 - activerecord (4.2.11.1)
45 + activemodel (= 5.0.7.2)
42 - activemodel (= 4.2.11.1)
46 + activesupport (= 5.0.7.2)
43 - activesupport (= 4.2.11.1)
47 + arel (~> 7.0)
44 - arel (~> 6.0)
45 activerecord-session_store (1.1.3)
48 activerecord-session_store (1.1.3)
46 actionpack (>= 4.0)
49 actionpack (>= 4.0)
47 activerecord (>= 4.0)
50 activerecord (>= 4.0)
48 multi_json (~> 1.11, >= 1.11.2)
51 multi_json (~> 1.11, >= 1.11.2)
49 rack (>= 1.5.2, < 3)
52 rack (>= 1.5.2, < 3)
50 railties (>= 4.0)
53 railties (>= 4.0)
51 - activesupport (4.2.11.1)
54 + activesupport (5.0.7.2)
52 - i18n (~> 0.7)
55 + concurrent-ruby (~> 1.0, >= 1.0.2)
56 + i18n (>= 0.7, < 2)
53 minitest (~> 5.1)
57 minitest (~> 5.1)
54 - thread_safe (~> 0.3, >= 0.3.4)
55 tzinfo (~> 1.1)
58 tzinfo (~> 1.1)
56 ansi (1.5.0)
59 ansi (1.5.0)
57 - arel (6.0.4)
60 + arel (7.1.4)
58 autoprefixer-rails (9.5.1.1)
61 autoprefixer-rails (9.5.1.1)
59 execjs
62 execjs
60 best_in_place (3.0.3)
63 best_in_place (3.0.3)
61 actionpack (>= 3.2)
64 actionpack (>= 3.2)
62 railties (>= 3.2)
65 railties (>= 3.2)
63 bootstrap-datepicker-rails (1.8.0.1)
66 bootstrap-datepicker-rails (1.8.0.1)
@@ -98,13 +101,13
98 railties (>= 4.0.1)
101 railties (>= 4.0.1)
99 html2haml (2.2.0)
102 html2haml (2.2.0)
100 erubis (~> 2.7.0)
103 erubis (~> 2.7.0)
101 haml (>= 4.0, < 6)
104 haml (>= 4.0, < 6)
102 nokogiri (>= 1.6.0)
105 nokogiri (>= 1.6.0)
103 ruby_parser (~> 3.5)
106 ruby_parser (~> 3.5)
104 - i18n (0.9.5)
107 + i18n (1.6.0)
105 concurrent-ruby (~> 1.0)
108 concurrent-ruby (~> 1.0)
106 in_place_editing (1.2.0)
109 in_place_editing (1.2.0)
107 jquery-countdown-rails (2.0.2)
110 jquery-countdown-rails (2.0.2)
108 jquery-datatables-rails (3.4.0)
111 jquery-datatables-rails (3.4.0)
109 actionpack (>= 3.1)
112 actionpack (>= 3.1)
110 jquery-rails
113 jquery-rails
@@ -122,53 +125,54
122 railties (>= 3.2.16)
125 railties (>= 3.2.16)
123 loofah (2.2.3)
126 loofah (2.2.3)
124 crass (~> 1.0.2)
127 crass (~> 1.0.2)
125 nokogiri (>= 1.5.9)
128 nokogiri (>= 1.5.9)
126 mail (2.7.1)
129 mail (2.7.1)
127 mini_mime (>= 0.1.1)
130 mini_mime (>= 0.1.1)
131 + method_source (0.9.2)
128 mini_mime (1.0.1)
132 mini_mime (1.0.1)
129 mini_portile2 (2.4.0)
133 mini_portile2 (2.4.0)
130 minitest (5.11.3)
134 minitest (5.11.3)
131 minitest-reporters (1.3.6)
135 minitest-reporters (1.3.6)
132 ansi
136 ansi
133 builder
137 builder
134 minitest (>= 5.0)
138 minitest (>= 5.0)
135 ruby-progressbar
139 ruby-progressbar
136 momentjs-rails (2.20.1)
140 momentjs-rails (2.20.1)
137 railties (>= 3.1)
141 railties (>= 3.1)
138 multi_json (1.13.1)
142 multi_json (1.13.1)
139 mysql2 (0.5.2)
143 mysql2 (0.5.2)
144 + nio4r (2.3.1)
140 nokogiri (1.10.3)
145 nokogiri (1.10.3)
141 mini_portile2 (~> 2.4.0)
146 mini_portile2 (~> 2.4.0)
142 - rack (1.6.11)
147 + rack (2.0.7)
143 rack-test (0.6.3)
148 rack-test (0.6.3)
144 rack (>= 1.0)
149 rack (>= 1.0)
145 - rails (4.2.11.1)
150 + rails (5.0.7.2)
146 - actionmailer (= 4.2.11.1)
151 + actioncable (= 5.0.7.2)
147 - actionpack (= 4.2.11.1)
152 + actionmailer (= 5.0.7.2)
148 - actionview (= 4.2.11.1)
153 + actionpack (= 5.0.7.2)
149 - activejob (= 4.2.11.1)
154 + actionview (= 5.0.7.2)
150 - activemodel (= 4.2.11.1)
155 + activejob (= 5.0.7.2)
151 - activerecord (= 4.2.11.1)
156 + activemodel (= 5.0.7.2)
152 - activesupport (= 4.2.11.1)
157 + activerecord (= 5.0.7.2)
153 - bundler (>= 1.3.0, < 2.0)
158 + activesupport (= 5.0.7.2)
154 - railties (= 4.2.11.1)
159 + bundler (>= 1.3.0)
155 - sprockets-rails
160 + railties (= 5.0.7.2)
156 - rails-deprecated_sanitizer (1.0.3)
161 + sprockets-rails (>= 2.0.0)
157 - activesupport (>= 4.2.0.alpha)
162 + rails-dom-testing (2.0.3)
158 - rails-dom-testing (1.0.9)
163 + activesupport (>= 4.2.0)
159 - activesupport (>= 4.2.0, < 5.0)
164 + nokogiri (>= 1.6)
160 - nokogiri (~> 1.6)
161 - rails-deprecated_sanitizer (>= 1.0.1)
162 rails-html-sanitizer (1.0.4)
165 rails-html-sanitizer (1.0.4)
163 loofah (~> 2.2, >= 2.2.2)
166 loofah (~> 2.2, >= 2.2.2)
164 rails_bootstrap_sortable (2.0.6)
167 rails_bootstrap_sortable (2.0.6)
165 momentjs-rails (>= 2.8.3)
168 momentjs-rails (>= 2.8.3)
166 - railties (4.2.11.1)
169 + railties (5.0.7.2)
167 - actionpack (= 4.2.11.1)
170 + actionpack (= 5.0.7.2)
168 - activesupport (= 4.2.11.1)
171 + activesupport (= 5.0.7.2)
172 + method_source
169 rake (>= 0.8.7)
173 rake (>= 0.8.7)
170 thor (>= 0.18.1, < 2.0)
174 thor (>= 0.18.1, < 2.0)
171 rake (12.3.2)
175 rake (12.3.2)
172 rb-fsevent (0.10.3)
176 rb-fsevent (0.10.3)
173 rb-inotify (0.10.0)
177 rb-inotify (0.10.0)
174 ffi (~> 1.0)
178 ffi (~> 1.0)
@@ -213,12 +217,15
213 thread_safe (0.3.6)
217 thread_safe (0.3.6)
214 tilt (2.0.9)
218 tilt (2.0.9)
215 tzinfo (1.2.5)
219 tzinfo (1.2.5)
216 thread_safe (~> 0.1)
220 thread_safe (~> 0.1)
217 uglifier (4.1.20)
221 uglifier (4.1.20)
218 execjs (>= 0.3.0, < 3)
222 execjs (>= 0.3.0, < 3)
223 + websocket-driver (0.6.5)
224 + websocket-extensions (>= 0.1.0)
225 + websocket-extensions (0.1.4)
219 will_paginate (3.0.12)
226 will_paginate (3.0.12)
220 yaml_db (0.7.0)
227 yaml_db (0.7.0)
221 rails (>= 3.0)
228 rails (>= 3.0)
222 rake (>= 0.8.7)
229 rake (>= 0.8.7)
223
230
224 PLATFORMS
231 PLATFORMS
@@ -247,13 +254,13
247 jquery-timepicker-addon-rails
254 jquery-timepicker-addon-rails
248 jquery-ui-rails
255 jquery-ui-rails
249 mail
256 mail
250 minitest-reporters
257 minitest-reporters
251 momentjs-rails
258 momentjs-rails
252 mysql2
259 mysql2
253 - rails (~> 4.2.0)
260 + rails (~> 5.0)
254 rails_bootstrap_sortable
261 rails_bootstrap_sortable
255 rdiscount
262 rdiscount
256 rouge
263 rouge
257 sass-rails
264 sass-rails
258 sassc-rails (>= 2.1.0)
265 sassc-rails (>= 2.1.0)
259 select2-rails
266 select2-rails
@@ -1,6 +1,3
1 - require 'rubygems'
1 + ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
2
2
3 - # Set up gems listed in the Gemfile.
3 + require 'bundler/setup' # Set up gems listed in the Gemfile.
4 - ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
5 -
6 - require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
@@ -1,5 +1,5
1 - # Load the rails application
1 + # Load the Rails application.
2 - require File.expand_path('../application', __FILE__)
2 + require_relative 'application'
3
3
4 - # Initialize the rails application
4 + # Initialize the Rails application.
5 - CafeGrader::Application.initialize!
5 + Rails.application.initialize!
@@ -1,42 +1,54
1 - CafeGrader::Application.configure do
1 + Rails.application.configure do
2 - # Settings specified here will take precedence over those in config/application.rb
2 + # Settings specified here will take precedence over those in config/application.rb.
3
3
4 # In the development environment your application's code is reloaded on
4 # In the development environment your application's code is reloaded on
5 # every request. This slows down response time but is perfect for development
5 # every request. This slows down response time but is perfect for development
6 # since you don't have to restart the web server when you make code changes.
6 # since you don't have to restart the web server when you make code changes.
7 config.cache_classes = false
7 config.cache_classes = false
8
8
9 - # Log error messages when you accidentally call methods on nil. //DEPRICATED
9 + # Do not eager load code on boot.
10 - # config.whiny_nils = true // DEPRICATED
10 + config.eager_load = false
11 +
12 + # Show full error reports.
13 + config.consider_all_requests_local = true
14 +
15 + # Enable/disable caching. By default caching is disabled.
16 + if Rails.root.join('tmp/caching-dev.txt').exist?
17 + config.action_controller.perform_caching = true
11
18
12 - # Show full error reports and disable caching
19 + config.cache_store = :memory_store
13 - config.consider_all_requests_local = true
20 + config.public_file_server.headers = {
14 - config.action_controller.perform_caching = false
21 + 'Cache-Control' => 'public, max-age=172800'
22 + }
23 + else
24 + config.action_controller.perform_caching = false
15
25
16 - # Don't care if the mailer can't send
26 + config.cache_store = :null_store
27 + end
28 +
29 + # Don't care if the mailer can't send.
17 config.action_mailer.raise_delivery_errors = false
30 config.action_mailer.raise_delivery_errors = false
18
31
19 - # Print deprecation notices to the Rails logger
32 + config.action_mailer.perform_caching = false
33 +
34 + # Print deprecation notices to the Rails logger.
20 config.active_support.deprecation = :log
35 config.active_support.deprecation = :log
21
36
22 - # Only use best-standards-support built into browsers
37 + # Raise an error on page load if there are pending migrations.
23 - config.action_dispatch.best_standards_support = :builtin
38 + config.active_record.migration_error = :page_load
24 -
25 - # Raise exception on mass assignment protection for Active Record models
26 - # config.active_record.mass_assignment_sanitizer = :strict //DEPRICATED
27
39
28 - # Log the query plan for queries taking more than this (works // DEPRICATED
40 + # Debug mode disables concatenation and preprocessing of assets.
29 - # with SQLite, MySQL, and PostgreSQL) // DEPRICATED
41 + # This option may cause significant delays in view rendering with a large
30 - # config.active_record.auto_explain_threshold_in_seconds = 0.5 // DEPRICATED
42 + # number of complex assets.
31 -
32 - # Do not compress assets
33 - config.assets.compress = false
34 -
35 - # Expands the lines which load the assets
36 config.assets.debug = true
43 config.assets.debug = true
37
44
38 - # Prevents assets from rendering twice
45 + # Suppress logger output for asset requests.
39 - config.serve_static_files = true
46 + config.assets.quiet = true
40
47
41 - config.eager_load = false
48 + # Raises error for missing translations
49 + # config.action_view.raise_on_missing_translations = true
50 +
51 + # Use an evented file watcher to asynchronously detect changes in source code,
52 + # routes, locales, etc. This feature depends on the listen gem.
53 + # config.file_watcher = ActiveSupport::EventedFileUpdateChecker
42 end
54 end
@@ -1,69 +1,86
1 - CafeGrader::Application.configure do
1 + Rails.application.configure do
2 - # Settings specified here will take precedence over those in config/application.rb
2 + # Settings specified here will take precedence over those in config/application.rb.
3
3
4 - # Code is not reloaded between requests
4 + # Code is not reloaded between requests.
5 config.cache_classes = true
5 config.cache_classes = true
6
6
7 - # Full error reports are disabled and caching is turned on
7 + # Eager load code on boot. This eager loads most of Rails and
8 + # your application in memory, allowing both threaded web servers
9 + # and those relying on copy on write to perform better.
10 + # Rake tasks automatically ignore this option for performance.
11 + config.eager_load = true
12 +
13 + # Full error reports are disabled and caching is turned on.
8 config.consider_all_requests_local = false
14 config.consider_all_requests_local = false
9 config.action_controller.perform_caching = true
15 config.action_controller.perform_caching = true
10
16
11 - # Disable Rails's static asset server (Apache or nginx will already do this)
17 + # Disable serving static files from the `/public` folder by default since
12 - config.serve_static_files = false
18 + # Apache or NGINX already handles this.
19 + config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
13
20
14 - # Compress JavaScripts and CSS
21 + # Compress JavaScripts and CSS.
15 - config.assets.compress = true
22 + config.assets.js_compressor = :uglifier
23 + # config.assets.css_compressor = :sass
16
24
17 - # Don't fallback to assets pipeline if a precompiled asset is missed
25 + # Do not fallback to assets pipeline if a precompiled asset is missed.
18 config.assets.compile = false
26 config.assets.compile = false
19
27
20 - # Generate digests for assets URLs
28 + # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
21 - config.assets.digest = true
29 +
30 + # Enable serving of images, stylesheets, and JavaScripts from an asset server.
31 + # config.action_controller.asset_host = 'http://assets.example.com'
22
32
23 - # Defaults to nil and saved in location specified by config.assets.prefix
33 + # Specifies the header that your server uses for sending files.
24 - # config.assets.manifest = YOUR_PATH
34 + # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
35 + # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
25
36
26 - # Specifies the header that your server uses for sending files
37 + # Mount Action Cable outside main process or domain
27 - # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
38 + # config.action_cable.mount_path = nil
28 - # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
39 + # config.action_cable.url = 'wss://example.com/cable'
40 + # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]
29
41
30 # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
42 # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
31 # config.force_ssl = true
43 # config.force_ssl = true
32
44
33 - # See everything in the log (default is :info)
45 + # Use the lowest log level to ensure availability of diagnostic information
34 - # config.log_level = :debug
46 + # when problems arise.
47 + config.log_level = :debug
35
48
36 - # Prepend all log lines with the following tags
49 + # Prepend all log lines with the following tags.
37 - # config.log_tags = [ :subdomain, :uuid ]
50 + config.log_tags = [ :request_id ]
38
51
39 - # Use a different logger for distributed setups
52 + # Use a different cache store in production.
40 - # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
41 -
42 - # Use a different cache store in production
43 # config.cache_store = :mem_cache_store
53 # config.cache_store = :mem_cache_store
44
54
45 - # Enable serving of images, stylesheets, and JavaScripts from an asset server
55 + # Use a real queuing backend for Active Job (and separate queues per environment)
46 - # config.action_controller.asset_host = "http://assets.example.com"
56 + # config.active_job.queue_adapter = :resque
47 -
57 + # config.active_job.queue_name_prefix = "cafe_grader_#{Rails.env}"
48 - # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
58 + config.action_mailer.perform_caching = false
49 - # config.assets.precompile += %w( search.js )
50
59
51 - # Disable delivery errors, bad email addresses will be ignored
60 + # Ignore bad email addresses and do not raise email delivery errors.
61 + # Set this to true and configure the email server for immediate delivery to raise delivery errors.
52 # config.action_mailer.raise_delivery_errors = false
62 # config.action_mailer.raise_delivery_errors = false
53
63
54 - # Enable threaded mode
55 - # config.threadsafe!
56 -
57 # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
64 # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
58 - # the I18n.default_locale when a translation can not be found)
65 + # the I18n.default_locale when a translation cannot be found).
59 config.i18n.fallbacks = true
66 config.i18n.fallbacks = true
60
67
61 - # Send deprecation notices to registered listeners
68 + # Send deprecation notices to registered listeners.
62 config.active_support.deprecation = :notify
69 config.active_support.deprecation = :notify
63
70
64 - # Log the query plan for queries taking more than this (works
71 + # Use default logging formatter so that PID and timestamp are not suppressed.
65 - # with SQLite, MySQL, and PostgreSQL)
72 + config.log_formatter = ::Logger::Formatter.new
66 - # config.active_record.auto_explain_threshold_in_seconds = 0.5
73 +
74 + # Use a different logger for distributed setups.
75 + # require 'syslog/logger'
76 + # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
67
77
68 - config.eager_load = true
78 + if ENV["RAILS_LOG_TO_STDOUT"].present?
79 + logger = ActiveSupport::Logger.new(STDOUT)
80 + logger.formatter = config.log_formatter
81 + config.logger = ActiveSupport::TaggedLogging.new(logger)
82 + end
83 +
84 + # Do not dump schema after migrations.
85 + config.active_record.dump_schema_after_migration = false
69 end
86 end
@@ -1,43 +1,42
1 - CafeGrader::Application.configure do
1 + Rails.application.configure do
2 - # Settings specified here will take precedence over those in config/application.rb
2 + # Settings specified here will take precedence over those in config/application.rb.
3
3
4 # The test environment is used exclusively to run your application's
4 # The test environment is used exclusively to run your application's
5 # test suite. You never need to work with it otherwise. Remember that
5 # test suite. You never need to work with it otherwise. Remember that
6 # your test database is "scratch space" for the test suite and is wiped
6 # your test database is "scratch space" for the test suite and is wiped
7 # and recreated between test runs. Don't rely on the data there!
7 # and recreated between test runs. Don't rely on the data there!
8 config.cache_classes = true
8 config.cache_classes = true
9
9
10 - # Configure static asset server for tests with Cache-Control for performance
10 + # Do not eager load code on boot. This avoids loading your whole application
11 - config.serve_static_files = true
11 + # just for the purpose of running a single test. If you are using a tool that
12 - config.static_cache_control = "public, max-age=3600"
12 + # preloads Rails for running tests, you may have to set it to true.
13 + config.eager_load = false
13
14
14 - # Log error messages when you accidentally call methods on nil
15 + # Configure public file server for tests with Cache-Control for performance.
15 - config.whiny_nils = true
16 + config.public_file_server.enabled = true
17 + config.public_file_server.headers = {
18 + 'Cache-Control' => 'public, max-age=3600'
19 + }
16
20
17 - # Show full error reports and disable caching
21 + # Show full error reports and disable caching.
18 config.consider_all_requests_local = true
22 config.consider_all_requests_local = true
19 config.action_controller.perform_caching = false
23 config.action_controller.perform_caching = false
20
24
21 - # Raise exceptions instead of rendering exception templates
25 + # Raise exceptions instead of rendering exception templates.
22 config.action_dispatch.show_exceptions = false
26 config.action_dispatch.show_exceptions = false
23
27
24 - # Disable request forgery protection in test environment
28 + # Disable request forgery protection in test environment.
25 - config.action_controller.allow_forgery_protection = false
29 + config.action_controller.allow_forgery_protection = false
30 + config.action_mailer.perform_caching = false
26
31
27 # Tell Action Mailer not to deliver emails to the real world.
32 # Tell Action Mailer not to deliver emails to the real world.
28 # The :test delivery method accumulates sent emails in the
33 # The :test delivery method accumulates sent emails in the
29 # ActionMailer::Base.deliveries array.
34 # ActionMailer::Base.deliveries array.
30 config.action_mailer.delivery_method = :test
35 config.action_mailer.delivery_method = :test
31
36
32 - # Raise exception on mass assignment protection for Active Record models
37 + # Print deprecation notices to the stderr.
33 - #config.active_record.mass_assignment_sanitizer = :strict // DEPRICATED
34 -
35 - # Print deprecation notices to the stderr
36 config.active_support.deprecation = :stderr
38 config.active_support.deprecation = :stderr
37
39
38 - config.eager_load = false
40 + # Raises error for missing translations
39 -
41 + # config.action_view.raise_on_missing_translations = true
40 - #test order
41 - config.active_support.test_order = :sorted
42 -
43 end
42 end
@@ -1,23 +1,18
1 # Be sure to restart your server when you modify this file.
1 # Be sure to restart your server when you modify this file.
2
2
3 # Version of your assets, change this if you want to expire all your assets.
3 # Version of your assets, change this if you want to expire all your assets.
4 Rails.application.config.assets.version = '1.0'
4 Rails.application.config.assets.version = '1.0'
5
5
6 - # Add additional assets to the asset load path.
6 + # Add additional assets to the asset load path
7 # Rails.application.config.assets.paths << Emoji.images_path
7 # Rails.application.config.assets.paths << Emoji.images_path
8 - # Add Yarn node_modules folder to the asset load path.
9 - Rails.application.config.assets.paths << Rails.root.join('node_modules')
10 - Rails.application.config.assets.paths << Rails.root.join('vendor/assets/fonts')
11
8
12 # Precompile additional assets.
9 # Precompile additional assets.
13 - # application.js, application.css, and all non-JS/CSS in the app/assets
10 + # application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
14 - # folder are already added.
11 + # Rails.application.config.assets.precompile += %w( search.js )
15 - # Rails.application.config.assets.precompile += %w( admin.js admin.css )
16 -
17 Rails.application.config.assets.precompile += ['announcement_refresh.js','effects.js','site_update.js']
12 Rails.application.config.assets.precompile += ['announcement_refresh.js','effects.js','site_update.js']
18 Rails.application.config.assets.precompile += ['local_jquery.js','tablesorter-theme.cafe.css']
13 Rails.application.config.assets.precompile += ['local_jquery.js','tablesorter-theme.cafe.css']
19 - %w( announcements submissions configurations contests contest_management graders heartbeat
14 + %w( announcements submissions configurations contests contest_management graders heartbeat
20 login main messages problems report site sites sources tasks groups
15 login main messages problems report site sites sources tasks groups
21 test user_admin users tags testcases).each do |controller|
16 test user_admin users tags testcases).each do |controller|
22 Rails.application.config.assets.precompile += ["#{controller}.js", "#{controller}.css"]
17 Rails.application.config.assets.precompile += ["#{controller}.js", "#{controller}.css"]
23 end
18 end
@@ -1,15 +1,16
1 # Be sure to restart your server when you modify this file.
1 # Be sure to restart your server when you modify this file.
2
2
3 - # Add new inflection rules using the following format
3 + # Add new inflection rules using the following format. Inflections
4 - # (all these examples are active by default):
4 + # are locale specific, and you may define rules for as many different
5 - # ActiveSupport::Inflector.inflections do |inflect|
5 + # locales as you wish. All of these examples are active by default:
6 + # ActiveSupport::Inflector.inflections(:en) do |inflect|
6 # inflect.plural /^(ox)$/i, '\1en'
7 # inflect.plural /^(ox)$/i, '\1en'
7 # inflect.singular /^(ox)en/i, '\1'
8 # inflect.singular /^(ox)en/i, '\1'
8 # inflect.irregular 'person', 'people'
9 # inflect.irregular 'person', 'people'
9 # inflect.uncountable %w( fish sheep )
10 # inflect.uncountable %w( fish sheep )
10 # end
11 # end
11 - #
12 +
12 # These inflection rules are supported but not enabled by default:
13 # These inflection rules are supported but not enabled by default:
13 - # ActiveSupport::Inflector.inflections do |inflect|
14 + # ActiveSupport::Inflector.inflections(:en) do |inflect|
14 # inflect.acronym 'RESTful'
15 # inflect.acronym 'RESTful'
15 # end
16 # end
@@ -1,5 +1,4
1 # Be sure to restart your server when you modify this file.
1 # Be sure to restart your server when you modify this file.
2
2
3 # Add new mime types for use in respond_to blocks:
3 # Add new mime types for use in respond_to blocks:
4 # Mime::Type.register "text/richtext", :rtf
4 # Mime::Type.register "text/richtext", :rtf
5 - # Mime::Type.register_alias "text/html", :iphone
@@ -1,8 +1,3
1 # Be sure to restart your server when you modify this file.
1 # Be sure to restart your server when you modify this file.
2 - #CafeGrader::Application.config.session_store :cookie_store, key: '_cafe_grader_web_session'
3
2
4 - # Use the database for sessions instead of the cookie-based default,
3 + Rails.application.config.session_store :cookie_store, key: '_cafe_grader_session'
5 - # which shouldn't be used to store highly confidential information
6 - # (create the session table with "rails generate session_migration")
7 -
8 - CafeGrader::Application.config.session_store :active_record_store
@@ -1,14 +1,14
1 # Be sure to restart your server when you modify this file.
1 # Be sure to restart your server when you modify this file.
2 - #
2 +
3 # This file contains settings for ActionController::ParamsWrapper which
3 # This file contains settings for ActionController::ParamsWrapper which
4 # is enabled by default.
4 # is enabled by default.
5
5
6 # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
6 # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7 ActiveSupport.on_load(:action_controller) do
7 ActiveSupport.on_load(:action_controller) do
8 wrap_parameters format: [:json]
8 wrap_parameters format: [:json]
9 end
9 end
10
10
11 - # Disable root element in JSON by default.
11 + # To enable root element in JSON for ActiveRecord objects.
12 - ActiveSupport.on_load(:active_record) do
12 + # ActiveSupport.on_load(:active_record) do
13 - self.include_root_in_json = false
13 + # self.include_root_in_json = true
14 - end
14 + # end
@@ -107,8 +107,8
107
107
108
108
109 # See how all your routes lay out with "rake routes"
109 # See how all your routes lay out with "rake routes"
110
110
111 # This is a legacy wild controller route that's not recommended for RESTful applications.
111 # This is a legacy wild controller route that's not recommended for RESTful applications.
112 # Note: This route will make all actions in every controller accessible via GET requests.
112 # Note: This route will make all actions in every controller accessible via GET requests.
113 - match ':controller(/:action(/:id))(.:format)', via: [:get, :post]
113 + # match ':controller(/:action(/:id))(.:format)', via: [:get, :post]
114 end
114 end
@@ -1,7 +1,6
1 - # encoding: UTF-8
2 # This file is auto-generated from the current state of the database. Instead
1 # This file is auto-generated from the current state of the database. Instead
3 # of editing this file, please use the migrations feature of Active Record to
2 # of editing this file, please use the migrations feature of Active Record to
4 # incrementally modify your database, and then regenerate this schema definition.
3 # incrementally modify your database, and then regenerate this schema definition.
5 #
4 #
6 # Note that this schema.rb definition is the authoritative source for your
5 # Note that this schema.rb definition is the authoritative source for your
7 # database schema. If you need to create the application database on another
6 # database schema. If you need to create the application database on another
@@ -10,312 +9,299
10 # you'll amass, the slower it'll run and the greater likelihood for issues).
9 # you'll amass, the slower it'll run and the greater likelihood for issues).
11 #
10 #
12 # It's strongly recommended that you check this file into your version control system.
11 # It's strongly recommended that you check this file into your version control system.
13
12
14 ActiveRecord::Schema.define(version: 20180612102327) do
13 ActiveRecord::Schema.define(version: 20180612102327) do
15
14
16 - create_table "announcements", force: :cascade do |t|
15 + create_table "announcements", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1" do |t|
17 - t.string "author", limit: 255
16 + t.string "author"
18 t.text "body", limit: 65535
17 t.text "body", limit: 65535
19 t.boolean "published"
18 t.boolean "published"
20 t.datetime "created_at"
19 t.datetime "created_at"
21 t.datetime "updated_at"
20 t.datetime "updated_at"
22 t.boolean "frontpage", default: false
21 t.boolean "frontpage", default: false
23 t.boolean "contest_only", default: false
22 t.boolean "contest_only", default: false
24 - t.string "title", limit: 255
23 + t.string "title"
25 - t.string "notes", limit: 255
24 + t.string "notes"
26 end
25 end
27
26
28 - create_table "contests", force: :cascade do |t|
27 + create_table "contests", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1" do |t|
29 - t.string "title", limit: 255
28 + t.string "title"
30 t.boolean "enabled"
29 t.boolean "enabled"
31 t.datetime "created_at"
30 t.datetime "created_at"
32 t.datetime "updated_at"
31 t.datetime "updated_at"
33 - t.string "name", limit: 255
32 + t.string "name"
34 end
33 end
35
34
36 - create_table "contests_problems", id: false, force: :cascade do |t|
35 + create_table "contests_problems", id: false, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1" do |t|
37 - t.integer "contest_id", limit: 4
36 + t.integer "contest_id"
38 - t.integer "problem_id", limit: 4
37 + t.integer "problem_id"
39 end
38 end
40
39
41 - create_table "contests_users", id: false, force: :cascade do |t|
40 + create_table "contests_users", id: false, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1" do |t|
42 - t.integer "contest_id", limit: 4
41 + t.integer "contest_id"
43 - t.integer "user_id", limit: 4
42 + t.integer "user_id"
44 end
43 end
45
44
46 - create_table "countries", force: :cascade do |t|
45 + create_table "countries", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1" do |t|
47 - t.string "name", limit: 255
46 + t.string "name"
48 t.datetime "created_at"
47 t.datetime "created_at"
49 t.datetime "updated_at"
48 t.datetime "updated_at"
50 end
49 end
51
50
52 - create_table "descriptions", force: :cascade do |t|
51 + create_table "descriptions", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1" do |t|
53 t.text "body", limit: 65535
52 t.text "body", limit: 65535
54 t.boolean "markdowned"
53 t.boolean "markdowned"
55 t.datetime "created_at"
54 t.datetime "created_at"
56 t.datetime "updated_at"
55 t.datetime "updated_at"
57 end
56 end
58
57
59 - create_table "grader_configurations", force: :cascade do |t|
58 + create_table "grader_configurations", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1" do |t|
60 - t.string "key", limit: 255
59 + t.string "key"
61 - t.string "value_type", limit: 255
60 + t.string "value_type"
62 - t.string "value", limit: 255
61 + t.string "value"
63 t.datetime "created_at"
62 t.datetime "created_at"
64 t.datetime "updated_at"
63 t.datetime "updated_at"
65 t.text "description", limit: 65535
64 t.text "description", limit: 65535
66 end
65 end
67
66
68 - create_table "grader_processes", force: :cascade do |t|
67 + create_table "grader_processes", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1" do |t|
69 - t.string "host", limit: 255
68 + t.string "host"
70 - t.integer "pid", limit: 4
69 + t.integer "pid"
71 - t.string "mode", limit: 255
70 + t.string "mode"
72 t.boolean "active"
71 t.boolean "active"
73 t.datetime "created_at"
72 t.datetime "created_at"
74 t.datetime "updated_at"
73 t.datetime "updated_at"
75 - t.integer "task_id", limit: 4
74 + t.integer "task_id"
76 - t.string "task_type", limit: 255
75 + t.string "task_type"
77 t.boolean "terminated"
76 t.boolean "terminated"
77 + t.index ["host", "pid"], name: "index_grader_processes_on_host_and_pid", using: :btree
78 end
78 end
79
79
80 - add_index "grader_processes", ["host", "pid"], name: "index_grader_processes_on_host_and_pid", using: :btree
80 + create_table "groups", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1" do |t|
81 -
81 + t.string "name"
82 - create_table "groups", force: :cascade do |t|
82 + t.string "description"
83 - t.string "name", limit: 255
84 - t.string "description", limit: 255
85 end
83 end
86
84
87 - create_table "groups_problems", id: false, force: :cascade do |t|
85 + create_table "groups_problems", id: false, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1" do |t|
88 - t.integer "problem_id", limit: 4, null: false
86 + t.integer "problem_id", null: false
89 - t.integer "group_id", limit: 4, null: false
87 + t.integer "group_id", null: false
88 + t.index ["group_id", "problem_id"], name: "index_groups_problems_on_group_id_and_problem_id", using: :btree
90 end
89 end
91
90
92 - add_index "groups_problems", ["group_id", "problem_id"], name: "index_groups_problems_on_group_id_and_problem_id", using: :btree
91 + create_table "groups_users", id: false, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1" do |t|
93 -
92 + t.integer "group_id", null: false
94 - create_table "groups_users", id: false, force: :cascade do |t|
93 + t.integer "user_id", null: false
95 - t.integer "group_id", limit: 4, null: false
94 + t.index ["user_id", "group_id"], name: "index_groups_users_on_user_id_and_group_id", using: :btree
96 - t.integer "user_id", limit: 4, null: false
97 end
95 end
98
96
99 - add_index "groups_users", ["user_id", "group_id"], name: "index_groups_users_on_user_id_and_group_id", using: :btree
97 + create_table "heart_beats", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1" do |t|
100 -
98 + t.integer "user_id"
101 - create_table "heart_beats", force: :cascade do |t|
99 + t.string "ip_address"
102 - t.integer "user_id", limit: 4
103 - t.string "ip_address", limit: 255
104 t.datetime "created_at"
100 t.datetime "created_at"
105 t.datetime "updated_at"
101 t.datetime "updated_at"
106 - t.string "status", limit: 255
102 + t.string "status"
103 + t.index ["updated_at"], name: "index_heart_beats_on_updated_at", using: :btree
107 end
104 end
108
105
109 - add_index "heart_beats", ["updated_at"], name: "index_heart_beats_on_updated_at", using: :btree
106 + create_table "languages", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1" do |t|
110 -
111 - create_table "languages", force: :cascade do |t|
112 t.string "name", limit: 10
107 t.string "name", limit: 10
113 - t.string "pretty_name", limit: 255
108 + t.string "pretty_name"
114 t.string "ext", limit: 10
109 t.string "ext", limit: 10
115 - t.string "common_ext", limit: 255
110 + t.string "common_ext"
116 end
111 end
117
112
118 - create_table "logins", force: :cascade do |t|
113 + create_table "logins", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1" do |t|
119 - t.integer "user_id", limit: 4
114 + t.integer "user_id"
120 - t.string "ip_address", limit: 255
115 + t.string "ip_address"
121 t.datetime "created_at"
116 t.datetime "created_at"
122 t.datetime "updated_at"
117 t.datetime "updated_at"
123 end
118 end
124
119
125 - create_table "messages", force: :cascade do |t|
120 + create_table "messages", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1" do |t|
126 - t.integer "sender_id", limit: 4
121 + t.integer "sender_id"
127 - t.integer "receiver_id", limit: 4
122 + t.integer "receiver_id"
128 - t.integer "replying_message_id", limit: 4
123 + t.integer "replying_message_id"
129 t.text "body", limit: 65535
124 t.text "body", limit: 65535
130 t.boolean "replied"
125 t.boolean "replied"
131 t.datetime "created_at"
126 t.datetime "created_at"
132 t.datetime "updated_at"
127 t.datetime "updated_at"
133 end
128 end
134
129
135 - create_table "problems", force: :cascade do |t|
130 + create_table "problems", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1" do |t|
136 t.string "name", limit: 30
131 t.string "name", limit: 30
137 - t.string "full_name", limit: 255
132 + t.string "full_name"
138 - t.integer "full_score", limit: 4
133 + t.integer "full_score"
139 t.date "date_added"
134 t.date "date_added"
140 t.boolean "available"
135 t.boolean "available"
141 - t.string "url", limit: 255
136 + t.string "url"
142 - t.integer "description_id", limit: 4
137 + t.integer "description_id"
143 t.boolean "test_allowed"
138 t.boolean "test_allowed"
144 t.boolean "output_only"
139 t.boolean "output_only"
145 - t.string "description_filename", limit: 255
140 + t.string "description_filename"
146 t.boolean "view_testcase"
141 t.boolean "view_testcase"
147 end
142 end
148
143
149 - create_table "problems_tags", force: :cascade do |t|
144 + create_table "problems_tags", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1" do |t|
150 - t.integer "problem_id", limit: 4
145 + t.integer "problem_id"
151 - t.integer "tag_id", limit: 4
146 + t.integer "tag_id"
147 + t.index ["problem_id", "tag_id"], name: "index_problems_tags_on_problem_id_and_tag_id", unique: true, using: :btree
148 + t.index ["problem_id"], name: "index_problems_tags_on_problem_id", using: :btree
149 + t.index ["tag_id"], name: "index_problems_tags_on_tag_id", using: :btree
152 end
150 end
153
151
154 - add_index "problems_tags", ["problem_id", "tag_id"], name: "index_problems_tags_on_problem_id_and_tag_id", unique: true, using: :btree
152 + create_table "rights", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1" do |t|
155 - add_index "problems_tags", ["problem_id"], name: "index_problems_tags_on_problem_id", using: :btree
153 + t.string "name"
156 - add_index "problems_tags", ["tag_id"], name: "index_problems_tags_on_tag_id", using: :btree
154 + t.string "controller"
157 -
155 + t.string "action"
158 - create_table "rights", force: :cascade do |t|
159 - t.string "name", limit: 255
160 - t.string "controller", limit: 255
161 - t.string "action", limit: 255
162 end
156 end
163
157
164 - create_table "rights_roles", id: false, force: :cascade do |t|
158 + create_table "rights_roles", id: false, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1" do |t|
165 - t.integer "right_id", limit: 4
159 + t.integer "right_id"
166 - t.integer "role_id", limit: 4
160 + t.integer "role_id"
161 + t.index ["role_id"], name: "index_rights_roles_on_role_id", using: :btree
167 end
162 end
168
163
169 - add_index "rights_roles", ["role_id"], name: "index_rights_roles_on_role_id", using: :btree
164 + create_table "roles", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1" do |t|
170 -
165 + t.string "name"
171 - create_table "roles", force: :cascade do |t|
172 - t.string "name", limit: 255
173 end
166 end
174
167
175 - create_table "roles_users", id: false, force: :cascade do |t|
168 + create_table "roles_users", id: false, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1" do |t|
176 - t.integer "role_id", limit: 4
169 + t.integer "role_id"
177 - t.integer "user_id", limit: 4
170 + t.integer "user_id"
171 + t.index ["user_id"], name: "index_roles_users_on_user_id", using: :btree
178 end
172 end
179
173
180 - add_index "roles_users", ["user_id"], name: "index_roles_users_on_user_id", using: :btree
174 + create_table "sessions", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1" do |t|
181 -
175 + t.string "session_id"
182 - create_table "sessions", force: :cascade do |t|
183 - t.string "session_id", limit: 255
184 t.text "data", limit: 65535
176 t.text "data", limit: 65535
185 t.datetime "updated_at"
177 t.datetime "updated_at"
178 + t.index ["session_id"], name: "index_sessions_on_session_id", using: :btree
179 + t.index ["updated_at"], name: "index_sessions_on_updated_at", using: :btree
186 end
180 end
187
181
188 - add_index "sessions", ["session_id"], name: "index_sessions_on_session_id", using: :btree
182 + create_table "sites", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1" do |t|
189 - add_index "sessions", ["updated_at"], name: "index_sessions_on_updated_at", using: :btree
183 + t.string "name"
190 -
191 - create_table "sites", force: :cascade do |t|
192 - t.string "name", limit: 255
193 t.boolean "started"
184 t.boolean "started"
194 t.datetime "start_time"
185 t.datetime "start_time"
195 t.datetime "created_at"
186 t.datetime "created_at"
196 t.datetime "updated_at"
187 t.datetime "updated_at"
197 - t.integer "country_id", limit: 4
188 + t.integer "country_id"
198 - t.string "password", limit: 255
189 + t.string "password"
199 end
190 end
200
191
201 - create_table "submission_view_logs", force: :cascade do |t|
192 + create_table "submission_view_logs", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1" do |t|
202 - t.integer "user_id", limit: 4
193 + t.integer "user_id"
203 - t.integer "submission_id", limit: 4
194 + t.integer "submission_id"
204 t.datetime "created_at"
195 t.datetime "created_at"
205 t.datetime "updated_at"
196 t.datetime "updated_at"
206 end
197 end
207
198
208 - create_table "submissions", force: :cascade do |t|
199 + create_table "submissions", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1" do |t|
209 - t.integer "user_id", limit: 4
200 + t.integer "user_id"
210 - t.integer "problem_id", limit: 4
201 + t.integer "problem_id"
211 - t.integer "language_id", limit: 4
202 + t.integer "language_id"
212 t.text "source", limit: 16777215
203 t.text "source", limit: 16777215
213 t.binary "binary", limit: 65535
204 t.binary "binary", limit: 65535
214 t.datetime "submitted_at"
205 t.datetime "submitted_at"
215 t.datetime "compiled_at"
206 t.datetime "compiled_at"
216 t.text "compiler_message", limit: 65535
207 t.text "compiler_message", limit: 65535
217 t.datetime "graded_at"
208 t.datetime "graded_at"
218 - t.integer "points", limit: 4
209 + t.integer "points"
219 t.text "grader_comment", limit: 65535
210 t.text "grader_comment", limit: 65535
220 - t.integer "number", limit: 4
211 + t.integer "number"
221 - t.string "source_filename", limit: 255
212 + t.string "source_filename"
222 t.float "max_runtime", limit: 24
213 t.float "max_runtime", limit: 24
223 - t.integer "peak_memory", limit: 4
214 + t.integer "peak_memory"
224 - t.integer "effective_code_length", limit: 4
215 + t.integer "effective_code_length"
225 - t.string "ip_address", limit: 255
216 + t.string "ip_address"
217 + t.index ["user_id", "problem_id", "number"], name: "index_submissions_on_user_id_and_problem_id_and_number", unique: true, using: :btree
218 + t.index ["user_id", "problem_id"], name: "index_submissions_on_user_id_and_problem_id", using: :btree
226 end
219 end
227
220
228 - add_index "submissions", ["user_id", "problem_id", "number"], name: "index_submissions_on_user_id_and_problem_id_and_number", unique: true, using: :btree
221 + create_table "tags", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1" do |t|
229 - add_index "submissions", ["user_id", "problem_id"], name: "index_submissions_on_user_id_and_problem_id", using: :btree
222 + t.string "name", null: false
230 -
231 - create_table "tags", force: :cascade do |t|
232 - t.string "name", limit: 255, null: false
233 t.text "description", limit: 65535
223 t.text "description", limit: 65535
234 t.boolean "public"
224 t.boolean "public"
235 t.datetime "created_at", null: false
225 t.datetime "created_at", null: false
236 t.datetime "updated_at", null: false
226 t.datetime "updated_at", null: false
237 end
227 end
238
228
239 - create_table "tasks", force: :cascade do |t|
229 + create_table "tasks", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1" do |t|
240 - t.integer "submission_id", limit: 4
230 + t.integer "submission_id"
241 t.datetime "created_at"
231 t.datetime "created_at"
242 - t.integer "status", limit: 4
232 + t.integer "status"
243 t.datetime "updated_at"
233 t.datetime "updated_at"
234 + t.index ["submission_id"], name: "index_tasks_on_submission_id", using: :btree
244 end
235 end
245
236
246 - add_index "tasks", ["submission_id"], name: "index_tasks_on_submission_id", using: :btree
237 + create_table "test_pairs", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1" do |t|
247 -
238 + t.integer "problem_id"
248 - create_table "test_pairs", force: :cascade do |t|
249 - t.integer "problem_id", limit: 4
250 t.text "input", limit: 16777215
239 t.text "input", limit: 16777215
251 t.text "solution", limit: 16777215
240 t.text "solution", limit: 16777215
252 t.datetime "created_at"
241 t.datetime "created_at"
253 t.datetime "updated_at"
242 t.datetime "updated_at"
254 end
243 end
255
244
256 - create_table "test_requests", force: :cascade do |t|
245 + create_table "test_requests", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1" do |t|
257 - t.integer "user_id", limit: 4
246 + t.integer "user_id"
258 - t.integer "problem_id", limit: 4
247 + t.integer "problem_id"
259 - t.integer "submission_id", limit: 4
248 + t.integer "submission_id"
260 - t.string "input_file_name", limit: 255
249 + t.string "input_file_name"
261 - t.string "output_file_name", limit: 255
250 + t.string "output_file_name"
262 - t.string "running_stat", limit: 255
251 + t.string "running_stat"
263 - t.integer "status", limit: 4
252 + t.integer "status"
264 t.datetime "updated_at"
253 t.datetime "updated_at"
265 t.datetime "submitted_at"
254 t.datetime "submitted_at"
266 t.datetime "compiled_at"
255 t.datetime "compiled_at"
267 t.text "compiler_message", limit: 65535
256 t.text "compiler_message", limit: 65535
268 t.datetime "graded_at"
257 t.datetime "graded_at"
269 - t.string "grader_comment", limit: 255
258 + t.string "grader_comment"
270 t.datetime "created_at"
259 t.datetime "created_at"
271 t.float "running_time", limit: 24
260 t.float "running_time", limit: 24
272 - t.string "exit_status", limit: 255
261 + t.string "exit_status"
273 - t.integer "memory_usage", limit: 4
262 + t.integer "memory_usage"
263 + t.index ["user_id", "problem_id"], name: "index_test_requests_on_user_id_and_problem_id", using: :btree
274 end
264 end
275
265
276 - add_index "test_requests", ["user_id", "problem_id"], name: "index_test_requests_on_user_id_and_problem_id", using: :btree
266 + create_table "testcases", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1" do |t|
277 -
267 + t.integer "problem_id"
278 - create_table "testcases", force: :cascade do |t|
268 + t.integer "num"
279 - t.integer "problem_id", limit: 4
269 + t.integer "group"
280 - t.integer "num", limit: 4
270 + t.integer "score"
281 - t.integer "group", limit: 4
282 - t.integer "score", limit: 4
283 t.text "input", limit: 4294967295
271 t.text "input", limit: 4294967295
284 t.text "sol", limit: 4294967295
272 t.text "sol", limit: 4294967295
285 t.datetime "created_at"
273 t.datetime "created_at"
286 t.datetime "updated_at"
274 t.datetime "updated_at"
275 + t.index ["problem_id"], name: "index_testcases_on_problem_id", using: :btree
287 end
276 end
288
277
289 - add_index "testcases", ["problem_id"], name: "index_testcases_on_problem_id", using: :btree
278 + create_table "user_contest_stats", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1" do |t|
290 -
279 + t.integer "user_id"
291 - create_table "user_contest_stats", force: :cascade do |t|
292 - t.integer "user_id", limit: 4
293 t.datetime "started_at"
280 t.datetime "started_at"
294 t.datetime "created_at"
281 t.datetime "created_at"
295 t.datetime "updated_at"
282 t.datetime "updated_at"
296 t.boolean "forced_logout"
283 t.boolean "forced_logout"
297 end
284 end
298
285
299 - create_table "users", force: :cascade do |t|
286 + create_table "users", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1" do |t|
300 t.string "login", limit: 50
287 t.string "login", limit: 50
301 - t.string "full_name", limit: 255
288 + t.string "full_name"
302 - t.string "hashed_password", limit: 255
289 + t.string "hashed_password"
303 t.string "salt", limit: 5
290 t.string "salt", limit: 5
304 - t.string "alias", limit: 255
291 + t.string "alias"
305 - t.string "email", limit: 255
292 + t.string "email"
306 - t.integer "site_id", limit: 4
293 + t.integer "site_id"
307 - t.integer "country_id", limit: 4
294 + t.integer "country_id"
308 - t.boolean "activated", default: false
295 + t.boolean "activated", default: false
309 t.datetime "created_at"
296 t.datetime "created_at"
310 t.datetime "updated_at"
297 t.datetime "updated_at"
311 - t.string "section", limit: 255
298 + t.string "section"
312 - t.boolean "enabled", default: true
299 + t.boolean "enabled", default: true
313 - t.string "remark", limit: 255
300 + t.string "remark"
314 - t.string "last_ip", limit: 255
301 + t.string "last_ip"
302 + t.index ["login"], name: "index_users_on_login", unique: true, using: :btree
315 end
303 end
316
304
317 - add_index "users", ["login"], name: "index_users_on_login", unique: true, using: :btree
318 -
319 add_foreign_key "problems_tags", "problems"
305 add_foreign_key "problems_tags", "problems"
320 add_foreign_key "problems_tags", "tags"
306 add_foreign_key "problems_tags", "tags"
321 end
307 end
deleted file
You need to be logged in to leave comments. Login now