diff --git a/Gemfile b/Gemfile index 2af9ca1a..ebd1162b 100644 --- a/Gemfile +++ b/Gemfile @@ -34,7 +34,7 @@ gem 'prometheus_exporter' gem 'pry-byebug' gem 'puma' gem 'pundit' -gem 'rails', '~> 6.1.7' +gem 'rails', '~> 7.0.4' gem 'rails_admin', '< 4.0.0' gem 'rails-i18n' gem 'rails-timeago' @@ -76,10 +76,6 @@ group :development, :staging do gem 'rubocop-rspec' end -group :development, :test, :staging do - gem 'spring' -end - group :test do gem 'autotest' # required by autotest-rails gem 'autotest-rails' diff --git a/Gemfile.lock b/Gemfile.lock index 0b69bfc6..708ab99c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -13,69 +13,75 @@ GEM remote: https://rubygems.org/ specs: ZenTest (4.12.1) - actioncable (6.1.7) - actionpack (= 6.1.7) - activesupport (= 6.1.7) + actioncable (7.0.4) + actionpack (= 7.0.4) + activesupport (= 7.0.4) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (6.1.7) - actionpack (= 6.1.7) - activejob (= 6.1.7) - activerecord (= 6.1.7) - activestorage (= 6.1.7) - activesupport (= 6.1.7) + actionmailbox (7.0.4) + actionpack (= 7.0.4) + activejob (= 7.0.4) + activerecord (= 7.0.4) + activestorage (= 7.0.4) + activesupport (= 7.0.4) mail (>= 2.7.1) - actionmailer (6.1.7) - actionpack (= 6.1.7) - actionview (= 6.1.7) - activejob (= 6.1.7) - activesupport (= 6.1.7) + net-imap + net-pop + net-smtp + actionmailer (7.0.4) + actionpack (= 7.0.4) + actionview (= 7.0.4) + activejob (= 7.0.4) + activesupport (= 7.0.4) mail (~> 2.5, >= 2.5.4) + net-imap + net-pop + net-smtp rails-dom-testing (~> 2.0) - actionpack (6.1.7) - actionview (= 6.1.7) - activesupport (= 6.1.7) - rack (~> 2.0, >= 2.0.9) + actionpack (7.0.4) + actionview (= 7.0.4) + activesupport (= 7.0.4) + rack (~> 2.0, >= 2.2.0) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (6.1.7) - actionpack (= 6.1.7) - activerecord (= 6.1.7) - activestorage (= 6.1.7) - activesupport (= 6.1.7) + actiontext (7.0.4) + actionpack (= 7.0.4) + activerecord (= 7.0.4) + activestorage (= 7.0.4) + activesupport (= 7.0.4) + globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (6.1.7) - activesupport (= 6.1.7) + actionview (7.0.4) + activesupport (= 7.0.4) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0) - activejob (6.1.7) - activesupport (= 6.1.7) + activejob (7.0.4) + activesupport (= 7.0.4) globalid (>= 0.3.6) - activemodel (6.1.7) - activesupport (= 6.1.7) + activemodel (7.0.4) + activesupport (= 7.0.4) activemodel-serializers-xml (1.0.2) activemodel (> 5.x) activesupport (> 5.x) builder (~> 3.1) - activerecord (6.1.7) - activemodel (= 6.1.7) - activesupport (= 6.1.7) - activestorage (6.1.7) - actionpack (= 6.1.7) - activejob (= 6.1.7) - activerecord (= 6.1.7) - activesupport (= 6.1.7) + activerecord (7.0.4) + activemodel (= 7.0.4) + activesupport (= 7.0.4) + activestorage (7.0.4) + actionpack (= 7.0.4) + activejob (= 7.0.4) + activerecord (= 7.0.4) + activesupport (= 7.0.4) marcel (~> 1.0) mini_mime (>= 1.1.0) - activesupport (6.1.7) + activesupport (7.0.4) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) tzinfo (~> 2.0) - zeitwerk (~> 2.3) addressable (2.8.1) public_suffix (>= 2.0.2, < 6.0) amq-protocol (2.3.2) @@ -221,8 +227,11 @@ GEM loofah (2.19.0) crass (~> 1.0.2) nokogiri (>= 1.5.9) - mail (2.7.1) + mail (2.8.0) mini_mime (>= 0.1.1) + net-imap + net-pop + net-smtp marcel (1.0.2) matrix (0.4.2) method_source (1.0.0) @@ -303,21 +312,20 @@ GEM rack rack-test (2.0.2) rack (>= 1.3) - rails (6.1.7) - actioncable (= 6.1.7) - actionmailbox (= 6.1.7) - actionmailer (= 6.1.7) - actionpack (= 6.1.7) - actiontext (= 6.1.7) - actionview (= 6.1.7) - activejob (= 6.1.7) - activemodel (= 6.1.7) - activerecord (= 6.1.7) - activestorage (= 6.1.7) - activesupport (= 6.1.7) + rails (7.0.4) + actioncable (= 7.0.4) + actionmailbox (= 7.0.4) + actionmailer (= 7.0.4) + actionpack (= 7.0.4) + actiontext (= 7.0.4) + actionview (= 7.0.4) + activejob (= 7.0.4) + activemodel (= 7.0.4) + activerecord (= 7.0.4) + activestorage (= 7.0.4) + activesupport (= 7.0.4) bundler (>= 1.15.0) - railties (= 6.1.7) - sprockets-rails (>= 2.0.0) + railties (= 7.0.4) rails-controller-testing (1.0.5) actionpack (>= 5.0.1.rc1) actionview (>= 5.0.1.rc1) @@ -339,12 +347,13 @@ GEM nested_form (~> 0.3) rails (>= 6.0, < 8) turbo-rails (~> 1.0) - railties (6.1.7) - actionpack (= 6.1.7) - activesupport (= 6.1.7) + railties (7.0.4) + actionpack (= 7.0.4) + activesupport (= 7.0.4) method_source rake (>= 12.2) thor (~> 1.0) + zeitwerk (~> 2.5) rainbow (3.1.1) rake (13.0.6) ransack (3.2.1) @@ -468,7 +477,6 @@ GEM sorted_set (1.0.3) rbtree set (~> 1.0) - spring (4.1.0) sprockets (4.1.1) concurrent-ruby (~> 1.0) rack (> 1, < 3) @@ -573,7 +581,7 @@ DEPENDENCIES puma pundit rack-mini-profiler - rails (~> 6.1.7) + rails (~> 7.0.4) rails-controller-testing rails-i18n rails-timeago @@ -599,7 +607,6 @@ DEPENDENCIES simplecov slim-rails sorcery - spring sprockets-rails telegraf tubesock diff --git a/app/controllers/live_streams_controller.rb b/app/controllers/live_streams_controller.rb index 06dfcd1f..c1af67ef 100644 --- a/app/controllers/live_streams_controller.rb +++ b/app/controllers/live_streams_controller.rb @@ -59,21 +59,4 @@ class LiveStreamsController < ApplicationController redirect_back(fallback_location: redirect_fallback, alert: t('exercises.download_file_tree.gone')) end end - - # TODO: Taken from Rails 7, remove when upgrading - # rubocop:disable all - def send_stream(filename:, disposition: "attachment", type: nil) - response.headers["Content-Type"] = - (type.is_a?(Symbol) ? Mime[type].to_s : type) || - Mime::Type.lookup_by_extension(File.extname(filename).downcase.delete(".")) || - "application/octet-stream" - - response.headers["Content-Disposition"] = - ActionDispatch::Http::ContentDisposition.format(disposition: disposition, filename: filename) - - yield response.stream - ensure - response.stream.close - end - # rubocop:enable all end diff --git a/bin/rails b/bin/rails index 21d3e02d..6fb4e405 100755 --- a/bin/rails +++ b/bin/rails @@ -1,5 +1,4 @@ #!/usr/bin/env ruby -load File.expand_path("spring", __dir__) APP_PATH = File.expand_path('../config/application', __dir__) require_relative "../config/boot" require "rails/commands" diff --git a/bin/rake b/bin/rake index 7327f471..4fbf10b9 100755 --- a/bin/rake +++ b/bin/rake @@ -1,5 +1,4 @@ #!/usr/bin/env ruby -load File.expand_path("spring", __dir__) require_relative "../config/boot" require "rake" Rake.application.run diff --git a/bin/spring b/bin/spring deleted file mode 100755 index b4147e84..00000000 --- a/bin/spring +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env ruby -if !defined?(Spring) && [nil, "development", "test"].include?(ENV["RAILS_ENV"]) - gem "bundler" - require "bundler" - - # Load Spring without loading other gems in the Gemfile, for speed. - Bundler.locked_gems&.specs&.find { |spec| spec.name == "spring" }&.tap do |spring| - Gem.use_paths Gem.dir, Bundler.bundle_path.to_s, *Gem.path - gem "spring", spring.version - require "spring/binstub" - rescue Gem::LoadError - # Ignore when Spring is not installed. - end -end diff --git a/config/application.rb b/config/application.rb index 8d52e906..aac487c4 100644 --- a/config/application.rb +++ b/config/application.rb @@ -13,7 +13,7 @@ require 'telegraf/rails' module CodeOcean class Application < Rails::Application # Initialize configuration defaults for originally generated Rails version. - config.load_defaults 6.1 + config.load_defaults 7.0 # Configuration for the application, engines, and railties goes here. # @@ -29,12 +29,12 @@ module CodeOcean # config.i18n.default_locale = :de config.i18n.available_locales = %i[de en] - extra_paths = %W[ - #{config.root}/lib + extra_paths = [ + Rails.root.join('lib'), ] # Add generators, they don't have a module structure that matches their directory structure. - extra_paths << "#{config.root}/lib/generators" + extra_paths << Rails.root.join('lib/generators') config.add_autoload_paths_to_load_path = false config.autoload_paths += extra_paths diff --git a/config/environment.rb b/config/environment.rb index b8a976dc..d5abe558 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -3,8 +3,5 @@ # Load the Rails application. require_relative 'application' -# LTI 1.x uses OAuth 1.0 -OAUTH_10_SUPPORT = true - # Initialize the Rails application. Rails.application.initialize! diff --git a/config/environments/development.rb b/config/environments/development.rb index 3d9636d1..99020ddb 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -18,6 +18,9 @@ Rails.application.configure do # Show full error reports. config.consider_all_requests_local = true + # Enable server timing + config.server_timing = true + # Enable/disable caching. By default caching is disabled. # Run rails dev:cache to toggle caching. if Rails.root.join('tmp/caching-dev.txt').exist? @@ -38,11 +41,11 @@ Rails.application.configure do config.active_storage.service = :local # Don't care if the mailer can't send. - config.action_mailer.perform_deliveries = true + config.action_mailer.raise_delivery_errors = false # Perform deliveries via letter opener + config.action_mailer.perform_deliveries = true config.action_mailer.delivery_method = :letter_opener - config.action_mailer.raise_delivery_errors = false config.action_mailer.perform_caching = false @@ -75,11 +78,6 @@ Rails.application.configure do # Annotate rendered view with file names. # config.action_view.annotate_rendered_view_with_filenames = true - # Adds additional error checking when serving assets at runtime. - # Checks for improperly declared sprockets dependencies. - # Raises helpful error messages. - config.assets.raise_runtime_errors = true - BetterErrors::Middleware.allow_ip! ENV.fetch('TRUSTED_IP', nil) if ENV['TRUSTED_IP'] # Use an evented file watcher to asynchronously detect changes in source code, diff --git a/config/environments/production.rb b/config/environments/production.rb index e7826ec0..b3cc3371 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -79,12 +79,6 @@ Rails.application.configure do # Send deprecation notices to registered listeners. config.active_support.deprecation = :notify - # Log disallowed deprecations. - config.active_support.disallowed_deprecation = :log - - # Tell Active Support which deprecation messages to disallow. - config.active_support.disallowed_deprecation_warnings = [] - # Use default logging formatter so that PID and timestamp are not suppressed. config.log_formatter = ::Logger::Formatter.new @@ -100,25 +94,4 @@ Rails.application.configure do # Do not dump schema after migrations. config.active_record.dump_schema_after_migration = false - - # Inserts middleware to perform automatic connection switching. - # The `database_selector` hash is used to pass options to the DatabaseSelector - # middleware. The `delay` is used to determine how long to wait after a write - # to send a subsequent read to the primary. - # - # The `database_resolver` class is used by the middleware to determine which - # database is appropriate to use based on the time delay. - # - # The `database_resolver_context` class is used by the middleware to set - # timestamps for the last write to the primary. The resolver uses the context - # class timestamps to determine how long to wait before reading from the - # replica. - # - # By default Rails will store a last write timestamp in the session. The - # DatabaseSelector middleware is designed as such you can define your own - # strategy for connection switching and pass that into the middleware through - # these configuration options. - # config.active_record.database_selector = { delay: 2.seconds } - # config.active_record.database_resolver = ActiveRecord::Middleware::DatabaseSelector::Resolver - # config.active_record.database_resolver_context = ActiveRecord::Middleware::DatabaseSelector::Resolver::Session end diff --git a/config/environments/test.rb b/config/environments/test.rb index 0b8ee95a..2248474d 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -10,12 +10,12 @@ require 'active_support/core_ext/integer/time' Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. - config.cache_classes = false - config.action_view.cache_template_loading = true + # Turn false under Spring and add config.action_view.cache_template_loading = true. + config.cache_classes = true - # Do not eager load code on boot. This avoids loading your whole application - # just for the purpose of running a single test. If you are using a tool that - # preloads Rails for running tests, you may have to set it to true. + # Eager loading loads your whole application. When running a single test locally, + # this probably isn't necessary. It's a good idea to do in a continuous integration + # system, or in some way before deploying your code. # Eager load code for prometheus exporter config.eager_load = true diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index 83952756..1ffb9777 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -7,19 +7,8 @@ Rails.application.config.assets.version = '1.0' # Add additional assets to the asset load path. # Rails.application.config.assets.paths << Emoji.images_path -# Add Yarn node_modules folder to the asset load path. -Rails.application.config.assets.paths << Rails.root.join('node_modules') # Precompile additional assets. # application.js, application.css, and all non-JS/CSS in the app/assets # folder are already added. Rails.application.config.assets.precompile += %w[markdown-buttons.png] - -# Disable concurrent asset compilation to prevent segfault # https://github.com/sass/sassc-ruby/issues/197 -# Reproduce: `rake assets:clobber`, `rake assets:precompile`. If the command succeeds, it worked -Rails.application.config.assets.configure do |env| - env.export_concurrent = false -end - -# Add node_modules folder to the asset load path. -Rails.application.config.assets.paths << Rails.root.join('node_modules') diff --git a/config/initializers/content_security_policy.rb b/config/initializers/content_security_policy.rb index ec5c5583..7230bc75 100644 --- a/config/initializers/content_security_policy.rb +++ b/config/initializers/content_security_policy.rb @@ -2,66 +2,66 @@ # Be sure to restart your server when you modify this file. -# Define an application-wide content security policy -# For further information see the following documentation -# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy +# Define an application-wide content security policy. +# See the Securing Rails Applications Guide for more information: +# https://guides.rubyonrails.org/security.html#content-security-policy-header require_relative 'sentry_csp' require_relative 'sentry_javascript' -def self.apply_yml_settings_for(policy) - csp_settings = CodeOcean::Config.new(:content_security_policy) +module CSP + def self.apply_yml_settings_for(policy) + csp_settings = CodeOcean::Config.new(:content_security_policy) - csp_settings.read.each do |directive, additional_settings| - existing_settings = if directive == 'report_uri' - '' - else - policy.public_send(directive) || [] - end - all_settings = existing_settings + additional_settings - policy.public_send(directive, *all_settings) + csp_settings.read.each do |directive, additional_settings| + existing_settings = if directive == 'report_uri' + '' + else + policy.public_send(directive) || [] + end + all_settings = existing_settings + additional_settings + policy.public_send(directive, *all_settings) + end + end + + def self.apply_sentry_settings_for(policy) + sentry_domain = URI.parse SentryJavascript.dsn + additional_setting = "#{sentry_domain.scheme}://#{sentry_domain.host}" + existing_settings = policy.connect_src || [] + all_settings = existing_settings + [additional_setting] + policy.connect_src(*all_settings) end end -def self.apply_sentry_settings_for(policy) - sentry_domain = URI.parse SentryJavascript.dsn - additional_setting = "#{sentry_domain.scheme}://#{sentry_domain.host}" - existing_settings = policy.connect_src || [] - all_settings = existing_settings + [additional_setting] - policy.connect_src(*all_settings) +Rails.application.configure do + config.content_security_policy do |policy| + policy.default_src :none + policy.base_uri :self + policy.font_src :self + # Code executions might return a base64 encoded image as a :data URI + policy.img_src :self, :data + policy.object_src :none + policy.media_src :self + policy.script_src :self, :report_sample + # Our ACE editor unfortunately requires :unsafe_inline for the code highlighting + policy.style_src :self, :unsafe_inline, :report_sample + policy.connect_src :self + # Our ACE editor uses web workers to highlight code, preferably via URL or otherwise with a blob. + policy.child_src :self, :blob + policy.form_action :self + policy.frame_ancestors :none + + # Specify URI for violation reports + policy.report_uri SentryCsp.report_url if SentryCsp.active? + + CSP.apply_yml_settings_for policy + CSP.apply_sentry_settings_for policy if SentryJavascript.active? + end + + # Generate session nonces for permitted importmap and inline scripts + # config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s } + # config.content_security_policy_nonce_directives = %w[script-src] + + # Report violations without enforcing the policy + # config.content_security_policy_report_only = true end - -Rails.application.config.content_security_policy do |policy| - policy.default_src :none - policy.base_uri :self - policy.font_src :self - # Code executions might return a base64 encoded image as a :data URI - policy.img_src :self, :data - policy.object_src :none - policy.media_src :self - policy.script_src :self, :report_sample - # Our ACE editor unfortunately requires :unsafe_inline for the code highlighting - policy.style_src :self, :unsafe_inline, :report_sample - policy.connect_src :self - # Our ACE editor uses web workers to highlight code, preferably via URL or otherwise with a blob. - policy.child_src :self, :blob - policy.form_action :self - policy.frame_ancestors :none - - # Specify URI for violation reports - policy.report_uri SentryCsp.report_url if SentryCsp.active? - - apply_yml_settings_for policy - apply_sentry_settings_for policy if SentryJavascript.active? -end - -# If you are using UJS then enable automatic nonce generation -# Rails.application.config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s } - -# Set the nonce only to specific directives -# Rails.application.config.content_security_policy_nonce_directives = %w[script-src] - -# Report CSP violations to a specified URI -# For further information see the following documentation: -# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only -# Rails.application.config.content_security_policy_report_only = true diff --git a/config/initializers/filter_parameter_logging.rb b/config/initializers/filter_parameter_logging.rb index 3babc73f..3df77c5b 100644 --- a/config/initializers/filter_parameter_logging.rb +++ b/config/initializers/filter_parameter_logging.rb @@ -2,7 +2,9 @@ # Be sure to restart your server when you modify this file. -# Configure sensitive parameters which will be filtered from the log file. +# Configure parameters to be filtered from the log file. Use this to limit dissemination of +# sensitive information. See the ActiveSupport::ParameterFilter documentation for supported +# notations and behaviors. Rails.application.config.filter_parameters += %i[ passw secret token _key crypt salt certificate otp ssn ] diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb index d6c6e2f7..aff5032b 100644 --- a/config/initializers/inflections.rb +++ b/config/initializers/inflections.rb @@ -6,9 +6,9 @@ # are locale specific, and you may define rules for as many different # locales as you wish. All of these examples are active by default: # ActiveSupport::Inflector.inflections(:en) do |inflect| -# inflect.plural /^(ox)$/i, '\1en' -# inflect.singular /^(ox)en/i, '\1' -# inflect.irregular 'person', 'people' +# inflect.plural /^(ox)$/i, "\\1en" +# inflect.singular /^(ox)en/i, "\\1" +# inflect.irregular "person", "people" # inflect.uncountable %w( fish sheep ) # end diff --git a/config/spring.rb b/config/spring.rb deleted file mode 100644 index 93cd0ff8..00000000 --- a/config/spring.rb +++ /dev/null @@ -1,8 +0,0 @@ -# frozen_string_literal: true - -Spring.watch( - '.ruby-version', - '.rbenv-vars', - 'tmp/restart.txt', - 'tmp/caching-dev.txt' -) diff --git a/db/migrate/20221204002837_remove_not_null_on_active_storage_blobs_checksum.active_storage.rb b/db/migrate/20221204002837_remove_not_null_on_active_storage_blobs_checksum.active_storage.rb new file mode 100644 index 00000000..6f318221 --- /dev/null +++ b/db/migrate/20221204002837_remove_not_null_on_active_storage_blobs_checksum.active_storage.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +# This migration comes from active_storage (originally 20211119233751) +class RemoveNotNullOnActiveStorageBlobsChecksum < ActiveRecord::Migration[6.0] + def change + return unless table_exists?(:active_storage_blobs) + + change_column_null(:active_storage_blobs, :checksum, true) + end +end diff --git a/db/migrate/20221204120508_add_precision_to_timestamps.rb b/db/migrate/20221204120508_add_precision_to_timestamps.rb new file mode 100644 index 00000000..4ecf9c3f --- /dev/null +++ b/db/migrate/20221204120508_add_precision_to_timestamps.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +class AddPrecisionToTimestamps < ActiveRecord::Migration[7.0] + def change + tables = %w[ + anomaly_notifications + codeharbor_links + comments + consumers + error_template_attributes + error_templates + events + execution_environments + exercise_collections + exercises + exercises_proxy_exercises + external_users + file_templates + file_types + files + internal_users + interventions + linter_check_runs + lti_parameters + proxy_exercises + remote_evaluation_mappings + request_for_comments + searches + structured_error_attributes + structured_errors + study_groups + submissions + subscriptions + tags + testruns + tips + user_exercise_feedbacks + user_exercise_interventions + user_proxy_exercise_exercises + ] + + tables.each do |table| + change_column table, :created_at, :datetime, precision: 6 + change_column table, :updated_at, :datetime, precision: 6 + end + + change_column :authentication_tokens, :expire_at, :datetime, precision: 6 + change_column :community_solution_locks, :locked_until, :datetime, precision: 6 + change_column :exercises, :submission_deadline, :datetime, precision: 6 + change_column :exercises, :late_submission_deadline, :datetime, precision: 6 + change_column :internal_users, :lock_expires_at, :datetime, precision: 6 + change_column :internal_users, :remember_me_token_expires_at, :datetime, precision: 6 + change_column :internal_users, :reset_password_token_expires_at, :datetime, precision: 6 + change_column :internal_users, :reset_password_email_sent_at, :datetime, precision: 6 + change_column :internal_users, :activation_token_expires_at, :datetime, precision: 6 + end +end diff --git a/db/schema.rb b/db/schema.rb index 8e404563..bcec5078 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,8 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2022_09_23_214003) do - +ActiveRecord::Schema[7.0].define(version: 2022_12_04_120508) do # These are extensions that must be enabled in order to support this database enable_extension "pg_trgm" enable_extension "pgcrypto" @@ -35,8 +34,8 @@ ActiveRecord::Schema.define(version: 2022_09_23_214003) do t.string "user_type", null: false t.bigint "user_id", null: false t.datetime "expire_at", null: false - t.datetime "created_at", precision: 6, null: false - t.datetime "updated_at", precision: 6, null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false t.bigint "study_group_id" t.index ["shared_secret"], name: "index_authentication_tokens_on_shared_secret", unique: true t.index ["study_group_id"], name: "index_authentication_tokens_on_study_group_id" @@ -77,8 +76,8 @@ ActiveRecord::Schema.define(version: 2022_09_23_214003) do t.boolean "timely_contribution", null: false t.boolean "autosave", null: false t.interval "working_time", null: false - t.datetime "created_at", precision: 6, null: false - t.datetime "updated_at", precision: 6, null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false t.index ["community_solution_id", "timely_contribution", "autosave", "proposed_changes"], name: "index_community_solution_valid_contributions" t.index ["community_solution_lock_id"], name: "index_community_solution_contributions_lock" t.index ["user_type", "user_id"], name: "index_community_solution_contributions_on_user" @@ -89,16 +88,16 @@ ActiveRecord::Schema.define(version: 2022_09_23_214003) do t.string "user_type", null: false t.bigint "user_id", null: false t.datetime "locked_until" - t.datetime "created_at", precision: 6, null: false - t.datetime "updated_at", precision: 6, null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false t.index ["community_solution_id", "locked_until"], name: "index_community_solution_locks_until", unique: true t.index ["user_type", "user_id"], name: "index_community_solution_locks_on_user" end create_table "community_solutions", force: :cascade do |t| t.bigint "exercise_id", null: false - t.datetime "created_at", precision: 6, null: false - t.datetime "updated_at", precision: 6, null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false t.index ["exercise_id"], name: "index_community_solutions_on_exercise_id" end @@ -241,7 +240,7 @@ ActiveRecord::Schema.define(version: 2022_09_23_214003) do t.string "name" t.datetime "created_at" t.datetime "updated_at" - t.boolean "platform_admin", default: false + t.boolean "platform_admin", default: false, null: false end create_table "file_templates", id: :serial, force: :cascade do |t| @@ -306,7 +305,7 @@ ActiveRecord::Schema.define(version: 2022_09_23_214003) do t.string "activation_state" t.string "activation_token" t.datetime "activation_token_expires_at" - t.boolean "platform_admin", default: false + t.boolean "platform_admin", default: false, null: false t.index ["activation_token"], name: "index_internal_users_on_activation_token" t.index ["email"], name: "index_internal_users_on_email", unique: true t.index ["remember_me_token"], name: "index_internal_users_on_remember_me_token" @@ -396,8 +395,8 @@ ActiveRecord::Schema.define(version: 2022_09_23_214003) do t.bigint "execution_environment_id" t.string "user_type" t.bigint "user_id" - t.datetime "created_at", precision: 6, null: false - t.datetime "updated_at", precision: 6, null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false t.index ["execution_environment_id"], name: "index_runners_on_execution_environment_id" t.index ["user_type", "user_id"], name: "index_runners_on_user" end @@ -482,8 +481,8 @@ ActiveRecord::Schema.define(version: 2022_09_23_214003) do create_table "testrun_execution_environments", force: :cascade do |t| t.bigint "testrun_id", null: false t.bigint "execution_environment_id", null: false - t.datetime "created_at", precision: 6, null: false - t.datetime "updated_at", precision: 6, null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false t.index ["execution_environment_id"], name: "index_testrun_execution_environments" t.index ["testrun_id"], name: "index_testrun_execution_environments_on_testrun_id" end @@ -495,10 +494,10 @@ ActiveRecord::Schema.define(version: 2022_09_23_214003) do t.integer "stream", limit: 2, comment: "Used as enum in Rails" t.text "log" t.jsonb "data" - t.datetime "created_at", precision: 6, null: false - t.datetime "updated_at", precision: 6, null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false t.index ["testrun_id"], name: "index_testrun_messages_on_testrun_id" - t.check_constraint "(log IS NULL) OR (data IS NULL)", name: "either_data_or_log" + t.check_constraint "log IS NULL OR data IS NULL", name: "either_data_or_log" end create_table "testruns", id: :serial, force: :cascade do |t| @@ -514,7 +513,7 @@ ActiveRecord::Schema.define(version: 2022_09_23_214003) do t.integer "exit_code", limit: 2, comment: "No exit code is available in case of a timeout" t.integer "status", limit: 2, default: 0, null: false, comment: "Used as enum in Rails" t.index ["submission_id"], name: "index_testruns_on_submission_id" - t.check_constraint "(exit_code >= 0) AND (exit_code <= 255)", name: "exit_code_constraint" + t.check_constraint "exit_code >= 0 AND exit_code <= 255", name: "exit_code_constraint" end create_table "tips", force: :cascade do |t|