diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..8b248e71 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,8 @@ +.bundle +.circleci +.git +vendor/bundle +log/* +!/log/.keep +tmp/* +!/tmp/.keep diff --git a/.ruby-version b/.ruby-version index ec1cf33c..24ba9a38 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.6.3 +2.7.0 diff --git a/Dockerfile b/Dockerfile index eb9b6c79..561d7767 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,18 +1,25 @@ -FROM ruby:2.6.3 +FROM ruby:2.7.1 -LABEL MAINTAINER Jihane Najdi +MAINTAINER Jihane Najdi # Default environment ARG RAILS_ENV='development' -ARG BASEDIR='/code-workout/' +# Ruby changed the way optional params are done, but Rails hasn't caught up +ARG RUBYOPT='-W:no-deprecated' +ARG BASEDIR='/code-workout' ENV TZ=America/New_York RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone +RUN sed -i 's|deb.debian.org|archive.debian.org|g' /etc/apt/sources.list && \ + sed -i 's|security.debian.org|archive.debian.org|g' /etc/apt/sources.list && \ + apt-get -o Acquire::Check-Valid-Until=false update && \ + apt-get install -y --no-install-recommends build-essential + #install 'development tools' build-essential dkms curl libxslt-dev libpq-dev python-dev python-pip python-feedvalidator python-software-properties python-sphinx libmariadbclient-dev libcurl4-gnutls-dev libevent-dev libffi-dev libssl-dev stunnel4 libsqlite3-dev # libmariadbclient-dev RUN apt-get update -qq \ - && apt-get install -y \ + && apt-get install -y --fix-missing \ apt-utils \ build-essential \ libpq-dev \ @@ -40,30 +47,27 @@ RUN apt-get update -qq \ python-feedvalidator \ python-sphinx \ ant \ + default-jre \ + default-jdk \ && pip install --upgrade pip ## JAVA INSTALLATION RUN apt-get install -y default-jre default-jdk # install rubygems -ENV GEM_HOME /usr/local/bundle -ENV PATH $GEM_HOME/bin:$PATH -ENV BUNDLER_VERSION 1.17.3 +ENV BUNDLER_VERSION 2.1.4 ENV RAILS_ENV=$RAILS_ENV -RUN gem install bundler -v $BUNDLER_VERSION \ - && bundle config --global path "$GEM_HOME" \ - && bundle config --global bin "$GEM_HOME/bin" \ - && bundle config git.allow_insecure true - -COPY Gemfile Gemfile -COPY Gemfile.lock Gemfile.lock - -RUN bundle install +RUN gem install bundler -v $BUNDLER_VERSION VOLUME ${BASEDIR} WORKDIR ${BASEDIR} +COPY Gemfile ${BASEDIR}/Gemfile +COPY Gemfile.lock ${BASEDIR}/Gemfile.lock + +RUN bundle install + COPY runservers.sh runservers.sh RUN find /code-workout -type d -exec chmod 2775 {} \; diff --git a/Gemfile b/Gemfile index 0046797c..7836afae 100644 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,8 @@ source 'https://rubygems.org' -gem 'rails', '~> 4.2' -gem 'bootstrap-sass-backport', '~> 3.2.0' +gem 'rails', '~> 5.1' +gem 'sprockets', '< 4.0.0' +gem 'bootstrap-sass', '~> 3.2.0' gem 'jquery-rails' gem 'jquery-ui-rails' gem 'bootstrap-editable-rails' @@ -12,7 +13,7 @@ gem 'formtastic-bootstrap' gem 'sucker_punch', '~> 1.0' gem 'haml', '>= 3.1.4' gem 'haml-rails' -gem 'coffee-rails', '~> 4.0.0' +gem 'coffee-rails', '~> 4.2' gem 'coffee-script-source' gem 'test-unit', '~> 3.0.9' gem 'nokogiri', '~> 1.10.4' @@ -26,12 +27,15 @@ gem 'acts-as-taggable-on' gem 'representable', '~> 2.1' gem 'redcarpet' gem 'loofah', '>= 2.3.1' +gem 'peml', github: 'CSSPLICE/peml' gem 'truncate_html' gem 'tzinfo' # For timezone support gem 'active_record_union' +gem 'dottie', '~> 0.0.1' gem 'mysql2', '~> 0.4.0' gem 'modernizr-rails' gem 'rubyzip', '>= 1.3.0' +gem 'bootsnap' # Added during Rails 5.2 upgrade # For JSON support gem 'rabl' @@ -48,22 +52,19 @@ group :development, :test do gem 'thin' gem 'byebug' gem 'sqlite3', '~> 1.3.0' + gem 'listen' gem 'rspec-rails' gem 'annotate' gem 'rails-erd', git: 'https://github.com/voormedia/rails-erd' gem 'faker' - # Needed for debugging support in Aptana Studio. Disabled, since these - # two gems do not support Ruby 2.0 yet :-(. - # gem 'ruby-debug-base' - # gem 'ruby-debug-ide' gem 'pry' gem 'request-log-analyzer' + gem 'capybara', '~> 3.12.0' end gem 'factory_bot_rails' gem 'log_file' group :test do - gem 'capybara' end group :production, :staging, :deploy do @@ -83,7 +84,7 @@ gem 'omniauth-google-oauth2' gem 'omniauth-cas' gem 'cancancan' gem 'activeadmin' -gem 'exception_handler', '= 0.3.45' +gem 'exception_handler', '~> 0.8.0.0' gem 'kaminari', '~> 1.2.1' # Auto-paginated views gem 'remotipart' # Adds support for remote mulitpart forms (file uploads) @@ -98,9 +99,6 @@ gem 'bootstrap-wysihtml5-rails' gem 'momentjs-rails', '>= 2.9.0' gem 'bootstrap3-datetimepicker-rails', '~> 4.17.37' -#gem for improved WHERE querying -gem 'squeel', '~> 1.2' - #for nested forms gem 'cocoon' @@ -128,7 +126,6 @@ gem 'rest-client' # Gems for cookie updates gem 'user_agent_parser', '~> 2.7.0' gem 'rails_same_site_cookie' -gem 'sprockets', '< 4.0.0' gem 'image_hash' # Gems for resource uploder diff --git a/Gemfile.lock b/Gemfile.lock index e84689d2..123e5b98 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,3 +1,16 @@ +GIT + remote: https://github.com/CSSPLICE/peml.git + revision: 91e6bcb3a6923dcb05c669eb6409383058bf1a7c + specs: + peml (0.1.1) + dottie (~> 0.0.1) + json_schemer (>= 0.2) + kramdown (~> 2.3.1) + kramdown-parser-gfm (~> 1.1.0) + liquid (>= 3.0.6) + parslet (>= 1.8) + redcarpet (>= 3.5) + GIT remote: https://github.com/raganwald/andand revision: d6c4545b6649c70495c26e2038206c5fdb2d14d6 @@ -27,102 +40,111 @@ GIT GEM remote: https://rubygems.org/ specs: - actionmailer (4.2.11.3) - actionpack (= 4.2.11.3) - actionview (= 4.2.11.3) - activejob (= 4.2.11.3) + actioncable (5.2.4.4) + actionpack (= 5.2.4.4) + nio4r (~> 2.0) + websocket-driver (>= 0.6.1) + actionmailer (5.2.4.4) + actionpack (= 5.2.4.4) + actionview (= 5.2.4.4) + activejob (= 5.2.4.4) mail (~> 2.5, >= 2.5.4) - rails-dom-testing (~> 1.0, >= 1.0.5) - actionpack (4.2.11.3) - actionview (= 4.2.11.3) - activesupport (= 4.2.11.3) - rack (~> 1.6) - rack-test (~> 0.6.2) - rails-dom-testing (~> 1.0, >= 1.0.5) + rails-dom-testing (~> 2.0) + actionpack (5.2.4.4) + actionview (= 5.2.4.4) + activesupport (= 5.2.4.4) + rack (~> 2.0, >= 2.0.8) + rack-test (>= 0.6.3) + rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (4.2.11.3) - activesupport (= 4.2.11.3) + actionview (5.2.4.4) + activesupport (= 5.2.4.4) builder (~> 3.1) - erubis (~> 2.7.0) - rails-dom-testing (~> 1.0, >= 1.0.5) + erubi (~> 1.4) + rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.3) - active_record-acts_as (3.1.0) - activerecord (>= 4.2, < 5.2.2.rc1) - activesupport (>= 4.2, < 5.2.2.rc1) + active_record-acts_as (4.0.3) + activerecord (>= 4.2) + activesupport (>= 4.2) active_record_union (1.3.0) activerecord (>= 4.0) - activeadmin (1.4.3) - arbre (>= 1.1.1) - coffee-rails - formtastic (~> 3.1) - formtastic_i18n - inherited_resources (>= 1.9.0) - jquery-rails (>= 4.2.0) - kaminari (>= 0.15) - railties (>= 4.2, < 5.3) - ransack (>= 1.8.7) - sass (~> 3.1) - sprockets (< 4.1) - activejob (4.2.11.3) - activesupport (= 4.2.11.3) - globalid (>= 0.3.0) - activemodel (4.2.11.3) - activesupport (= 4.2.11.3) - builder (~> 3.1) - activerecord (4.2.11.3) - activemodel (= 4.2.11.3) - activesupport (= 4.2.11.3) - arel (~> 6.0) - activesupport (4.2.11.3) - i18n (~> 0.7) + activeadmin (2.8.1) + arbre (~> 1.2, >= 1.2.1) + formtastic (>= 3.1, < 5.0) + formtastic_i18n (~> 0.4) + inherited_resources (~> 1.7) + jquery-rails (~> 4.2) + kaminari (~> 1.0, >= 1.2.1) + railties (>= 5.2, < 6.1) + ransack (~> 2.1, >= 2.1.1) + sassc-rails (~> 2.1) + sprockets (>= 3.0, < 4.1) + activejob (5.2.4.4) + activesupport (= 5.2.4.4) + globalid (>= 0.3.6) + activemodel (5.2.4.4) + activesupport (= 5.2.4.4) + activerecord (5.2.4.4) + activemodel (= 5.2.4.4) + activesupport (= 5.2.4.4) + arel (>= 9.0) + activestorage (5.2.4.4) + actionpack (= 5.2.4.4) + activerecord (= 5.2.4.4) + marcel (~> 0.3.1) + activesupport (5.2.4.4) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (>= 0.7, < 2) minitest (~> 5.1) - thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) - acts-as-taggable-on (5.0.0) - activerecord (>= 4.2.8) - acts_as_list (0.9.19) - activerecord (>= 3.0) - addressable (2.6.0) - public_suffix (>= 2.0.2, < 4.0) - airbrussh (1.3.2) + acts-as-taggable-on (6.5.0) + activerecord (>= 5.0, < 6.1) + acts_as_list (1.0.2) + activerecord (>= 4.2) + addressable (2.7.0) + public_suffix (>= 2.0.2, < 5.0) + airbrussh (1.4.0) sshkit (>= 1.6.1, != 1.7.0) - annotate (2.7.5) + annotate (3.1.1) activerecord (>= 3.2, < 7.0) - rake (>= 10.4, < 13.0) - arbre (1.2.1) - activesupport (>= 3.0.0) - arel (6.0.4) - autoprefixer-rails (9.6.0) + rake (>= 10.4, < 14.0) + arbre (1.3.0) + activesupport (>= 3.0.0, < 6.1) + ruby2_keywords (>= 0.0.2, < 1.0) + arel (9.0.0) + autoprefixer-rails (10.0.2.0) execjs awesome_print (1.8.0) - bcrypt (3.1.13) + bcrypt (3.1.16) bcrypt_pbkdf (1.1.0) + bootsnap (1.5.1) + msgpack (~> 1.0) bootstrap-editable-rails (0.0.9) railties (>= 3.1) sass-rails - bootstrap-sass-backport (3.2.0.2) + bootstrap-sass (3.2.0.4) sass (~> 3.2) bootstrap-wysihtml5-rails (0.3.3.8) railties (>= 3.0) bootstrap3-datetimepicker-rails (4.17.47) momentjs-rails (>= 2.8.1) builder (3.2.4) - byebug (11.0.1) - cancancan (3.0.1) - capistrano (3.11.0) + byebug (11.1.3) + cancancan (3.1.0) + capistrano (3.14.1) airbrussh (>= 1.0.0) i18n rake (>= 10.0.0) sshkit (>= 1.9.0) - capistrano-bundler (1.6.0) + capistrano-bundler (2.0.1) capistrano (~> 3.1) - capistrano-rails (1.4.0) + capistrano-rails (1.6.1) capistrano (~> 3.1) - capistrano-bundler (~> 1.1) + capistrano-bundler (>= 1.1, < 3) capistrano-rvm (0.1.2) capistrano (~> 3.0) sshkit (~> 1.2) - capybara (3.15.1) + capybara (3.12.0) addressable mini_mime (>= 0.1.3) nokogiri (~> 1.8) @@ -153,55 +175,57 @@ GEM celluloid-supervision (0.20.6) timers (>= 4.1.1) choice (0.2.0) - cocoon (1.2.14) + cocoon (1.2.15) codemirror-rails (5.16.0) railties (>= 3.0, < 6.0) - coderay (1.1.2) - coffee-rails (4.0.1) + coderay (1.1.3) + coffee-rails (4.2.2) coffee-script (>= 2.2.0) - railties (>= 4.0.0, < 5.0) + railties (>= 4.0.0) coffee-script (2.4.1) coffee-script-source execjs coffee-script-source (1.12.2) - concurrent-ruby (1.1.6) + concurrent-ruby (1.1.7) crass (1.0.6) css3-progress-bar-rails (0.5.1) rails (>= 3.1) - csv_shaper (1.3.0) + csv_shaper (1.3.2) activesupport (>= 3.0.0) daemons (1.3.1) - declarative (0.0.10) - devise (4.7.1) + declarative (0.0.20) + devise (4.7.3) bcrypt (~> 3.0) orm_adapter (~> 0.1) railties (>= 4.1.0) responders warden (~> 1.2.3) - diff-lcs (1.3) - domain_name (0.5.20180417) + diff-lcs (1.4.4) + domain_name (0.5.20190701) unf (>= 0.0.5, < 1.0.0) + dottie (0.0.2) + ecma-re-validator (0.2.1) + regexp_parser (~> 1.2) ed25519 (1.2.4) - equatable (0.6.1) + erubi (1.9.0) erubis (2.7.0) eventmachine (1.2.7) - exception_handler (0.3.45) + exception_handler (0.8.0.0) + bundler + rails (>= 4.2.0) + responders execjs (2.7.0) - factory_bot (5.0.2) - activesupport (>= 4.2.0) - factory_bot_rails (5.0.2) - factory_bot (~> 5.0.2) - railties (>= 4.2.0) - faker (1.9.4) - i18n (>= 0.7) - pastel (~> 0.7.2) - thor (~> 0.20.0) - tty-pager (~> 0.12.0) - tty-screen (~> 0.6.5) - tty-tree (~> 0.3.0) - faraday (0.15.4) + factory_bot (6.1.0) + activesupport (>= 5.0.0) + factory_bot_rails (6.1.0) + factory_bot (~> 6.1.0) + railties (>= 5.0.0) + faker (2.14.0) + i18n (>= 1.6, < 2) + faraday (1.1.0) multipart-post (>= 1.2, < 3) - ffi (1.11.1) + ruby2_keywords + ffi (1.13.1) font-awesome-rails (4.7.0.5) railties (>= 3.2, < 6.1) formtastic (3.1.5) @@ -209,32 +233,34 @@ GEM formtastic-bootstrap (3.1.1) formtastic (>= 3.0) formtastic_i18n (0.6.0) - friendly_id (5.2.5) + friendly_id (5.4.1) activerecord (>= 4.0.0) globalid (0.4.2) activesupport (>= 4.2.0) gravtastic (3.2.6) - haml (5.1.1) + haml (5.2.0) temple (>= 0.8.0) tilt - haml-rails (1.0.0) - actionpack (>= 4.0.1) - activesupport (>= 4.0.1) + haml-rails (2.0.1) + actionpack (>= 5.1) + activesupport (>= 5.1) haml (>= 4.0.6, < 6.0) html2haml (>= 1.0.1) - railties (>= 4.0.1) + railties (>= 5.1) + hana (1.3.7) has_scope (0.7.2) actionpack (>= 4.1) activesupport (>= 4.1) - hashie (3.6.0) + hashie (4.1.0) html2haml (2.2.0) erubis (~> 2.7.0) haml (>= 4.0, < 6) nokogiri (>= 1.6.0) ruby_parser (~> 3.5) + http-accept (1.7.0) http-cookie (1.0.3) domain_name (~> 0.5) - i18n (0.9.5) + i18n (1.8.5) concurrent-ruby (~> 1.0) image_hash (1.0.0) mini_magick @@ -243,21 +269,26 @@ GEM ims-lti (1.1.13) builder oauth (>= 0.4.5, < 0.6) - inherited_resources (1.9.0) - actionpack (>= 4.2, < 5.3) + inherited_resources (1.11.0) + actionpack (>= 5.0, < 6.1) has_scope (~> 0.6) - railties (>= 4.2, < 5.3) - responders - jquery-rails (4.3.5) + railties (>= 5.0, < 6.1) + responders (>= 2, < 4) + jquery-rails (4.4.0) rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) jquery-ui-rails (6.0.1) railties (>= 3.2.16) - js-routes (1.4.7) + js-routes (1.4.9) railties (>= 4) sprockets-rails - jwt (2.2.1) + json_schemer (0.2.16) + ecma-re-validator (~> 0.2) + hana (~> 1.3) + regexp_parser (~> 1.5) + uri_template (~> 0.7) + jwt (2.2.2) kaminari (1.2.1) activesupport (>= 4.1.0) kaminari-actionview (= 1.2.1) @@ -270,125 +301,138 @@ GEM activerecord kaminari-core (= 1.2.1) kaminari-core (1.2.1) + kramdown (2.3.2) + rexml + kramdown-parser-gfm (1.1.0) + kramdown (~> 2.0) + liquid (5.4.0) + listen (3.3.0) + rb-fsevent (~> 0.10, >= 0.10.3) + rb-inotify (~> 0.9, >= 0.9.10) log_file (0.0.3) - loofah (2.6.0) + loofah (2.7.0) crass (~> 1.0.2) nokogiri (>= 1.5.9) mail (2.7.1) mini_mime (>= 0.1.1) - method_source (0.9.2) - mime-types (3.2.2) + marcel (0.3.3) + mimemagic (~> 0.3.2) + method_source (1.0.0) + mime-types (3.3.1) mime-types-data (~> 3.2015) - mime-types-data (3.2019.0331) + mime-types-data (3.2020.1104) + mimemagic (0.3.10) + nokogiri (~> 1) + rake mini_magick (4.11.0) mini_mime (1.0.2) mini_portile2 (2.4.0) - minitest (5.14.1) + minitest (5.14.2) modernizr-rails (2.7.1) momentjs-rails (2.20.1) railties (>= 3.1) - multi_json (1.13.1) + msgpack (1.3.3) + multi_json (1.15.0) multi_xml (0.6.0) multipart-post (2.1.1) mysql2 (0.4.10) - net-scp (2.0.0) - net-ssh (>= 2.6.5, < 6.0.0) - net-ssh (5.2.0) + net-scp (3.0.0) + net-ssh (>= 2.6.5, < 7.0.0) + net-ssh (6.1.0) netrc (0.11.0) - nio4r (2.5.2) - nokogiri (1.10.9) + nio4r (2.5.4) + nokogiri (1.10.10) mini_portile2 (~> 2.4.0) oauth (0.5.4) - oauth2 (1.4.1) - faraday (>= 0.8, < 0.16.0) + oauth2 (1.4.4) + faraday (>= 0.8, < 2.0) jwt (>= 1.0, < 3.0) multi_json (~> 1.3) multi_xml (~> 0.5) rack (>= 1.2, < 3) oj (2.18.5) oj_mimic_json (1.0.1) - omniauth (1.9.0) - hashie (>= 3.4.6, < 3.7.0) + omniauth (1.9.1) + hashie (>= 3.4.6) rack (>= 1.6.2, < 3) omniauth-cas (1.1.1) addressable (~> 2.3) nokogiri (~> 1.5) omniauth (~> 1.2) - omniauth-facebook (5.0.0) + omniauth-facebook (8.0.0) omniauth-oauth2 (~> 1.2) - omniauth-google-oauth2 (0.7.0) + omniauth-google-oauth2 (0.8.0) jwt (>= 2.0) omniauth (>= 1.1.1) - omniauth-oauth2 (>= 1.5) - omniauth-oauth2 (1.6.0) - oauth2 (~> 1.1) + omniauth-oauth2 (>= 1.6) + omniauth-oauth2 (1.7.0) + oauth2 (~> 1.4) omniauth (~> 1.9) orm_adapter (0.5.0) - pastel (0.7.3) - equatable (~> 0.6) - tty-color (~> 0.5) - polyamorous (1.1.0) - activerecord (>= 3.0) - power_assert (1.1.4) - pry (0.12.2) - coderay (~> 1.1.0) - method_source (~> 0.9.0) - public_suffix (3.1.1) - puma (4.3.5) + parslet (2.0.0) + polyamorous (2.3.2) + activerecord (>= 5.2.1) + power_assert (1.2.0) + pry (0.13.1) + coderay (~> 1.1) + method_source (~> 1.0) + public_suffix (4.0.6) + puma (4.3.6) nio4r (~> 2.0) - rabl (0.14.1) + rabl (0.14.3) activesupport (>= 2.3.14) - rack (1.6.13) - rack-test (0.6.3) - rack (>= 1.0) - rails (4.2.11.3) - actionmailer (= 4.2.11.3) - actionpack (= 4.2.11.3) - actionview (= 4.2.11.3) - activejob (= 4.2.11.3) - activemodel (= 4.2.11.3) - activerecord (= 4.2.11.3) - activesupport (= 4.2.11.3) - bundler (>= 1.3.0, < 2.0) - railties (= 4.2.11.3) - sprockets-rails - rails-deprecated_sanitizer (1.0.3) - activesupport (>= 4.2.0.alpha) - rails-dom-testing (1.0.9) - activesupport (>= 4.2.0, < 5.0) - nokogiri (~> 1.6) - rails-deprecated_sanitizer (>= 1.0.1) + rack (2.2.3) + rack-test (1.1.0) + rack (>= 1.0, < 3) + rails (5.2.4.4) + actioncable (= 5.2.4.4) + actionmailer (= 5.2.4.4) + actionpack (= 5.2.4.4) + actionview (= 5.2.4.4) + activejob (= 5.2.4.4) + activemodel (= 5.2.4.4) + activerecord (= 5.2.4.4) + activestorage (= 5.2.4.4) + activesupport (= 5.2.4.4) + bundler (>= 1.3.0) + railties (= 5.2.4.4) + sprockets-rails (>= 2.0.0) + rails-dom-testing (2.0.3) + activesupport (>= 4.2.0) + nokogiri (>= 1.6) rails-html-sanitizer (1.3.0) loofah (~> 2.3) rails_same_site_cookie (0.1.8) rack (>= 1.5) user_agent_parser (~> 2.5) - railties (4.2.11.3) - actionpack (= 4.2.11.3) - activesupport (= 4.2.11.3) + railties (5.2.4.4) + actionpack (= 5.2.4.4) + activesupport (= 5.2.4.4) + method_source rake (>= 0.8.7) - thor (>= 0.18.1, < 2.0) - rake (12.3.3) - ransack (1.8.10) - actionpack (>= 3.0, < 5.2) - activerecord (>= 3.0, < 5.2) - activesupport (>= 3.0, < 5.2) + thor (>= 0.19.0, < 2.0) + rake (13.0.1) + ransack (2.3.2) + activerecord (>= 5.2.1) + activesupport (>= 5.2.1) i18n - rb-fsevent (0.10.3) - rb-inotify (0.10.0) + polyamorous (= 2.3.2) + rb-fsevent (0.10.4) + rb-inotify (0.10.1) ffi (~> 1.0) - rdoc (6.1.1) - redcarpet (3.4.0) - regexp_parser (1.5.1) - remotipart (1.4.3) + rdoc (6.2.1) + redcarpet (3.5.0) + regexp_parser (1.8.2) + remotipart (1.4.4) representable (2.4.1) declarative (~> 0.0.5) uber (~> 0.0.15) request-log-analyzer (1.13.4) - responders (2.4.1) - actionpack (>= 4.2.0, < 6.0) - railties (>= 4.2.0, < 6.0) - rest-client (2.0.2) + responders (3.0.1) + actionpack (>= 5.0) + railties (>= 5.0) + rest-client (2.1.0) + http-accept (>= 1.7.0, < 2.0) http-cookie (>= 1.0.2, < 2.0) mime-types (>= 1.16, < 4.0) netrc (~> 0.8) @@ -412,80 +456,70 @@ GEM rspec-support (3.8.2) ruby-graphviz (1.2.5) rexml + ruby2_keywords (0.0.5) ruby_parser (3.13.1) sexp_processor (~> 4.9) - rubyzip (1.3.0) + rubyzip (2.3.0) sass (3.7.4) sass-listen (~> 4.0.0) sass-listen (4.0.0) rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) - sass-rails (5.0.7) - railties (>= 4.0.0, < 6) - sass (~> 3.1) - sprockets (>= 2.8, < 4.0) - sprockets-rails (>= 2.0, < 4.0) - tilt (>= 1.1, < 3) - sdoc (1.0.0) + sass-rails (6.0.0) + sassc-rails (~> 2.1, >= 2.1.1) + sassc (2.4.0) + ffi (~> 1.9) + sassc-rails (2.1.2) + railties (>= 4.0.0) + sassc (>= 2.0) + sprockets (> 3.0) + sprockets-rails + tilt + sdoc (2.0.2) rdoc (>= 5.0) - sexp_processor (4.12.1) + sexp_processor (4.15.1) sprockets (3.7.2) concurrent-ruby (~> 1.0) rack (> 1, < 3) - sprockets-rails (3.2.1) + sprockets-rails (3.2.2) actionpack (>= 4.0) activesupport (>= 4.0) sprockets (>= 3.0.0) sqlite3 (1.3.13) - squeel (1.2.3) - activerecord (>= 3.0) - activesupport (>= 3.0) - polyamorous (~> 1.1.0) - sshkit (1.19.1) + sshkit (1.21.0) net-scp (>= 1.1.2) net-ssh (>= 2.8.0) ssrf_filter (1.0.7) - strings (0.1.5) - strings-ansi (~> 0.1) - unicode-display_width (~> 1.5) - unicode_utils (~> 1.4) - strings-ansi (0.1.0) sucker_punch (1.6.0) celluloid (~> 0.17.2) - temple (0.8.1) + temple (0.8.2) test-unit (3.0.9) power_assert thin (1.7.2) daemons (~> 1.0, >= 1.0.9) eventmachine (~> 1.0, >= 1.0.4) rack (>= 1, < 3) - thor (0.20.3) + thor (1.0.1) thread_safe (0.3.6) - tilt (2.0.9) - timers (4.3.0) + tilt (2.0.10) + timers (4.3.2) truncate_html (0.9.3) - tty-color (0.5.0) - tty-pager (0.12.1) - strings (~> 0.1.4) - tty-screen (~> 0.6) - tty-which (~> 0.4) - tty-screen (0.6.5) - tty-tree (0.3.0) - tty-which (0.4.1) - tzinfo (1.2.7) + tzinfo (1.2.8) thread_safe (~> 0.1) uber (0.0.15) - uglifier (4.1.20) + uglifier (4.2.0) execjs (>= 0.3.0, < 3) unf (0.1.4) unf_ext - unf_ext (0.0.7.6) - unicode-display_width (1.6.0) - unicode_utils (1.4.0) + unf_ext (0.0.7.7) + uri_template (0.7.0) user_agent_parser (2.7.0) wannabe_bool (0.7.1) - warden (1.2.7) - rack (>= 1.0) + warden (1.2.9) + rack (>= 2.0.9) + websocket-driver (0.7.3) + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.5) xpath (3.2.0) nokogiri (~> 1.8) @@ -503,8 +537,9 @@ DEPENDENCIES autoprefixer-rails awesome_print bcrypt_pbkdf + bootsnap bootstrap-editable-rails - bootstrap-sass-backport (~> 3.2.0) + bootstrap-sass (~> 3.2.0) bootstrap-wysihtml5-rails bootstrap3-datetimepicker-rails (~> 4.17.37) byebug @@ -514,17 +549,18 @@ DEPENDENCIES capistrano-rails capistrano-rvm capistrano3-puma (~> 4.0.0)! - capybara + capybara (~> 3.12.0) carrierwave (= 1.3.2) cocoon codemirror-rails - coffee-rails (~> 4.0.0) + coffee-rails (~> 4.2) coffee-script-source css3-progress-bar-rails csv_shaper devise + dottie (~> 0.0.1) ed25519 - exception_handler (= 0.3.45) + exception_handler (~> 0.8.0.0) factory_bot_rails faker font-awesome-rails @@ -541,6 +577,7 @@ DEPENDENCIES jquery-ui-rails js-routes kaminari (~> 1.2.1) + listen log_file loofah (>= 2.3.1) modernizr-rails @@ -553,10 +590,11 @@ DEPENDENCIES omniauth-cas omniauth-facebook omniauth-google-oauth2 + peml! pry puma (~> 4.3.5) rabl - rails (~> 4.2) + rails (~> 5.1) rails-erd! rails_same_site_cookie redcarpet @@ -571,7 +609,6 @@ DEPENDENCIES sdoc sprockets (< 4.0.0) sqlite3 (~> 1.3.0) - squeel (~> 1.2) sucker_punch (~> 1.0) test-unit (~> 3.0.9) thin @@ -582,4 +619,4 @@ DEPENDENCIES wannabe_bool BUNDLED WITH - 1.17.3 + 2.1.4 diff --git a/app/controllers/course_offerings_controller.rb b/app/controllers/course_offerings_controller.rb index 5376e87c..150ce761 100644 --- a/app/controllers/course_offerings_controller.rb +++ b/app/controllers/course_offerings_controller.rb @@ -1,5 +1,5 @@ class CourseOfferingsController < ApplicationController - before_filter :rename_course_offering_id_param + before_action :rename_course_offering_id_param load_and_authorize_resource @@ -154,7 +154,7 @@ def enroll if @course_offering && !already_enrolled && (can_enroll || enrollee_manages_course || current_user_manages_course) - + co = CourseEnrollment.new( course_offering: @course_offering, @@ -187,8 +187,8 @@ def enroll end else message = "Could not enroll #{@user.display_name} in #{@course_offering.display_name_with_term} because" - reasons = "#{errors.to_sentence}." - message = "#{message} #{reasons}" + reasons = "#{errors.to_sentence}." + message = "#{message} #{reasons}" respond_to do |format| format.html { flash[:warning] = 'Unable to enroll in that course.' diff --git a/app/controllers/exercises_controller.rb b/app/controllers/exercises_controller.rb index 06921085..7a7f6543 100644 --- a/app/controllers/exercises_controller.rb +++ b/app/controllers/exercises_controller.rb @@ -4,9 +4,8 @@ class ExercisesController < ApplicationController require 'zip' require 'tempfile' - load_and_authorize_resource - skip_authorize_resource only: [:practice, :call_open_pop] + skip_authorize_resource only: [:practice, :call_open_pop, :export] #~ Action methods ........................................................... after_action :allow_iframe, only: [:practice, :embed] @@ -27,6 +26,38 @@ def index end + # ------------------------------------------------------------- + # The export function gets all exercises metadata for SPLICE + # GET /gym/exercises/export + def export + # filter out stop/connector words for keywords from workout phrases or names + stop_words = ['the', 'and', 'a', 'to', 'of', 'in', 'for', 'on', 'with', 'as', 'by', 'at', 'from', 'is', 'that', 'which', 'it', 'an', 'be', 'this', 'are', 'we', 'can', 'if', 'has', 'but'] + @exercises = Exercise.all + export_data = @exercises.map do |exercise| + workout_names = exercise.exercise_workouts.map { |ew| ew.workout.name }.uniq.push(exercise.name) + # split phrases and remove any stop/connector words + keywords_array = workout_names.map { |phrase| phrase.downcase.split(/\W+/) }.flatten.uniq.reject { |word| stop_words.include?(word) || word.empty? } + + { + "catalog_type": "SLCItemCatalog", + "platform_name": "CodeWorkout", + "url": "https://codeworkout.cs.vt.edu", + "lti_instructions_url": "https://opendsa-server.cs.vt.edu/guides/opendsa-canvas", + "exercise_type": Exercise::TYPE_NAMES[exercise.question_type], + "license": "Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)", + "description": exercise.exercise_collection&.description, # Safely fetching description + "author": "Stephen Edwards", + "institution": "Virginia Tech", + "keywords": keywords_array, + "exercise_name": exercise.name, + "iframe_url": exercise.iframe_url, + "lti_url": exercise.lti_launch_url + } + end + render json: export_data + end + + # ------------------------------------------------------------- # GET /exercises/download.csv def download @@ -134,7 +165,7 @@ def new # ------------------------------------------------------------- # GET /exercises/1/edit def edit - puts "ResourceFile.UPLOAD_PATH = #{ResourceFile::UPLOAD_PATH}" + logger.debug "ResourceFile.UPLOAD_PATH = #{ResourceFile::UPLOAD_PATH}" @exercise_version = @exercise.current_version @attached_files = [] @exercise_version.ownerships.each do |e| @@ -170,6 +201,7 @@ def edit # ------------------------------------------------------------- # POST /exercises def create + # REMOVE? ex = Exercise.new exercise_version = ExerciseVersion.new(exercise: ex) msg = params[:exercise] || params[:coding_question] @@ -244,6 +276,7 @@ def random_exercise # ------------------------------------------------------------- # POST exercises/create_mcqs def create_mcqs + # REMOVE CSV.foreach(params[:form].fetch(:mcqfile).path, {headers: true}) do |row| if row['Question'].include?('Python') next @@ -258,22 +291,26 @@ def create_mcqs # ------------------------------------------------------------- # GET exercises/upload_mcqs def upload_mcqs + # REMOVE end # ------------------------------------------------------------- # GET exercises/upload_exercises def upload + # REMOVE end # ------------------------------------------------------------- def upload_yaml + # REMOVE end # ------------------------------------------------------------- def yaml_create + # REMOVE @yaml_exers = YAML.load_file(params[:form].fetch(:yamlfile).path) @yaml_exers.each do |exercise| @ex = Exercise.new @@ -336,18 +373,47 @@ def upload_create exercise_version_params = exercise_params[:exercise_version] use_rights = exercise_params[:exercise_collection_id].to_i text_representation = exercise_version_params['text_representation'] - hash = YAML.load(text_representation) else text_representation = File.read(params[:form][:file].path) + edit_rights = 0 # Personal exercise + end + error_msgs = [] + # FIXME: add support for JSON here as well + if text_representation.start_with?('---') hash = YAML.load(text_representation) - use_rights = 0 # Personal exercise + else + logger.debug '==========' + logger.debug 'PEML Input' + logger.debug '==========' + logger.debug text_representation + hash = PemlParsingUtil.new.parse(text_representation, error_msgs) + logger.debug '==========' + logger.debug 'PEML Hash' + logger.debug '==========' + logger.debug hash.to_yaml + logger.debug '==========' + + if !error_msgs.empty? + raw_msgs = error_msgs + error_msgs = [] + error_msgs << "Errors while parsing PEML for exercise #{hash['name']}:" + end + end if !hash.kind_of?(Array) hash = [hash] end files = exercise_params[:files] - puts "files = #{files.inspect}" + fileList = exercise_params[:fileList] + if fileList != "" && !files.nil? + files = cleanFile(files,fileList) + end + logger.debug "files = #{files.inspect}" @attached_files = exercise_params[:attached_files] if @attached_files == "null" @attached_files = nil @@ -355,7 +421,7 @@ def upload_create if @attached_files @attached_files = JSON.parse(@attached_files) end - puts "attached files = #{@attached_files.inspect}" + logger.debug "attached files = #{@attached_files.inspect}" # figure out if we need to add this to an exercise collection exercise_collection = nil @@ -384,82 +450,85 @@ def upload_create # parse the text_representation exercises = ExerciseRepresenter.for_collection.new([]).from_hash(hash) - success_all = true - error_msgs = [] + success_all = error_msgs.empty? success_msgs = [] - exercises.each do |e| - if !e.save - success_all = false - # put together an error message - error_msgs << "Errors while saving exercise #{e.andand.name}:" - else # successfully created the exercise - ex_ver = e.current_version - - # make the current user an exercise owner if they aren't already - e.add_owner!(current_user) - - # copy all retained resource files, skipping any to be removed - prev_version = e.exercise_versions.offset(1).first - if prev_version - puts "processing ownerships from prev version #{prev_version.id}" - prev_version.ownerships.each do |o| - puts "checking ownership #{o.inspect}" - # Double-loop isn't the greatest design, but both lists are short - @attached_files.each do |a| - puts "checking against attachment #{a.inspect}" - # uploaded flag is true if it was previously uploaded - # deleted flag is true if it is to be pruned/removed from exercise - if a['name'] == o.filename && a['uploaded'] && !a['deleted'] - puts "adding ownership record" - ownertable = ex_ver.ownerships.create!( - filename: o.filename, - resource_file: o.resource_file) + successful_exercise = nil + if success_all + exercises.each do |e| + if !e.save + success_all = false + # put together an error message + error_msgs << "Errors while saving exercise #{e.andand.name}:" + else # successfully created the exercise + successful_exercise ||= e + ex_ver = e.current_version + + # make the current user an exercise owner if they aren't already + e.add_owner!(current_user) + + # copy all retained resource files, skipping any to be removed + prev_version = e.exercise_versions.offset(1).first + if prev_version + logger.debug "processing ownerships from prev version #{prev_version.id}" + prev_version.ownerships.each do |o| + logger.debug "checking ownership #{o.inspect}" + # Double-loop isn't the greatest design, but both lists are short + @attached_files.each do |a| + logger.debug "checking against attachment #{a.inspect}" + # uploaded flag is true if it was previously uploaded + # deleted flag is true if it is to be pruned/removed from exercise + if a['name'] == o.filename && a['uploaded'] && !a['deleted'] + logger.debug "adding ownership record" + ownertable = ex_ver.ownerships.create!( + filename: o.filename, + resource_file: o.resource_file) + end end end end - end - # Now add all newly uploaded attached files - if files - files.each do |file| - puts "processing new upload #{file.inspect}" - @attached_files.each do |a| - puts "checking against attachment #{a.inspect}" - if a['name'] == file.original_filename && !a['uploaded'] && !a['deleted'] - Ownership.create!( - filename: file.original_filename, - exercise_version: ex_ver, - resource_file: ResourceFile.for_upload(file, current_user) - ) + # Now add all newly uploaded attached files + if files + files.each do |file| + logger.debug "processing new upload #{file.inspect}" + @attached_files.each do |a| + logger.debug "checking against attachment #{a.inspect}" + if a['name'] == file.original_filename && !a['uploaded'] && !a['deleted'] + Ownership.create!( + filename: file.original_filename, + exercise_version: ex_ver, + resource_file: ResourceFile.for_upload(file, current_user) + ) + end end end end - end - # Add exercise to collection - exercise_collection.andand.add(e, override: true) + # Add exercise to collection + exercise_collection.andand.add(e, override: true) - # Update the text representation - e.current_version.update(text_representation: text_representation) + # Update the text representation + e.current_version.update(text_representation: text_representation) - # Notify user of success - success_msgs << - "
  • X#{e.id}: #{e.name} saved, try it #{view_context.link_to 'here', exercise_practice_path(e)}.
  • " + # Notify user of success + success_msgs << + "
  • X#{e.id}: #{e.name} saved
  • " + end end end if success_all success_msgs = '' - redirect_to @return_to, flash: { success: success_msgs.html_safe } and return + redirect_to exercise_practice_path(successful_exercise), flash: { success: success_msgs.html_safe } and return else if !success_msgs.blank? - error_msgs << 'Some exercises were successfully saved.' + error_msgs << 'Some exercises were successfully saved.' error_msgs << '' end - redirect_to @return_to, flash: { error: error_msgs.join("").html_safe } and return + redirect_back fallback_location: @return_to, flash: { error: error_msgs.join("").html_safe } and return end end @@ -895,7 +964,7 @@ def evaluate if exercise_prompt_answer.save CodeWorker.new.async.perform(@attempt.id) else - puts 'IMPROPER PROMPT', + logger.error 'IMPROPER PROMPT', 'unable to save prompt_answer: ' \ "#{prompt_answer.errors.full_messages.to_s}", 'IMPROPER PROMPT' @@ -1032,7 +1101,6 @@ def create_new_version return newexercise end - # ------------------------------------------------------------- # Only allow a trusted parameter "white list" through. def exercise_params diff --git a/app/controllers/help_controller.rb b/app/controllers/help_controller.rb index 2dd68eb9..41bc3450 100644 --- a/app/controllers/help_controller.rb +++ b/app/controllers/help_controller.rb @@ -10,4 +10,7 @@ def exercise_format def lti_configuration end + def exercise_peml_format + end + end diff --git a/app/controllers/upload_roster_controller.rb b/app/controllers/upload_roster_controller.rb index 63c4d248..0b454d08 100644 --- a/app/controllers/upload_roster_controller.rb +++ b/app/controllers/upload_roster_controller.rb @@ -1,5 +1,5 @@ class UploadRosterController < ApplicationController - before_filter :authenticate_user! + before_action :authenticate_user! load_and_authorize_resource :course_offering diff --git a/app/controllers/workout_offerings_controller.rb b/app/controllers/workout_offerings_controller.rb index 901f5424..173110d3 100644 --- a/app/controllers/workout_offerings_controller.rb +++ b/app/controllers/workout_offerings_controller.rb @@ -1,8 +1,8 @@ class WorkoutOfferingsController < ApplicationController - skip_before_filter :authenticate_user!, :only => :practice + # Isn't this handled by authorize_resource already? + # skip_before_action :authenticate_user!, :only => :practice load_and_authorize_resource - skip_authorize_resource :only => :practice #~ Action methods ........................................................... diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index a875446a..7ca80ee0 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -236,7 +236,8 @@ def button_to_with_style( puts "html_options = #{html_options}" button_to_without_style(name, options, html_options, &block) end - alias_method_chain :button_to, :style + alias_method :button_to_without_style, :button_to + alias_method :button_to, :button_to_with_style # ------------------------------------------------------------- diff --git a/app/jobs/application_job.rb b/app/jobs/application_job.rb new file mode 100644 index 00000000..a009ace5 --- /dev/null +++ b/app/jobs/application_job.rb @@ -0,0 +1,2 @@ +class ApplicationJob < ActiveJob::Base +end diff --git a/app/models/ability.rb b/app/models/ability.rb index deb48978..8fff2ae4 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -210,12 +210,12 @@ def process_exercises(user) can :practice, Exercise do |e| now = Time.now - e.visible_to?(user) || WorkoutOffering. - joins{workout.exercises}.joins{course_offering.course_enrollments}. - where{ - ((starts_on == nil) | (starts_on <= now)) & - course_offering.course_enrollments.user_id == user.id - }.any? + e.visible_to?(user) || WorkoutOffering + .joins(workout: :exercises, course_offering: [:course_enrollments, :term]) + .where( + '(terms.starts_on is ? or terms.starts_on <= ?) and + course_enrollments.user_id = ?', nil, now, now + ).any? end can [ :gym_practice, :embed ], Exercise do |e| @@ -224,13 +224,13 @@ def process_exercises(user) can :evaluate, Exercise do |e| now = Time.now - WorkoutOffering. - joins{workout.exercises}.joins{course_offering.course_enrollments}. - where{ - ((starts_on == nil) | (starts_on <= now)) & - ((hard_deadline >= now) | (soft_deadline >= now)) & - course_offering.course_enrollments.user_id == user.id - }.any? + WorkoutOffering + .joins(workout: :exercises, course_offering: [:course_enrollments, :term]) + .where( + '(terms.starts_on is ? or terms.starts_on <= ?) + and (workout_offerings.hard_deadline >= ? or workout_offerings.soft_deadline >= ?) + and course_enrollments.user_id = ?', nil, now, now, now, user.id + ).any? end # can :create, Exercise if user.global_role.is_instructor? diff --git a/app/models/application_record.rb b/app/models/application_record.rb new file mode 100644 index 00000000..10a4cba8 --- /dev/null +++ b/app/models/application_record.rb @@ -0,0 +1,3 @@ +class ApplicationRecord < ActiveRecord::Base + self.abstract_class = true +end diff --git a/app/models/attempt.rb b/app/models/attempt.rb index 5f8f5061..650144c4 100644 --- a/app/models/attempt.rb +++ b/app/models/attempt.rb @@ -67,7 +67,7 @@ # active_score relation ... and that non-nil active_score should be the # same as its workout_score relation. # -class Attempt < ActiveRecord::Base +class Attempt < ApplicationRecord #~ Relationships ............................................................ diff --git a/app/models/choice.rb b/app/models/choice.rb index 3837b6c9..826aff62 100644 --- a/app/models/choice.rb +++ b/app/models/choice.rb @@ -38,7 +38,7 @@ # have a non-zero value indicating the partial credit awarded for that single # choice. # -class Choice < ActiveRecord::Base +class Choice < ApplicationRecord #~ Relationships ............................................................ diff --git a/app/models/coding_prompt.rb b/app/models/coding_prompt.rb index 60fc6d23..265af942 100644 --- a/app/models/coding_prompt.rb +++ b/app/models/coding_prompt.rb @@ -22,7 +22,7 @@ # acts_as (see the documentation on-line for the activerecord-acts_as # gem). # -class CodingPrompt < ActiveRecord::Base +class CodingPrompt < ApplicationRecord #~ Relationships ............................................................ diff --git a/app/models/coding_prompt_answer.rb b/app/models/coding_prompt_answer.rb index c4314412..04e1f101 100644 --- a/app/models/coding_prompt_answer.rb +++ b/app/models/coding_prompt_answer.rb @@ -14,7 +14,7 @@ # PromptAnswer via acts_as (see the documentation on-line for the # activerecord-acts_as gem). # -class CodingPromptAnswer < ActiveRecord::Base +class CodingPromptAnswer < ApplicationRecord #~ Relationships ............................................................ diff --git a/app/models/course.rb b/app/models/course.rb index 36e894b6..c4e76f4e 100644 --- a/app/models/course.rb +++ b/app/models/course.rb @@ -29,7 +29,7 @@ # description. A course may have one or more course offerings in any # specific term. # -class Course < ActiveRecord::Base +class Course < ApplicationRecord extend FriendlyId friendly_id :number_without_spaces, use: [:history, :scoped], scope: :organization diff --git a/app/models/course_enrollment.rb b/app/models/course_enrollment.rb index 177215d5..aeaef29a 100644 --- a/app/models/course_enrollment.rb +++ b/app/models/course_enrollment.rb @@ -26,7 +26,7 @@ # indicating each user's role with respect to the course offerings in which # they are enrolled. # -class CourseEnrollment < ActiveRecord::Base +class CourseEnrollment < ApplicationRecord #~ Relationships ............................................................ diff --git a/app/models/course_exercise.rb b/app/models/course_exercise.rb index 1922648f..9f2ad604 100644 --- a/app/models/course_exercise.rb +++ b/app/models/course_exercise.rb @@ -25,7 +25,7 @@ # If we really need many-to-many, though, since right now, exercises can # only belong to one course? # -class CourseExercise < ActiveRecord::Base +class CourseExercise < ApplicationRecord #~ Relationships ............................................................ diff --git a/app/models/course_offering.rb b/app/models/course_offering.rb index cb58e56e..b7d48ab7 100644 --- a/app/models/course_offering.rb +++ b/app/models/course_offering.rb @@ -28,7 +28,7 @@ # ============================================================================= # Represents a single section (or offering) of a course in a specific term. # -class CourseOffering < ActiveRecord::Base +class CourseOffering < ApplicationRecord #~ Relationships ............................................................ diff --git a/app/models/course_role.rb b/app/models/course_role.rb index ef9f03c2..36fb5165 100644 --- a/app/models/course_role.rb +++ b/app/models/course_role.rb @@ -15,7 +15,7 @@ # Represents the role a user has with respect to a course offering in which # the user is enrolled. Roles are stored in the CourseEnrollment relationship. # -class CourseRole < ActiveRecord::Base +class CourseRole < ApplicationRecord #~ Validation ............................................................... diff --git a/app/models/error.rb b/app/models/error.rb index 097fa9ea..89d9d96d 100644 --- a/app/models/error.rb +++ b/app/models/error.rb @@ -26,6 +26,6 @@ # This model class is here purely so that run-time errors can be tracked # in the database for development/debugging purposes. # -class Error < ActiveRecord::Base -# belongs_to :usable, polymorphic: true -end +class Error < ApplicationRecord +# belongs_to :usable, polymorphic: true +end diff --git a/app/models/exercise.rb b/app/models/exercise.rb index ee202140..b6dff0a9 100644 --- a/app/models/exercise.rb +++ b/app/models/exercise.rb @@ -48,7 +48,7 @@ # in effect when they gave their answer. New users seeing an exercise # for the first time always see the newest version. # -class Exercise < ActiveRecord::Base +class Exercise < ApplicationRecord #~ Relationships ............................................................ @@ -105,10 +105,10 @@ class Exercise < ActiveRecord::Base 'C++' => 'cpp' } - scope :visible_through_user, -> (u) { joins{exercise_owners.outer}.joins{exercise_collection.outer}. where{ (exercise_owners.owner == u) | (exercise_collection.user == u) } } + attr_accessor :iframe_url # to get values to define in iframe url function for SPLICE #~ Class methods ............................................................ @@ -131,17 +131,22 @@ def self.search(terms, user = nil) else visible = Exercise.publicly_visible end - + result = visible.tagged_with(terms, any: true, wild: true, on: :tags) .union(visible.tagged_with(terms, any: true, wild: true, on: :languages)) - .union(visible.tagged_with(terms, any: true, wild: true, on: :styles)) + .union(visible.tagged_with(terms, any: true, wild: true, on: :styles)) .union(visible.where('(name regexp (?)) or (exercises.id in (?))', r, ids)) .distinct return result end + def self.visible_through_user(user) + return Exercise.left_outer_joins(:exercise_owners) + .left_outer_joins(:exercise_collection) + .where('exercise_owners.owner_id = ? or exercise_collections.user_id = ?', + user.id, user.id) + end - # ------------------------------------------------------------- # Get a list of Exercises that are visible to the specified user. # # It is the union of exercises that are publicly visible, created or owned by the user, @@ -167,9 +172,9 @@ def self.visible_to_user(user) visible_through_user_group = Exercise.visible_through_user_group(user) return visible_through_user - .union(publicly_visible) + .union(Exercise.publicly_visible) .union(visible_through_course_offering) - .union(visible_through_user_group) + .union(Exercise.visible_through_user_group(user)) end @@ -182,15 +187,32 @@ def self.visible_to_user(user) def self.publicly_visible public_license = Exercise.joins( exercise_collection: [ license: :license_policy ]) - .where(is_public: nil, exercise_collection: - { license: - { license_policy: - { is_public: true } } } - ) + .where('exercises.is_public is null and license_policies.is_public = true') + # .where(is_public: nil, exercise_collection: + # { license: + # { license_policy: + # { is_public: true } } } + # ) - public_exercise = Exercise.where(is_public: true) + public_exercises = Exercise.where(is_public: true) - return public_exercise.union(public_license) + return public_exercises.union(public_license) + end + + + # the iframeurl, iframe-embedcode and ltilaunch is to display and export each exercises information for SPLICE + def iframe_url + base_url = "https://codeworkoutdev.cs.vt.edu" # to be dynamically fetched maybe from a config file + "#{base_url}/gym/exercises/#{self.id}/practice" + end + + def iframe_embed_code + "" + end + + def lti_launch_url + base_url = "https://codeworkoutdev.cs.vt.edu" # to be fetched dynamically + "#{base_url}/lti/launch/gym/exercises/#{self.id}/practice" end @@ -281,7 +303,7 @@ def latest_attempt_for(u) end # Does the user have privileged access to this exercise, either - # by owning the exercise or having access to its + # by owning the exercise or having access to its # exercise_collection? def can_be_assigned_by?(u) return self.owned_by?(u) || @@ -321,7 +343,7 @@ def is_publicly_available? end end - def self.progsnap2_attempt_csv(exercise_id, course_id=nil, term_id=nil) + def self.progsnap2_attempt_csv(exercise_id, course_id=nil, term_id=nil) denormalized = Exercise.denormalized_attempt_data(exercise_id, course_id, term_id) main_events = Exercise.progsnap2_main_events_csv(denormalized) code_states = Exercise.progsnap2_code_states_csv(denormalized) @@ -375,7 +397,7 @@ def self.denormalized_attempt_data(exercise_id=nil, course_id=nil, term_id=nil) 'a course id and term id.' end - course_filter = course_id ? + course_filter = course_id ? "AND courses.id = #{course_id}" : "" term_filter = term_id ? @@ -400,7 +422,7 @@ def self.denormalized_attempt_data(exercise_id=nil, course_id=nil, term_id=nil) .joins('LEFT JOIN courses ON courses.id = course_offerings.course_id') .joins('LEFT JOIN coding_prompt_answers ON prompt_answers.actable_id = coding_prompt_answers.id') - + if course_id result = result.where('courses.id = ?', course_id) end diff --git a/app/models/exercise_collection.rb b/app/models/exercise_collection.rb index e96de586..6d44e211 100644 --- a/app/models/exercise_collection.rb +++ b/app/models/exercise_collection.rb @@ -20,7 +20,7 @@ # index_exercise_collections_on_user_id (user_id) # -class ExerciseCollection < ActiveRecord::Base +class ExerciseCollection < ApplicationRecord belongs_to :user_group, inverse_of: :exercise_collection belongs_to :user belongs_to :license diff --git a/app/models/exercise_family.rb b/app/models/exercise_family.rb index 503e0a77..28467d15 100644 --- a/app/models/exercise_family.rb +++ b/app/models/exercise_family.rb @@ -21,7 +21,7 @@ # reflect the "closely related" nature of these variants of the same # question--they are different Exercises, but in the same family. # -class ExerciseFamily < ActiveRecord::Base +class ExerciseFamily < ApplicationRecord #~ Relationships ............................................................ diff --git a/app/models/exercise_owner.rb b/app/models/exercise_owner.rb index a9c8fd03..19405c1f 100644 --- a/app/models/exercise_owner.rb +++ b/app/models/exercise_owner.rb @@ -22,7 +22,7 @@ # purpose of managing editing access to exercises, particularly "private" # exercises that are not publicly available in the gym. # -class ExerciseOwner < ActiveRecord::Base +class ExerciseOwner < ApplicationRecord #~ Relationships ............................................................ diff --git a/app/models/exercise_version.rb b/app/models/exercise_version.rb index e305c7df..06c41b81 100644 --- a/app/models/exercise_version.rb +++ b/app/models/exercise_version.rb @@ -31,7 +31,7 @@ # Represents one version of an exercise--a single snapshot in the exercise's # entire edit history. # -class ExerciseVersion < ActiveRecord::Base +class ExerciseVersion < ApplicationRecord #~ Accessor attr_accessor :answer_code diff --git a/app/models/exercise_workout.rb b/app/models/exercise_workout.rb index 57ca7b34..dc2a36b7 100644 --- a/app/models/exercise_workout.rb +++ b/app/models/exercise_workout.rb @@ -26,7 +26,7 @@ # indicating which exercises are included in a given workout, and in # what order. The order is determined by "position", which starts at 1. # -class ExerciseWorkout < ActiveRecord::Base +class ExerciseWorkout < ApplicationRecord #~ Relationships ............................................................ diff --git a/app/models/global_role.rb b/app/models/global_role.rb index 0f62f54b..b459040b 100644 --- a/app/models/global_role.rb +++ b/app/models/global_role.rb @@ -13,7 +13,7 @@ # Represents a user's global permissions on the system. This has now # degenerated into what ammounts to a global "administrator" flag. # -class GlobalRole < ActiveRecord::Base +class GlobalRole < ApplicationRecord #~ Validation ............................................................... diff --git a/app/models/group_access_request.rb b/app/models/group_access_request.rb index f003105d..5c6806dd 100644 --- a/app/models/group_access_request.rb +++ b/app/models/group_access_request.rb @@ -16,7 +16,7 @@ # index_group_access_requests_on_user_id (user_id) # -class GroupAccessRequest < ActiveRecord::Base +class GroupAccessRequest < ApplicationRecord belongs_to :user belongs_to :user_group end diff --git a/app/models/identity.rb b/app/models/identity.rb index 3caa7516..2ec4f306 100644 --- a/app/models/identity.rb +++ b/app/models/identity.rb @@ -24,7 +24,7 @@ # authentication provider. A single user object may be associated with # multiple identities, each from a separate provider. # -class Identity < ActiveRecord::Base +class Identity < ApplicationRecord #~ Relationships ............................................................ diff --git a/app/models/irt_data.rb b/app/models/irt_data.rb index 02674409..728123be 100644 --- a/app/models/irt_data.rb +++ b/app/models/irt_data.rb @@ -12,7 +12,7 @@ # ============================================================================= # Represents IRT data used for calculating exercise performance. # -class IRTData < ActiveRecord::Base +class IRTData < ApplicationRecord #~ Validation ............................................................... diff --git a/app/models/license.rb b/app/models/license.rb index 0efc6bf9..49cf0138 100644 --- a/app/models/license.rb +++ b/app/models/license.rb @@ -15,7 +15,7 @@ # index_licenses_on_license_policy_id (license_policy_id) # -class License < ActiveRecord::Base +class License < ApplicationRecord belongs_to :license_policy, inverse_of: :licenses has_many :exercise_collections end diff --git a/app/models/license_policy.rb b/app/models/license_policy.rb index af9b4e4d..423e759c 100644 --- a/app/models/license_policy.rb +++ b/app/models/license_policy.rb @@ -11,7 +11,7 @@ # updated_at :datetime # -class LicensePolicy < ActiveRecord::Base +class LicensePolicy < ApplicationRecord has_many :licenses, inverse_of: :license_policy accepts_nested_attributes_for :licenses end diff --git a/app/models/lms_instance.rb b/app/models/lms_instance.rb index 0e683df5..9532bcdc 100644 --- a/app/models/lms_instance.rb +++ b/app/models/lms_instance.rb @@ -22,7 +22,7 @@ # lms_instances_lms_type_id_fk (lms_type_id => lms_types.id) # -class LmsInstance < ActiveRecord::Base +class LmsInstance < ApplicationRecord belongs_to :lms_type, inverse_of: :lms_instances belongs_to :organization has_many :course_offerings, inverse_of: :lms_instance diff --git a/app/models/lms_type.rb b/app/models/lms_type.rb index 06306d21..654216fe 100644 --- a/app/models/lms_type.rb +++ b/app/models/lms_type.rb @@ -12,7 +12,7 @@ # index_lms_types_on_name (name) UNIQUE # -class LmsType < ActiveRecord::Base +class LmsType < ApplicationRecord #~ Relationships ............................................................ has_many :lms_instances, inverse_of: :lms_types diff --git a/app/models/lti_identity.rb b/app/models/lti_identity.rb index 9073342c..98942069 100644 --- a/app/models/lti_identity.rb +++ b/app/models/lti_identity.rb @@ -16,7 +16,7 @@ # index_lti_identities_on_user_id (user_id) # -class LtiIdentity < ActiveRecord::Base +class LtiIdentity < ApplicationRecord belongs_to :user belongs_to :lms_instance end diff --git a/app/models/lti_workout.rb b/app/models/lti_workout.rb index 45696c09..4c6c2e36 100644 --- a/app/models/lti_workout.rb +++ b/app/models/lti_workout.rb @@ -19,7 +19,7 @@ # fk_rails_... (lms_instance_id => lms_instances.id) # -class LtiWorkout < ActiveRecord::Base +class LtiWorkout < ApplicationRecord belongs_to :workout belongs_to :lms_instance has_many :workout_scores diff --git a/app/models/membership.rb b/app/models/membership.rb index 22cf5a10..124d7807 100644 --- a/app/models/membership.rb +++ b/app/models/membership.rb @@ -9,7 +9,7 @@ # updated_at :datetime # -class Membership < ActiveRecord::Base +class Membership < ApplicationRecord belongs_to :user belongs_to :user_group end diff --git a/app/models/multiple_choice_prompt.rb b/app/models/multiple_choice_prompt.rb index b7703e7d..9d7f95e7 100644 --- a/app/models/multiple_choice_prompt.rb +++ b/app/models/multiple_choice_prompt.rb @@ -18,7 +18,7 @@ # One multiple-choice prompt includes one or more choices, which are # represented at different objects. # -class MultipleChoicePrompt < ActiveRecord::Base +class MultipleChoicePrompt < ApplicationRecord #~ Relationships ............................................................ diff --git a/app/models/multiple_choice_prompt_answer.rb b/app/models/multiple_choice_prompt_answer.rb index 9245cf87..e615f276 100644 --- a/app/models/multiple_choice_prompt_answer.rb +++ b/app/models/multiple_choice_prompt_answer.rb @@ -11,7 +11,7 @@ # PromptAnswer via acts_as (see the documentation on-line for the # activerecord-acts_as gem). # -class MultipleChoicePromptAnswer < ActiveRecord::Base +class MultipleChoicePromptAnswer < ApplicationRecord #~ Relationships ............................................................ diff --git a/app/models/organization.rb b/app/models/organization.rb index bff8e4c0..ead3ba37 100644 --- a/app/models/organization.rb +++ b/app/models/organization.rb @@ -19,7 +19,7 @@ # Represents a university, college, school, or other organization that # has courses. # -class Organization < ActiveRecord::Base +class Organization < ApplicationRecord extend FriendlyId friendly_id :abbreviation, use: :history diff --git a/app/models/prompt.rb b/app/models/prompt.rb index b82eb271..649cd410 100644 --- a/app/models/prompt.rb +++ b/app/models/prompt.rb @@ -45,7 +45,7 @@ # # Prompts are ordered by "position", which starts at 1. # -class Prompt < ActiveRecord::Base +class Prompt < ApplicationRecord #~ Relationships ............................................................ diff --git a/app/models/prompt_answer.rb b/app/models/prompt_answer.rb index 2933b1ef..1ae97f4f 100644 --- a/app/models/prompt_answer.rb +++ b/app/models/prompt_answer.rb @@ -35,7 +35,7 @@ # A prompt answer represents a user's answer for one prompt in one attempt # at an exercise. # -class PromptAnswer < ActiveRecord::Base +class PromptAnswer < ApplicationRecord #~ Relationships ............................................................ diff --git a/app/models/resource_file.rb b/app/models/resource_file.rb index 9945d278..818c54d6 100644 --- a/app/models/resource_file.rb +++ b/app/models/resource_file.rb @@ -26,7 +26,7 @@ # Represents a file uploaded by a user for use in exercises, such as an # image or video file. # -class ResourceFile < ActiveRecord::Base +class ResourceFile < ApplicationRecord include Tokenable #for unique non-serial url tokens diff --git a/app/models/stem.rb b/app/models/stem.rb index e2d29e95..9fffc26e 100644 --- a/app/models/stem.rb +++ b/app/models/stem.rb @@ -26,7 +26,7 @@ # ExerciseVersions on the same edit history for one exercise may refer # to the same stem, if the stem was not edited. # -class Stem < ActiveRecord::Base +class Stem < ApplicationRecord #~ Relationships ............................................................ diff --git a/app/models/student_extension.rb b/app/models/student_extension.rb index 5d929a9b..9103cbc3 100644 --- a/app/models/student_extension.rb +++ b/app/models/student_extension.rb @@ -23,7 +23,7 @@ # student_extensions_workout_offering_id_fk (workout_offering_id => workout_offerings.id) # -class StudentExtension < ActiveRecord::Base +class StudentExtension < ApplicationRecord belongs_to :user belongs_to :workout_offering diff --git a/app/models/tag_user_score.rb b/app/models/tag_user_score.rb index 060a0a73..d4d9fb45 100644 --- a/app/models/tag_user_score.rb +++ b/app/models/tag_user_score.rb @@ -21,7 +21,7 @@ # ============================================================================= # Represents a user's xp score for a given tag. # -class TagUserScore < ActiveRecord::Base +class TagUserScore < ApplicationRecord #~ Relationships ............................................................ diff --git a/app/models/term.rb b/app/models/term.rb index d6bbb5b5..828bb806 100644 --- a/app/models/term.rb +++ b/app/models/term.rb @@ -21,7 +21,7 @@ # Represents an academic term or semester, which indicates the time period # for one or more course offerings. # -class Term < ActiveRecord::Base +class Term < ApplicationRecord extend FriendlyId friendly_id :display_name, use: :history diff --git a/app/models/test_case.rb b/app/models/test_case.rb index 02a19998..149b2d27 100644 --- a/app/models/test_case.rb +++ b/app/models/test_case.rb @@ -27,7 +27,7 @@ # Represents a test case used to evaluate a student's answer to a coding # prompt. # -class TestCase < ActiveRecord::Base +class TestCase < ApplicationRecord #~ Relationships ............................................................ diff --git a/app/models/test_case_result.rb b/app/models/test_case_result.rb index 1e54fb46..8eb63416 100644 --- a/app/models/test_case_result.rb +++ b/app/models/test_case_result.rb @@ -28,7 +28,7 @@ # ============================================================================= # Represents the outcome of a test case on a coding prompt. # -class TestCaseResult < ActiveRecord::Base +class TestCaseResult < ApplicationRecord #~ Relationships ............................................................ diff --git a/app/models/time_zone.rb b/app/models/time_zone.rb index 34f20067..3fccef29 100644 --- a/app/models/time_zone.rb +++ b/app/models/time_zone.rb @@ -10,7 +10,7 @@ # updated_at :datetime # -class TimeZone < ActiveRecord::Base +class TimeZone < ApplicationRecord has_many :users def to_s return display_as diff --git a/app/models/user.rb b/app/models/user.rb index 19d25d5e..cd04faf6 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -46,7 +46,7 @@ # ============================================================================= # Represents a single user account on the system. # -class User < ActiveRecord::Base +class User < ApplicationRecord include Gravtastic gravtastic secure: true, default: 'monsterid' @@ -113,7 +113,7 @@ class User < ActiveRecord::Base } scope :alphabetical, -> { order('last_name asc, first_name asc, email asc') } - scope :visible_to_user, -> (u) { joins{course_enrollments.outer}. + scope :visible_to_user, -> (u) { left_outer_joins(:course_enrollments) where{ (id == u.id) | (course_enrollments.course_role_id != CourseRole::STUDENT_ID) } } @@ -230,23 +230,21 @@ def managed_course_offerings(options = {}) course_enrollments.where(course_roles: { can_manage_course: true }). map(&:course_offering) elsif course.nil? - course_enrollments.joins(:course_offering). - where(course_roles: - { can_manage_course: true }, course_offering: - { term: term } - ).map(&:course_offering) + course_enrollments.joins(:course_offering) + .where('course_roles.can_manage_course = true and + course_offerings.term_id = ?', term.id) + .map(&:course_offering) elsif term.nil? - course_enrollments.joins(:course_offering). - where(course_roles: - { can_manage_course: true }, course_offering: - { course: course } - ).map(&:course_offering) + course_enrollments.joins(:course_offering) + .where('course_roles.can_manage_course = true and + course_offerings.course_id = ?', course.id) + .map(&:course_offering) else - course_enrollments.joins(:course_offering). - where(course_roles: - { can_manage_course: true }, course_offering: - { course: course, term: term } - ).map(&:course_offering) + course_enrollments.joins(:course_offering) + .where('course_roles.can_manage_course = true and + course_offerings.course_id = ? and course_offerings.term_id = ?', + course.id, term.id) + .map(&:course_offering) end end @@ -295,8 +293,7 @@ def managed_workout_offerings_in_term(workout, course, term) enrollments.map { |e| if workout.kind_of?(String) workouts_with_name = Workout.where('lower(name) = ?', workout) - e.course_offering.workout_offerings.where{ - workout_id.in(workouts_with_name.select{id}) } + e.course_offering.workout_offerings.where('workout_id in ?', workouts_with_name.select(:id)) else e.course_offering.workout_offerings.where(workout: workout) end diff --git a/app/models/user_group.rb b/app/models/user_group.rb index 4c10e95a..55e307e2 100644 --- a/app/models/user_group.rb +++ b/app/models/user_group.rb @@ -9,7 +9,7 @@ # description :text(65535) # -class UserGroup < ActiveRecord::Base +class UserGroup < ApplicationRecord has_many :memberships has_many :users, through: :memberships has_many :group_access_requests, inverse_of: :user_group diff --git a/app/models/visualization_logging.rb b/app/models/visualization_logging.rb index 99b34151..ff0fd415 100644 --- a/app/models/visualization_logging.rb +++ b/app/models/visualization_logging.rb @@ -18,7 +18,7 @@ # index_visualization_loggings_on_workout_offering_id (workout_offering_id) # -class VisualizationLogging < ActiveRecord::Base +class VisualizationLogging < ApplicationRecord belongs_to :user belongs_to :exercise belongs_to :workout diff --git a/app/models/workout.rb b/app/models/workout.rb index ae667779..8c2d3622 100644 --- a/app/models/workout.rb +++ b/app/models/workout.rb @@ -39,7 +39,7 @@ # the "courses" associated with a workout are those for which course # offerings have been given workout offerings. # -class Workout < ActiveRecord::Base +class Workout < ApplicationRecord #~ Relationships ............................................................ acts_as_taggable_on :tags, :languages, :styles @@ -76,12 +76,13 @@ class Workout < ActiveRecord::Base #~ Hooks .................................................................... - scope :visible_to_user, -> (u) { where { (creator_id == u.id) | (is_public == true) } } # paginates_per 1 - #~ Class methods ............................................................ + def self.visible_to_user(user) + return Workout.where(creator_id: user.id).or(Workout.where(is_public: true)) + end #~ Instance methods ......................................................... @@ -358,7 +359,7 @@ def self.search(terms, user, course, searching_offerings) if user available_workouts = Workout.where( - id: (Workout.visible_to_user(user) + user.managed_workouts) + id: (Workout.visible_to_user(user).union(user.managed_workouts)) .map(&:id) ) diff --git a/app/models/workout_offering.rb b/app/models/workout_offering.rb index 94335690..8c0f4e5b 100644 --- a/app/models/workout_offering.rb +++ b/app/models/workout_offering.rb @@ -42,7 +42,7 @@ # due dates that control when the students in the corresponding course # offering can take the workout (and thus, when they must complete it). # -class WorkoutOffering < ActiveRecord::Base +class WorkoutOffering < ApplicationRecord #~ Relationships ............................................................ diff --git a/app/models/workout_owner.rb b/app/models/workout_owner.rb index 7e0037d9..213c3169 100644 --- a/app/models/workout_owner.rb +++ b/app/models/workout_owner.rb @@ -23,7 +23,7 @@ # purpose of managing editing access to workouts, particularly "private" # workouts that are not publicly available in the gym. # -class WorkoutOwner < ActiveRecord::Base +class WorkoutOwner < ApplicationRecord #~ Relationships ............................................................ diff --git a/app/models/workout_policy.rb b/app/models/workout_policy.rb index 0f80d5eb..3eed16b7 100644 --- a/app/models/workout_policy.rb +++ b/app/models/workout_policy.rb @@ -20,6 +20,6 @@ # updated_at :datetime # -class WorkoutPolicy < ActiveRecord::Base +class WorkoutPolicy < ApplicationRecord has_many :workout_offerings, inverse_of: :workout_policy, dependent: :nullify end diff --git a/app/models/workout_score.rb b/app/models/workout_score.rb index 0eed155e..d5a991c8 100644 --- a/app/models/workout_score.rb +++ b/app/models/workout_score.rb @@ -78,7 +78,7 @@ # offering, meaning a second workout offering of the same workout). # We want to support all of these situations. # -class WorkoutScore < ActiveRecord::Base +class WorkoutScore < ApplicationRecord #~ Relationships ............................................................ @@ -389,7 +389,7 @@ def retotal # Class method to find workout scores that were computed after # they were closed. Outputs a list of workout scores. def self.late(options={}) - WorkoutScore.joins{ workout_offering } + WorkoutScore.joins(:workout_offering) .joins('inner join student_extensions on student_extensions.workout_offering_id = workout_offerings.id and student_extensions.user_id = workout_scores.user_id') .where('workout_scores.last_attempted_at > @@ -414,7 +414,6 @@ def self.score_fix1 ws.attempts.joins{exercise_version}. where{(exercise_version.exercise_id == e.id)}. order('submit_time DESC').first - if a a.active_score = ws if !a.save diff --git a/app/utils/peml_parsing_util.rb b/app/utils/peml_parsing_util.rb new file mode 100644 index 00000000..9a58bd08 --- /dev/null +++ b/app/utils/peml_parsing_util.rb @@ -0,0 +1,236 @@ +require 'peml' +require 'dottie/ext' +require 'net/http' +require 'uri' + +class PemlParsingUtil + def parse (text_representation, error_msgs) + peml = Peml::Loader.new.load(text_representation).dottie! + error_msgs.concat(Peml::validate(peml)) + convert_peml(peml, error_msgs) + end + + # Convert the parsed peml hash into a hash corresponding to exercise data model + def convert_peml(hash, error_msgs) + hash = Dottie(hash) + #starting with three compulsory peml keys + new_hash = { + 'external_id' => hash['exercise_id'], + 'name' => hash['title'] + }.dottie! + content = hash['difficulty'] + new_hash['experience'] = content if content + content = hash['tags.topics'] + new_hash['tag_list'] = content.to_s if content + + # PEML does not have an is_public equivalent so we put this value + # under a key of the same name + # new_hash["is_public"] = hash["is_public"] + + # PEML is designed to handle programming assignments and 'code writing' + # is the equivalent in code-workout + new_hash['style_list'] = hash['tags.style'].to_s || 'code writing' + + prompt = { + 'position' => 1, + 'question' => hash['instructions'] + } + systems = hash['systems'] + if systems + system = systems.first + new_hash['language_list'] = system['language'] + # assets should be under the system, so try to grab them here first + Rails.logger.debug 'get_file_content(system[\'assets.code.starter\'])' + content = get_file_content(system['assets.code.starter']) + prompt['starter_code'] = content if content + Rails.logger.debug 'get_file_content(system[\'assets.code.wrapper\'])' + content = get_file_content(system['assets.code.wrapper']) + prompt['wrapper_code'] = content if content + Rails.logger.debug 'get_test_file_content(prompt, system[\'assets.test\'])' + get_test_file_content(prompt, system['assets.test']) + end + + new_hash['current_version'] = {} + new_hash['current_version.version'] = hash['version.id'] if hash['version.id'] + new_hash['current_version.creator'] = get_author_email(hash) + new_hash['current_version.prompts'] = [] + + #----------------------------------------------------------------------- + # PEML assets might be at the global level, if they apply to all + # systems, so fill in missing assets here + Rails.logger.debug 'assets:' + Rails.logger.debug hash['assets'].to_yaml + if !prompt['starter_code'] + Rails.logger.debug 'get_file_content(hash[\'assets.code.starter\'])' + prompt['starter_code'] = get_file_content(hash['assets.code.starter']) + end + if !prompt['wrapper_code'] + Rails.logger.debug 'get_file_content(hash[\'assets.code.wrapper\'])' + prompt['wrapper_code'] = get_file_content(hash['assets.code.wrapper']) + end + Rails.logger.debug 'get_test_file_content(prompt, hash[\'assets.test\'])' + get_test_file_content(prompt, hash['assets.test']) + # FIXME: give error if missing tests + #----------------------------------------------------------------------- + if !prompt['class_name'] + prompt['class_name'] = 'Answer' + end + if !prompt['method_name'] + prompt['method_name'] = 'answer' + end + + # Again, PEML is designed for coding problems and thus, 'coding_prompt' + new_hash['current_version.prompts'] << { 'coding_prompt' => prompt } + new_hash + end + + + #----------------------------------------------------------------------- + # Tries to find the email of the author from the given hash. + # + # First, it tries to find it in the 'author.email' key, then in the + # 'license.owner.email' key. If neither works and the 'authors' key + # exists, it takes the email from the first author. + # + # @param hash [Hash] the hash to search for the author's email + # @return [String, nil] the author's email if found, otherwise nil + def get_author_email(hash) + creator = hash['author.email'] || hash['license.owner.email'] + if !creator and hash.key?('authors') + creator = hash['authors[0].email'] + end + Rails.logger.debug "get_author_email() = '#{creator}'" + creator + end + + + #----------------------------------------------------------------------- + def get_test_file_content(prompt, files) + Rails.logger.debug '==========' + Rails.logger.debug 'get_test_file_content(prompt, files), prompt:' + Rails.logger.debug '==========' + Rails.logger.debug prompt.to_yaml + Rails.logger.debug '==========' + Rails.logger.debug 'get_test_file_content(prompt, files), files:' + Rails.logger.debug '==========' + Rails.logger.debug files.to_yaml + Rails.logger.debug files.inspect + if files and !prompt['tests'] + file = files['files'][0] + Rails.logger.debug '==========' + Rails.logger.debug 'get_test_file_content(prompt, files), file:' + Rails.logger.debug '==========' + Rails.logger.debug file.to_yaml + Rails.logger.debug file.inspect + file.dottie! + + # copy class and method names from file pattern properties, if present + class_name = file['pattern.class_name'] + prompt['class_name'] = class_name if class_name + method_name = file['pattern.method_name'] + prompt['method_name'] = method_name if method_name + + pattern_actual = file['pattern.actual'] || file['pattern_actual'] + + if !prompt['method_name'] && pattern_actual + Rails.logger.debug "pattern_actual = '#{pattern_actual}'" + # pattern.actual: subject.oneFinder({{nums}}) + method_name = pattern_actual.sub(/^.*subject\.(\w+)\(.*$/, '\1') + Rails.logger.debug "extracted method name = '#{method_name}'" + prompt['method_name'] = method_name if method_name + end + + # Extract file content + content = get_file_content(file) + + if content + # format: text/csv-unquoted + # Need to handle this + + # format: text/csv + # Need to handle this + # Drop first line of colum headers + content = content.lines[1..-1].join if content + + # Need to re-assemble straight CSV from either format + prompt['tests'] = content + end + end + Rails.logger.debug '==========' + Rails.logger.debug 'get_test_file_content(prompt, files) => prompt:' + Rails.logger.debug '==========' + Rails.logger.debug prompt.to_yaml + end + + #----------------------------------------------------------------------- + # Retrieves the content from the first file description in a PEML files + # array. + # + # - If the file content is a string and matches a URL pattern, it fetches + # the content from the URL. + # - If the file is a hash, it retrieves the 'content' key's value. + # + # Logs detailed information about the files and content retrieval process + # for debugging. + # + # @param files [Hash] A hash containing file information, expected to have + # a 'files' key. + # @return [String, nil] The content of the file, or nil if content cannot + # be retrieved. + def get_file_content(files) + content = nil + Rails.logger.debug '==========' + Rails.logger.debug 'get_file_content(files), files:' + Rails.logger.debug '==========' + Rails.logger.debug files.to_yaml + Rails.logger.debug files.inspect + file = files + if file and files['files'] + file = files['files'][0] + end + Rails.logger.debug '==========' + Rails.logger.debug 'get_file_content(files), file:' + Rails.logger.debug '==========' + Rails.logger.debug file.to_yaml + Rails.logger.debug file.inspect + if file.is_a? String + file.strip! + if file.sub!(/^url\((.*)\)$/, '\1') + uri = URI.parse(file) + if uri.is_a?(URI::HTTP) && !uri.host.nil? + content = Net::HTTP.get(uri) + end + else + # FIXME: is this an error? + content = file + end + + # FIXME: add error checking if URL not parsable/readable + elsif file.is_a? Hash + content = file['content'] + else + # FIXME: add error checking if not a hash + end + content + end + +# def get_content(asset_child) +# asset_collection = [] +# if asset_child.is_a? String +# begin +# uri = URI.parse(asset_child) +# if uri.is_a?(URI::HTTP) && !uri.host.nil? +# asset_collection << Net::HTTP.get(uri) +# end +# rescue URI::InvalidURIError +# # asset_collection << "" +# # FIXME: Needs error message generation +# end +# elsif asset_child.is_a? Array +# asset_child.each do |asset_file| +# asset_collection << asset_file["files"]["content"] +# end +# end +# asset_collection.join(',') +# end +end diff --git a/app/views/help/exercise_peml_format.haml b/app/views/help/exercise_peml_format.haml new file mode 100644 index 00000000..b1ba4ac3 --- /dev/null +++ b/app/views/help/exercise_peml_format.haml @@ -0,0 +1,11 @@ +%h1 PEML Format for Exercises + +%p + This page describes how to use PEML's + %a{ href: 'https://cssplice.github.io/peml/schemas/exercise.html#src' } data model + to describe assignments in CodeWorkout. PEML stands for Programming Exercise Markup + Language, and, as the name suggests, can be used to describe programming assignments + (PEML does not have support for multiple choice questions). PEML follows a key-value + structure with support for nested collections and dictionaries. The PEML data model + describes a set of required keys, a set of recommended keys, and certain optional keys. + Some of the keys are discussed in the following sections. \ No newline at end of file diff --git a/app/views/help/index.html.haml b/app/views/help/index.html.haml index 0f2c874c..bfc31590 100644 --- a/app/views/help/index.html.haml +++ b/app/views/help/index.html.haml @@ -4,6 +4,9 @@ %li %a{ href: '/help/exercise_format' } Format for defining exercises + %li + %a{ href: '/help/exercise_peml_format' } + [New] Format Exercises in PEML %li %a{ href: '/help/lti_configuration' } Configuration/setup for LTI connectivity in LMSes diff --git a/app/views/layouts/_flash.html.haml b/app/views/layouts/_flash.html.haml index ecd80db3..4d6fa16b 100644 --- a/app/views/layouts/_flash.html.haml +++ b/app/views/layouts/_flash.html.haml @@ -3,4 +3,7 @@ %div{ class: "alert #{flash_class_for(type)} fade in", role: 'alert' } %button.close{ data: { dismiss: 'alert'} } × = icon_tag_for(type) - = message + - if message && message.start_with?('<') + = raw message + - else + = message diff --git a/app/views/sse/_ajax_feedback.html.haml b/app/views/sse/_ajax_feedback.html.haml index 8ef06470..2e282830 100644 --- a/app/views/sse/_ajax_feedback.html.haml +++ b/app/views/sse/_ajax_feedback.html.haml @@ -51,7 +51,7 @@ %tbody - has_hidden = false - hidden_pass = true - - answer.test_case_results(true).each do |tcr| + - answer.test_case_results().each do |tcr| - if tcr.test_case.hidden? - has_hidden = true - hidden_pass = hidden_pass && tcr.pass @@ -86,7 +86,7 @@ %th.text-center Result %tbody - if examples.any? - - answer.test_case_results(true).each do |tcr| + - answer.test_case_results().each do |tcr| - if tcr.test_case.is_example? %tr %td diff --git a/app/views/sse/feedback_update.js.coffee b/app/views/sse/feedback_update.js.coffee index 481933cf..d327cc77 100644 --- a/app/views/sse/feedback_update.js.coffee +++ b/app/views/sse/feedback_update.js.coffee @@ -27,7 +27,7 @@ if attempt_error_line_no addLineWidget(editor, '<%= @attempt.prompt_answers.first.specific.error %>', attempt_error_line_no, 'error') -tcrs = <%= raw @attempt.prompt_answers.first.specific.test_case_results(true). +tcrs = <%= raw @attempt.prompt_answers.first.specific.test_case_results(). where.not(execution_feedback: :null). select("test_case_id, execution_feedback, feedback_line_no").to_json %>; for tcr in tcrs diff --git a/bin/bundle b/bin/bundle index 66e9889e..f19acf5b 100755 --- a/bin/bundle +++ b/bin/bundle @@ -1,3 +1,3 @@ #!/usr/bin/env ruby -ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) load Gem.bin_path('bundler', 'bundle') diff --git a/bin/rails b/bin/rails index 728cd85a..07396602 100755 --- a/bin/rails +++ b/bin/rails @@ -1,4 +1,4 @@ #!/usr/bin/env ruby -APP_PATH = File.expand_path('../../config/application', __FILE__) +APP_PATH = File.expand_path('../config/application', __dir__) require_relative '../config/boot' require 'rails/commands' diff --git a/bin/setup b/bin/setup new file mode 100755 index 00000000..94fd4d79 --- /dev/null +++ b/bin/setup @@ -0,0 +1,36 @@ +#!/usr/bin/env ruby +require 'fileutils' +include FileUtils + +# path to your application root. +APP_ROOT = File.expand_path('..', __dir__) + +def system!(*args) + system(*args) || abort("\n== Command #{args} failed ==") +end + +chdir APP_ROOT do + # This script is a starting point to setup your application. + # Add necessary setup steps to this file. + + puts '== Installing dependencies ==' + system! 'gem install bundler --conservative' + system('bundle check') || system!('bundle install') + + # Install JavaScript dependencies if using Yarn + # system('bin/yarn') + + # puts "\n== Copying sample files ==" + # unless File.exist?('config/database.yml') + # cp 'config/database.yml.sample', 'config/database.yml' + # end + + puts "\n== Preparing database ==" + system! 'bin/rails db:setup' + + puts "\n== Removing old logs and tempfiles ==" + system! 'bin/rails log:clear tmp:clear' + + puts "\n== Restarting application server ==" + system! 'bin/rails restart' +end diff --git a/bin/update b/bin/update new file mode 100755 index 00000000..58bfaed5 --- /dev/null +++ b/bin/update @@ -0,0 +1,31 @@ +#!/usr/bin/env ruby +require 'fileutils' +include FileUtils + +# path to your application root. +APP_ROOT = File.expand_path('..', __dir__) + +def system!(*args) + system(*args) || abort("\n== Command #{args} failed ==") +end + +chdir APP_ROOT do + # This script is a way to update your development environment automatically. + # Add necessary update steps to this file. + + puts '== Installing dependencies ==' + system! 'gem install bundler --conservative' + system('bundle check') || system!('bundle install') + + # Install JavaScript dependencies if using Yarn + # system('bin/yarn') + + puts "\n== Updating database ==" + system! 'bin/rails db:migrate' + + puts "\n== Removing old logs and tempfiles ==" + system! 'bin/rails log:clear tmp:clear' + + puts "\n== Restarting application server ==" + system! 'bin/rails restart' +end diff --git a/bin/yarn b/bin/yarn new file mode 100755 index 00000000..460dd565 --- /dev/null +++ b/bin/yarn @@ -0,0 +1,11 @@ +#!/usr/bin/env ruby +APP_ROOT = File.expand_path('..', __dir__) +Dir.chdir(APP_ROOT) do + begin + exec "yarnpkg", *ARGV + rescue Errno::ENOENT + $stderr.puts "Yarn executable was not detected in the system." + $stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install" + exit 1 + end +end diff --git a/config/application.rb b/config/application.rb index 9a8160be..4d058501 100644 --- a/config/application.rb +++ b/config/application.rb @@ -1,38 +1,31 @@ -require File.expand_path('../boot', __FILE__) +require_relative 'boot' require 'rails/all' # Require the gems listed in Gemfile, including any gems # you've limited to :test, :development, or :production. -Bundler.require(:default, Rails.env) +Bundler.require(*Rails.groups) module CodeWorkout class Application < Rails::Application + # Initialize configuration defaults for originally generated Rails version. + config.load_defaults 5.2 + Rails.application.config.active_record.belongs_to_required_by_default = false # Settings in config/environments/* take precedence over those specified here. # Application configuration should go into files in config/initializers # -- all .rb files in that directory are automatically loaded. - # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. - # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. - # config.time_zone = 'Central Time (US & Canada)' - - # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. - # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] - # config.i18n.default_locale = :de - - # other kinds of assets - config.assets.precompile += %w(*.png *.jpg *.jpeg *.gif *.mustache.html) - - # Custom directories with classes and modules you want to be autoloadable. - config.autoload_paths += %W(#{config.root}/lib) - + # exception_handler configuration (no longer relies on an initializer) + config.exception_handler = { + db: true, + dev: true + } + # Timeout for feedback polls (milliseconds) # This is an initial value on application startup, but it might change config.feedback_timeout = 1700 config.feedback_timeout_padding = 300 - config.active_record.raise_in_transactional_callbacks = true - # Allow iframe embedding? config.action_dispatch.default_headers.merge!( {'X-Frame-Options' => 'ALLOWALL'}) diff --git a/config/boot.rb b/config/boot.rb index 35967366..b9e460ce 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -1,4 +1,4 @@ -# Set up gems listed in the Gemfile. -ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) -require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE']) +require 'bundler/setup' # Set up gems listed in the Gemfile. +require 'bootsnap/setup' # Speed up boot time by caching expensive operations. diff --git a/config/cable.yml b/config/cable.yml new file mode 100644 index 00000000..546768c1 --- /dev/null +++ b/config/cable.yml @@ -0,0 +1,10 @@ +development: + adapter: async + +test: + adapter: async + +production: + adapter: redis + url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %> + channel_prefix: code_workout_production diff --git a/config/database.yml b/config/database.yml index 0c4c8170..b6ff2606 100644 --- a/config/database.yml +++ b/config/database.yml @@ -8,7 +8,7 @@ development: database: codeworkout username: codeworkout password: codeworkout - host: db_dev + host: db_dev # development: # adapter: sqlite3 diff --git a/config/deploy/staging.rb b/config/deploy/staging.rb index fdf4cd0c..815c836e 100644 --- a/config/deploy/staging.rb +++ b/config/deploy/staging.rb @@ -1,5 +1,6 @@ set :stage, :staging -set :branch, 'staging' +# set :branch, 'rails-5-upgrade' +set :branch, 'staging' set :rails_env, 'staging' # Simple Role Syntax @@ -17,7 +18,7 @@ # definition into the server list. The second argument # something that quacks like a hash can be used to set # extended properties on the server. -server 'codeworkoutdev.cs.vt.edu', user: 'codeworkout', roles: %w{web app db}, branch: 'staging', my_property: :my_value +server 'codeworkoutdev.cs.vt.edu', user: 'codeworkout', roles: %w{web app db}, branch: 'rails-5-upgrade', my_property: :my_value # you can set custom ssh options # it's possible to pass any option but you need to keep in mind that net/ssh understand limited list of options diff --git a/config/environment.rb b/config/environment.rb index f1849a7a..28bbf512 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -1,8 +1,7 @@ # Load the Rails application. -require File.expand_path('../application', __FILE__) -require 'rails_extensions' +require_relative 'application' require 'carrierwave' require 'carrierwave/orm/activerecord' # Initialize the Rails application. -CodeWorkout::Application.initialize! +Rails.application.initialize! diff --git a/config/environments/development.rb b/config/environments/development.rb index 7fed104d..1311e3e4 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -1,6 +1,5 @@ -CodeWorkout::Application.configure do - # Settings specified here will take precedence over those in - # config/application.rb. +Rails.application.configure do + # Settings specified here will take precedence over those in config/application.rb. # In the development environment your application's code is reloaded on # every request. This slows down response time but is perfect for development @@ -10,73 +9,53 @@ # Do not eager load code on boot. config.eager_load = false - # Show full error reports and disable caching. - config.consider_all_requests_local = true - config.action_controller.perform_caching = false + # Show full error reports. + config.consider_all_requests_local = true - # For SSEs - config.preload_frameworks = true - config.allow_concurrency = 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? + config.action_controller.perform_caching = true + + config.cache_store = :memory_store + config.public_file_server.headers = { + 'Cache-Control' => "public, max-age=#{2.days.to_i}" + } + else + config.action_controller.perform_caching = false + + config.cache_store = :null_store + end + + # Store uploaded files on the local file system (see config/storage.yml for options) + config.active_storage.service = :local # Don't care if the mailer can't send. - config.action_mailer.raise_delivery_errors = true - config.action_mailer.default_url_options = { :host => '192.168.33.20:3000' } - config.action_mailer.delivery_method = :smtp - config.action_mailer.smtp_settings = { - address: 'smtp.gmail.com', - port: 587, - domain: 'vt.edu', - authentication: 'plain', - enable_starttls_auto: true, - user_name: ENV['GMAIL_USERNAME'], - password: ENV['GMAIL_PASSWORD'] - } + config.action_mailer.raise_delivery_errors = false + + config.action_mailer.perform_caching = false # Print deprecation notices to the Rails logger. config.active_support.deprecation = :log - # Raise an error on page load if there are pending migrations + # Raise an error on page load if there are pending migrations. config.active_record.migration_error = :page_load + # Highlight code that triggered database queries in logs. + config.active_record.verbose_query_logs = true + # Debug mode disables concatenation and preprocessing of assets. # This option may cause significant delays in view rendering with a large # number of complex assets. config.assets.debug = true - # Do not fallback to assets pipeline if a precompiled asset is missed. - # config.assets.compile = false - - # Generate digests for assets URLs. - # config.assets.digest = true - - - config.assets.initialize_on_precompile = true - - config.middleware.use LogFile::Display - config.log_level = :info - config.log_formatter = proc do |severity, datetime, progname, msg| - if severity == 'DEBUG' && msg.blank? - '' - else - case severity - when 'DEBUG' - severity_colored = "\033[36;40m[DEBUG]\033[0m" # cyan - when 'INFO' - severity_colored = "\033[32;40m[INFO]\033[0m" # green - when 'WARN' - severity_colored = "\033[35;40m[WARNING]\033[0m" # magenta - when 'ERROR' - severity_colored = "\033[31;40m[ERROR]\033[0m" # red - when 'FATAL' - severity_colored = "\033[7;31;40m[FATAL]\033[0m" # black, red bg - else - severity_colored = "[#{severity}]" # none - end - "%s %s %s\n" % [ - datetime.strftime('%Y-%m-%d %H:%M:%S'), - severity_colored, - String === msg ? msg : msg.inspect - ] - end - end + # Suppress logger output for asset requests. + config.assets.quiet = true + + # Raises error for missing translations + # config.action_view.raise_on_missing_translations = true + + # Use an evented file watcher to asynchronously detect changes in source code, + # routes, locales, etc. This feature depends on the listen gem. + config.file_watcher = ActiveSupport::EventedFileUpdateChecker end diff --git a/config/environments/production.rb b/config/environments/production.rb index 9c602bb9..0da40324 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -1,11 +1,11 @@ -CodeWorkout::Application.configure do +Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # Code is not reloaded between requests. config.cache_classes = true # Eager load code on boot. This eager loads most of Rails and - # your application in memory, allowing both thread web servers + # your application in memory, allowing both threaded web servers # and those relying on copy on write to perform better. # Rake tasks automatically ignore this option for performance. config.eager_load = true @@ -14,13 +14,13 @@ config.consider_all_requests_local = false config.action_controller.perform_caching = true - # Enable Rack::Cache to put a simple HTTP cache in front of your application - # Add `rack-cache` to your Gemfile before enabling this. - # For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid. - # config.action_dispatch.rack_cache = true + # Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"] + # or in config/master.key. This key is used to decrypt credentials (and other encrypted files). + # config.require_master_key = true - # Disable Rails's static asset server (Apache or nginx will already do this). - config.serve_static_files = false + # Disable serving static files from the `/public` folder by default since + # Apache or NGINX already handles this. + config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present? # Compress JavaScripts and CSS. config.assets.js_compressor = :uglifier @@ -29,64 +29,66 @@ # Do not fallback to assets pipeline if a precompiled asset is missed. config.assets.compile = false - # Generate digests for assets URLs. - config.assets.digest = true + # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb - # Version of your assets, change this if you want to expire all your assets. - config.assets.version = '1.0' + # Enable serving of images, stylesheets, and JavaScripts from an asset server. + # config.action_controller.asset_host = 'http://assets.example.com' # Specifies the header that your server uses for sending files. - # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache - # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx + # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache + # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX + + # Store uploaded files on the local file system (see config/storage.yml for options) + config.active_storage.service = :local + + # Mount Action Cable outside main process or domain + # config.action_cable.mount_path = nil + # config.action_cable.url = 'wss://example.com/cable' + # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ] # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. # config.force_ssl = true - # Set to :debug to see everything in the log. - config.log_level = :info - - config.log_formatter = proc do |severity, datetime, progname, msg| - if severity == 'DEBUG' && msg.blank? - '' - else - "%s [%s] %s\n" % [ - datetime.strftime('%Y-%m-%d %H:%M:%S'), - severity, - String === msg ? msg : msg.inspect - ] - end - end + # Use the lowest log level to ensure availability of diagnostic information + # when problems arise. + config.log_level = :debug # Prepend all log lines with the following tags. - # config.log_tags = [ :subdomain, :uuid ] - - # Use a different logger for distributed setups. - # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) + config.log_tags = [ :request_id ] # Use a different cache store in production. # config.cache_store = :mem_cache_store - # Enable serving of images, stylesheets, and JavaScripts from an asset server. - # config.action_controller.asset_host = "http://assets.example.com" + # Use a real queuing backend for Active Job (and separate queues per environment) + # config.active_job.queue_adapter = :resque + # config.active_job.queue_name_prefix = "code_workout_#{Rails.env}" - # Precompile additional assets. - # application.js, application.css, and all non-JS/CSS in app/assets folder are already added. - # config.assets.precompile += %w( search.js ) + config.action_mailer.perform_caching = false # Ignore bad email addresses and do not raise email delivery errors. # Set this to true and configure the email server for immediate delivery to raise delivery errors. # config.action_mailer.raise_delivery_errors = false # Enable locale fallbacks for I18n (makes lookups for any locale fall back to - # the I18n.default_locale when a translation can not be found). + # the I18n.default_locale when a translation cannot be found). config.i18n.fallbacks = true # Send deprecation notices to registered listeners. config.active_support.deprecation = :notify - # Disable automatic flushing of the log to improve performance. - # config.autoflush_log = false + # Use default logging formatter so that PID and timestamp are not suppressed. + config.log_formatter = ::Logger::Formatter.new + + # Use a different logger for distributed setups. + # require 'syslog/logger' + # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name') + + if ENV["RAILS_LOG_TO_STDOUT"].present? + logger = ActiveSupport::Logger.new(STDOUT) + logger.formatter = config.log_formatter + config.logger = ActiveSupport::TaggedLogging.new(logger) + end - config.action_mailer.default_url_options = { :host => 'http://codeworkout.cs.vt.edu/' } - config.middleware.use LogFile::Display + # Do not dump schema after migrations. + config.active_record.dump_schema_after_migration = false end diff --git a/config/environments/test.rb b/config/environments/test.rb index 357fba0c..0a38fd3c 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -1,4 +1,4 @@ -CodeWorkout::Application.configure do +Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # The test environment is used exclusively to run your application's @@ -12,9 +12,11 @@ # preloads Rails for running tests, you may have to set it to true. config.eager_load = false - # Configure static asset server for tests with Cache-Control for performance. - config.serve_static_files = true - config.static_cache_control = "public, max-age=3600" + # Configure public file server for tests with Cache-Control for performance. + config.public_file_server.enabled = true + config.public_file_server.headers = { + 'Cache-Control' => "public, max-age=#{1.hour.to_i}" + } # Show full error reports and disable caching. config.consider_all_requests_local = true @@ -26,6 +28,11 @@ # Disable request forgery protection in test environment. config.action_controller.allow_forgery_protection = false + # Store uploaded files on the local file system in a temporary directory + config.active_storage.service = :test + + config.action_mailer.perform_caching = false + # Tell Action Mailer not to deliver emails to the real world. # The :test delivery method accumulates sent emails in the # ActionMailer::Base.deliveries array. @@ -34,6 +41,6 @@ # Print deprecation notices to the stderr. config.active_support.deprecation = :stderr - config.action_mailer.default_url_options = { :host => 'localhost:3000' } - + # Raises error for missing translations + # config.action_view.raise_on_missing_translations = true end diff --git a/config/initializers/application_controller_renderer.rb b/config/initializers/application_controller_renderer.rb new file mode 100644 index 00000000..89d2efab --- /dev/null +++ b/config/initializers/application_controller_renderer.rb @@ -0,0 +1,8 @@ +# Be sure to restart your server when you modify this file. + +# ActiveSupport::Reloader.to_prepare do +# ApplicationController.renderer.defaults.merge!( +# http_host: 'example.org', +# https: false +# ) +# end diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index a41616a0..24d1f4dd 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -14,7 +14,7 @@ # 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') -#Rails.application.config.assets.paths << Rails.root.join('public') +Rails.application.config.assets.paths << Rails.root.join('public') Rails.application.config.assets.configure do |env| env.cache = Sprockets::Cache::FileStore.new( @@ -30,7 +30,8 @@ path !~ /bootstrap-social/ && path !~ /active_admin/ && %w(.js .css).include?(File.extname(filename)) - } + }, /application.(css|.js)$/, + %w(*.png *.jpg *.jpeg *.gif *.mustache.html, *.ico) ] # Change how the post body is formatted by default, you can still override by `raw_post` diff --git a/config/initializers/content_security_policy.rb b/config/initializers/content_security_policy.rb new file mode 100644 index 00000000..d3bcaa5e --- /dev/null +++ b/config/initializers/content_security_policy.rb @@ -0,0 +1,25 @@ +# 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 + +# Rails.application.config.content_security_policy do |policy| +# policy.default_src :self, :https +# policy.font_src :self, :https, :data +# policy.img_src :self, :https, :data +# policy.object_src :none +# policy.script_src :self, :https +# policy.style_src :self, :https + +# # Specify URI for violation reports +# # policy.report_uri "/csp-violation-report-endpoint" +# end + +# If you are using UJS then enable automatic nonce generation +# Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) } + +# 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/cookies_serializer.rb b/config/initializers/cookies_serializer.rb new file mode 100644 index 00000000..5a6a32d3 --- /dev/null +++ b/config/initializers/cookies_serializer.rb @@ -0,0 +1,5 @@ +# Be sure to restart your server when you modify this file. + +# Specify a serializer for the signed and encrypted cookie jars. +# Valid options are :json, :marshal, and :hybrid. +Rails.application.config.action_dispatch.cookies_serializer = :json diff --git a/config/initializers/exception_handler.rb b/config/initializers/exception_handler.rb deleted file mode 100644 index a3b7c540..00000000 --- a/config/initializers/exception_handler.rb +++ /dev/null @@ -1,8 +0,0 @@ -# Exception Handler -### -# You can add different settings using this block -# Use the docs at http://github.com/richpeck/exception_handler for info -### -ExceptionHandler.setup do |config| - config.db = true -end diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb index 12b845d8..01553713 100644 --- a/config/initializers/inflections.rb +++ b/config/initializers/inflections.rb @@ -3,14 +3,15 @@ # Add new inflection rules using the following format. Inflections # 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| +ActiveSupport::Inflector.inflections(:en) do |inflect| # inflect.plural /^(ox)$/i, '\1en' # inflect.singular /^(ox)en/i, '\1' # inflect.irregular 'person', 'people' # inflect.uncountable %w( fish sheep ) -# end - -# These inflection rules are supported but not enabled by default: -ActiveSupport::Inflector.inflections(:en) do |inflect| inflect.acronym 'IRT' end + +# These inflection rules are supported but not enabled by default: +# ActiveSupport::Inflector.inflections(:en) do |inflect| +# inflect.acronym 'RESTful' +# end diff --git a/config/initializers/mime_types.rb b/config/initializers/mime_types.rb index 9acb8d70..dc189968 100644 --- a/config/initializers/mime_types.rb +++ b/config/initializers/mime_types.rb @@ -2,5 +2,3 @@ # Add new mime types for use in respond_to blocks: # Mime::Type.register "text/richtext", :rtf -# Mime::Type.register_alias "text/html", :iphone -Mime::Type.register "application/x-yaml", :yml diff --git a/config/initializers/new_framework_defaults.rb b/config/initializers/new_framework_defaults.rb new file mode 100644 index 00000000..2cb708e7 --- /dev/null +++ b/config/initializers/new_framework_defaults.rb @@ -0,0 +1,20 @@ +# Be sure to restart your server when you modify this file. +# +# This file contains migration options to ease your Rails 5.0 upgrade. +# +# Once upgraded flip defaults one by one to migrate to the new default. +# +# Read the Rails 5.0 release notes for more info on each option. + +# Enable per-form CSRF tokens. Previous versions had false. +Rails.application.config.action_controller.per_form_csrf_tokens = false + +# Enable origin-checking CSRF mitigation. Previous versions had false. +Rails.application.config.action_controller.forgery_protection_origin_check = false + +# Make Ruby 2.4 preserve the timezone of the receiver when calling `to_time`. +# Previous versions had false. +ActiveSupport.to_time_preserves_timezone = false + +# Require `belongs_to` associations by default. Previous versions had false. +Rails.application.config.active_record.belongs_to_required_by_default = false diff --git a/config/initializers/new_framework_defaults_5_1.rb b/config/initializers/new_framework_defaults_5_1.rb new file mode 100644 index 00000000..9010abd5 --- /dev/null +++ b/config/initializers/new_framework_defaults_5_1.rb @@ -0,0 +1,14 @@ +# Be sure to restart your server when you modify this file. +# +# This file contains migration options to ease your Rails 5.1 upgrade. +# +# Once upgraded flip defaults one by one to migrate to the new default. +# +# Read the Guide for Upgrading Ruby on Rails for more info on each option. + +# Make `form_with` generate non-remote forms. +Rails.application.config.action_view.form_with_generates_remote_forms = false + +# Unknown asset fallback will return the path passed in when the given +# asset is not present in the asset pipeline. +# Rails.application.config.assets.unknown_asset_fallback = false diff --git a/config/initializers/new_framework_defaults_5_2.rb b/config/initializers/new_framework_defaults_5_2.rb new file mode 100644 index 00000000..c383d072 --- /dev/null +++ b/config/initializers/new_framework_defaults_5_2.rb @@ -0,0 +1,38 @@ +# Be sure to restart your server when you modify this file. +# +# This file contains migration options to ease your Rails 5.2 upgrade. +# +# Once upgraded flip defaults one by one to migrate to the new default. +# +# Read the Guide for Upgrading Ruby on Rails for more info on each option. + +# Make Active Record use stable #cache_key alongside new #cache_version method. +# This is needed for recyclable cache keys. +# Rails.application.config.active_record.cache_versioning = true + +# Use AES-256-GCM authenticated encryption for encrypted cookies. +# Also, embed cookie expiry in signed or encrypted cookies for increased security. +# +# This option is not backwards compatible with earlier Rails versions. +# It's best enabled when your entire app is migrated and stable on 5.2. +# +# Existing cookies will be converted on read then written with the new scheme. +# Rails.application.config.action_dispatch.use_authenticated_cookie_encryption = true + +# Use AES-256-GCM authenticated encryption as default cipher for encrypting messages +# instead of AES-256-CBC, when use_authenticated_message_encryption is set to true. +# Rails.application.config.active_support.use_authenticated_message_encryption = true + +# Add default protection from forgery to ActionController::Base instead of in +# ApplicationController. +# Rails.application.config.action_controller.default_protect_from_forgery = true + +# Store boolean values are in sqlite3 databases as 1 and 0 instead of 't' and +# 'f' after migrating old data. +# Rails.application.config.active_record.sqlite3.represent_boolean_as_integer = true + +# Use SHA-1 instead of MD5 to generate non-sensitive digests, such as the ETag header. +# Rails.application.config.active_support.use_sha1_digests = true + +# Make `form_with` generate id attributes for any generated HTML tags. +# Rails.application.config.action_view.form_with_generates_ids = true diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb index f71b4efb..ce299f9d 100644 --- a/config/initializers/session_store.rb +++ b/config/initializers/session_store.rb @@ -1,3 +1,3 @@ # Be sure to restart your server when you modify this file. -CodeWorkout::Application.config.session_store :cookie_store, key: '_code-practice_session' +Rails.application.config.session_store :cookie_store, key: '_code_workout_session' diff --git a/config/initializers/wrap_parameters.rb b/config/initializers/wrap_parameters.rb index 33725e95..bbfc3961 100644 --- a/config/initializers/wrap_parameters.rb +++ b/config/initializers/wrap_parameters.rb @@ -5,10 +5,10 @@ # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. ActiveSupport.on_load(:action_controller) do - wrap_parameters format: [:json] if respond_to?(:wrap_parameters) + wrap_parameters format: [:json] end # To enable root element in JSON for ActiveRecord objects. # ActiveSupport.on_load(:active_record) do -# self.include_root_in_json = true +# self.include_root_in_json = true # end diff --git a/config/locales/en.yml b/config/locales/en.yml index b1934892..4a4a2d6e 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -16,6 +16,16 @@ # # This would use the information in config/locales/es.yml. # +# The following keys must be escaped otherwise they will not be retrieved by +# the default I18n backend: +# +# true, false, on, off, yes, no +# +# Instead, surround them with single quotes. +# +# en: +# 'true': 'foo' +# # To learn more, please read the Rails Internationalization guide # available at http://guides.rubyonrails.org/i18n.html. diff --git a/config/puma.rb b/config/puma.rb index e6fe5801..1e19380d 100644 --- a/config/puma.rb +++ b/config/puma.rb @@ -1,52 +1,56 @@ -# Default to production -rails_env = rails_env || ENV['RAILS_ENV'] || 'production' -environment rails_env - -# For MRI, use workers instead of threads for greater parallelism -if rails_env == 'production' - workers 10 - threads 2, 2 - daemonize - preload_app! -elsif rails_env == 'staging' - workers 4 - threads 2, 8 - daemonize - preload_app! -else - # development settings are smaller; at least two workers, for SSE - workers 2 - threads 2, 4 -end - -app_dir = File.expand_path('../..', __FILE__) - -# Set up socket location -bind "unix://#{app_dir}/tmp/sockets/puma.sock" - -# Logging -stdout_redirect "#{app_dir}/log/puma.stdout.log", - "#{app_dir}/log/puma.stderr.log", - true - -puts "Running in evironment #{rails_env}" -puts "Running on platform #{RUBY_PLATFORM}" - -# Set master PID and state locations -pidfile "#{app_dir}/tmp/pids/puma.pid" -state_path "#{app_dir}/tmp/pids/puma.state" -activate_control_app - -on_worker_boot do - require 'active_record' - ActiveRecord::Base.connection.disconnect! rescue ActiveRecord::ConnectionNotEstablished - ActiveSupport.on_load(:active_record) do - ActiveRecord::Base.establish_connection( - YAML.load_file("#{app_dir}/config/database.yml")[rails_env]) - end -end - -before_fork do - require 'active_record' - ActiveRecord::Base.connection.disconnect! rescue ActiveRecord::ConnectionNotEstablished -end +# Puma can serve each request in a thread from an internal thread pool. +# The `threads` method setting takes two numbers: a minimum and maximum. +# Any libraries that use thread pools should be configured to match +# the maximum value specified for Puma. Default is set to 5 threads for minimum +# and maximum; this matches the default thread size of Active Record. +# +threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 } +threads threads_count, threads_count + +# Specifies the `port` that Puma will listen on to receive requests; default is 3000. +# +port ENV.fetch("PORT") { 3000 } + +# Specifies the `environment` that Puma will run in. +# +environment ENV.fetch("RAILS_ENV") { "development" } + +# Specifies the number of `workers` to boot in clustered mode. +# Workers are forked webserver processes. If using threads and workers together +# the concurrency of the application would be max `threads` * `workers`. +# Workers do not work on JRuby or Windows (both of which do not support +# processes). +# +# workers ENV.fetch("WEB_CONCURRENCY") { 2 } + +# Use the `preload_app!` method when specifying a `workers` number. +# This directive tells Puma to first boot the application and load code +# before forking the application. This takes advantage of Copy On Write +# process behavior so workers use less memory. If you use this option +# you need to make sure to reconnect any threads in the `on_worker_boot` +# block. +# +# preload_app! + +# If you are preloading your application and using Active Record, it's +# recommended that you close any connections to the database before workers +# are forked to prevent connection leakage. +# +# before_fork do +# ActiveRecord::Base.connection_pool.disconnect! if defined?(ActiveRecord) +# end + +# The code in the `on_worker_boot` will be called if you are using +# clustered mode by specifying a number of `workers`. After each worker +# process is booted, this block will be run. If you are using the `preload_app!` +# option, you will want to use this block to reconnect to any threads +# or connections that may have been created at application boot, as Ruby +# cannot share connections between processes. +# +# on_worker_boot do +# ActiveRecord::Base.establish_connection if defined?(ActiveRecord) +# end +# + +# Allow puma to be restarted by `rails restart` command. +plugin :tmp_restart diff --git a/config/routes.rb b/config/routes.rb index 4cdf4df6..3e7f25b5 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,4 +1,4 @@ -CodeWorkout::Application.routes.draw do +Rails.application.routes.draw do root 'home#index' @@ -46,14 +46,14 @@ # /gym/exercises ... get 'exercises/call_open_pop' => 'exercises#call_open_pop' - get 'exercises_import' => 'exercises#upload_yaml' - post 'exercises_yaml_create' => 'exercises#yaml_create' + get 'exercises_import' => 'exercises#upload_yaml' # REMOVE + post 'exercises_yaml_create' => 'exercises#yaml_create' # REMOVE get 'exercises/upload' => 'exercises#upload', as: :exercises_upload get 'exercises/download' => 'exercises#download', as: :exercises_download post 'exercises/upload_create' => 'exercises#upload_create' get 'exercises/upload_mcqs' => 'exercises#upload_mcqs', - as: :exercises_upload_mcqs - post 'exercises/create_mcqs' => 'exercises#create_mcqs' + as: :exercises_upload_mcqs # REMOVE + post 'exercises/create_mcqs' => 'exercises#create_mcqs' # REMOVE get '/exercises/any' => 'exercises#random_exercise', as: :random_exercise get 'exercises/:id/practice' => 'exercises#practice', @@ -66,6 +66,7 @@ as: :exercises_query_data get 'exercises/download_attempt_data' => 'exercises#download_attempt_data', as: :download_exercise_attempt_data + get 'exercises/export' => 'exercises#export', as: :exercises_export # At the bottom, so the routes above take precedence over existing ids resources :exercises @@ -86,8 +87,8 @@ as: :practice_workout get 'workouts/:id/evaluate' => 'workouts#evaluate', as: :workout_evaluate get 'workouts_dummy' => 'workouts#dummy' - get 'workouts_import' => 'workouts#upload_yaml' - post 'workouts_yaml_create' => 'workouts#yaml_create' + get 'workouts_import' => 'workouts#upload_yaml' # REMOVE? + post 'workouts_yaml_create' => 'workouts#yaml_create' # REMOVE? post 'workouts/search' => 'workouts#search', as: :workouts_search get 'workouts/:id/download_attempt_data' => 'workouts#download_attempt_data', as: :download_workout_attempt_data @@ -189,6 +190,13 @@ match 'help/:action', controller: 'help', via: [:get] match 'static_pages/:action', controller: 'static_pages', via: [:get] + get 'static_pages/mockup1' => 'static_pages#mockup1' + get 'static_pages/mockup2' => 'static_pages#mockup2' + get 'static_pages/mockup3' => 'static_pages#mockup3' + get 'static_pages/thumbnails' => 'static_pages#thumbnails' + + # match 'help/:action', to: 'help', via: [:get] + # match 'static_pages/:action', to: 'static_pages', via: [:get] end #== Route Map diff --git a/config/secrets.yml b/config/secrets.yml index 6d4cb2ec..01d254be 100644 --- a/config/secrets.yml +++ b/config/secrets.yml @@ -1,16 +1,32 @@ -development: - secret_key_base: 14d33115b12aa4f9f07d8575fea6ae6a57223f64d13cf1475ec6614cfd78b0e8e8fbd19baa83649b99ff0494fd06c9265753961df252d4301602afd3cd4be92b - facebook_id: ID - facebook_secret: SECRET - google_id: ID - google_secret: SECRET - devise_pepper: '46d41a459192e0210aa267ccf13d12ecb1fda9ba3deb015bf9069106b5aea043ea59df22eaf8c26768ee257b84a47f0df1e03700956dd8d7963a98c995cca2f4' +# Be sure to restart your server when you modify this file. + +# Your secret key is used for verifying the integrity of signed cookies. +# If you change this key, all old signed cookies will become invalid! + +# Make sure the secret is at least 30 characters and all random, +# no regular words or you'll be exposed to dictionary attacks. +# You can use `rails secret` to generate a secure secret key. + +# Make sure the secrets in this file are kept private +# if you're sharing your code publicly. + +# Shared secrets are available across all environments. +# shared: +# api_key: a1B2c3D4e5F6 + +# Environmental secrets are only available for that specific environment. + +development: + secret_key_base: 99d725b98ec18eac5e0491b3bfa7dc56c397dbd9ac48e72b55cf642fb6f89fb0214795e4d4b243d9d6337f14a5463c6d974c8d02146c663e03da838c5ff9c3db test: - secret_key_base: bb105787c6ba010a44ec6554df779c7dcd83952dfe3c9175bb0a5ceec79705f23eb08b8d2e4c27aa71b1ee87d40018b6be27d1fe82d02129590ae172fdb3ef80 - facebook_id: ID - facebook_secret: SECRET - google_id: ID - google_secret: SECRET - devise_pepper: '46d41a459192e0210aa267ccf13d12ecb1fda9ba3deb015bf9069106b5aea043ea59df22eaf8c26768ee257b84a47f0df1e03700956dd8d7963a98c995cca2f4' \ No newline at end of file + secret_key_base: 2f5b62caef54d44556fea8ffe3b0a57b1c670b4dee5c338b3c65f4b5a0bda073d9cc51888ef8101ce274640df51e6cce32c50489dbde5eb0ba712a65302c81d8 + +# Do not keep production secrets in the unencrypted secrets file. +# Instead, either read values from the environment. +# Or, use `bin/rails secrets:setup` to configure encrypted secrets +# and move the `production:` environment over there. + +production: + secret_key_base: <%= ENV["SECRET_KEY_BASE"] %> diff --git a/config/spring.rb b/config/spring.rb new file mode 100644 index 00000000..c9119b40 --- /dev/null +++ b/config/spring.rb @@ -0,0 +1,6 @@ +%w( + .ruby-version + .rbenv-vars + tmp/restart.txt + tmp/caching-dev.txt +).each { |path| Spring.watch(path) } diff --git a/config/storage.yml b/config/storage.yml new file mode 100644 index 00000000..d32f76e8 --- /dev/null +++ b/config/storage.yml @@ -0,0 +1,34 @@ +test: + service: Disk + root: <%= Rails.root.join("tmp/storage") %> + +local: + service: Disk + root: <%= Rails.root.join("storage") %> + +# Use rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key) +# amazon: +# service: S3 +# access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %> +# secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %> +# region: us-east-1 +# bucket: your_own_bucket + +# Remember not to checkin your GCS keyfile to a repository +# google: +# service: GCS +# project: your_project +# credentials: <%= Rails.root.join("path/to/gcs.keyfile") %> +# bucket: your_own_bucket + +# Use rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key) +# microsoft: +# service: AzureStorage +# storage_account_name: your_account_name +# storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %> +# container: your_container_name + +# mirror: +# service: Mirror +# primary: local +# mirrors: [ amazon, google, microsoft ] diff --git a/db/development.db b/db/development.db deleted file mode 100644 index e69de29b..00000000 diff --git a/db/migrate/20130912181453_create_organizations.rb b/db/migrate/20130912181453_create_organizations.rb index 2d996b8f..e3d360e9 100644 --- a/db/migrate/20130912181453_create_organizations.rb +++ b/db/migrate/20130912181453_create_organizations.rb @@ -1,4 +1,4 @@ -class CreateOrganizations < ActiveRecord::Migration +class CreateOrganizations < ActiveRecord::Migration[5.1] def change create_table :organizations do |t| t.string :display_name, null: false diff --git a/db/migrate/20130912182541_create_courses.rb b/db/migrate/20130912182541_create_courses.rb index 1ccdf7de..534d82ba 100644 --- a/db/migrate/20130912182541_create_courses.rb +++ b/db/migrate/20130912182541_create_courses.rb @@ -1,4 +1,4 @@ -class CreateCourses < ActiveRecord::Migration +class CreateCourses < ActiveRecord::Migration[5.1] def change create_table :courses do |t| t.string :name, null: false diff --git a/db/migrate/20130912200825_create_terms.rb b/db/migrate/20130912200825_create_terms.rb index 086e72e9..ab4e6c4b 100644 --- a/db/migrate/20130912200825_create_terms.rb +++ b/db/migrate/20130912200825_create_terms.rb @@ -1,4 +1,4 @@ -class CreateTerms < ActiveRecord::Migration +class CreateTerms < ActiveRecord::Migration[5.1] def change create_table :terms do |t| t.integer :season, null: false diff --git a/db/migrate/20130912202622_create_course_offerings.rb b/db/migrate/20130912202622_create_course_offerings.rb index a9426eb5..1d60bd5b 100644 --- a/db/migrate/20130912202622_create_course_offerings.rb +++ b/db/migrate/20130912202622_create_course_offerings.rb @@ -1,4 +1,4 @@ -class CreateCourseOfferings < ActiveRecord::Migration +class CreateCourseOfferings < ActiveRecord::Migration[5.1] def change create_table :course_offerings do |t| t.references :course, null: false, index: true diff --git a/db/migrate/20130913163500_devise_create_users.rb b/db/migrate/20130913163500_devise_create_users.rb index 79016fd7..bd168ece 100644 --- a/db/migrate/20130913163500_devise_create_users.rb +++ b/db/migrate/20130913163500_devise_create_users.rb @@ -1,4 +1,4 @@ -class DeviseCreateUsers < ActiveRecord::Migration +class DeviseCreateUsers < ActiveRecord::Migration[5.1] def change create_table(:users) do |t| ## Database authenticatable diff --git a/db/migrate/20130915012131_create_course_roles.rb b/db/migrate/20130915012131_create_course_roles.rb index 344e3089..06491e3c 100644 --- a/db/migrate/20130915012131_create_course_roles.rb +++ b/db/migrate/20130915012131_create_course_roles.rb @@ -1,4 +1,4 @@ -class CreateCourseRoles < ActiveRecord::Migration +class CreateCourseRoles < ActiveRecord::Migration[5.1] def change create_table :course_roles do |t| t.string :name, :unique => true, :null => false diff --git a/db/migrate/20130915030206_create_course_enrollments.rb b/db/migrate/20130915030206_create_course_enrollments.rb index 9e3d36e6..66a4ebf7 100644 --- a/db/migrate/20130915030206_create_course_enrollments.rb +++ b/db/migrate/20130915030206_create_course_enrollments.rb @@ -1,4 +1,4 @@ -class CreateCourseEnrollments < ActiveRecord::Migration +class CreateCourseEnrollments < ActiveRecord::Migration[5.1] def change create_table :course_enrollments do |t| t.references :user, index: true diff --git a/db/migrate/20130915044012_create_tags.rb b/db/migrate/20130915044012_create_tags.rb index c78a2612..02b039de 100644 --- a/db/migrate/20130915044012_create_tags.rb +++ b/db/migrate/20130915044012_create_tags.rb @@ -1,4 +1,4 @@ -class CreateTags < ActiveRecord::Migration +class CreateTags < ActiveRecord::Migration[5.1] def change create_table :tags do |t| t.string :name, null: false diff --git a/db/migrate/20130915050202_create_prompts.rb b/db/migrate/20130915050202_create_prompts.rb index e95edb36..dce6569a 100644 --- a/db/migrate/20130915050202_create_prompts.rb +++ b/db/migrate/20130915050202_create_prompts.rb @@ -1,4 +1,4 @@ -class CreatePrompts < ActiveRecord::Migration +class CreatePrompts < ActiveRecord::Migration[5.1] def change create_table :prompts do |t| t.belongs_to :exercise, index: true, null: false diff --git a/db/migrate/20130915055146_create_choices.rb b/db/migrate/20130915055146_create_choices.rb index f9040bac..2a7c879e 100644 --- a/db/migrate/20130915055146_create_choices.rb +++ b/db/migrate/20130915055146_create_choices.rb @@ -1,4 +1,4 @@ -class CreateChoices < ActiveRecord::Migration +class CreateChoices < ActiveRecord::Migration[5.1] def change create_table :choices do |t| t.belongs_to :exercise, index: true, null: false diff --git a/db/migrate/20130915203004_create_languages.rb b/db/migrate/20130915203004_create_languages.rb index a1c86bc3..5932a16e 100644 --- a/db/migrate/20130915203004_create_languages.rb +++ b/db/migrate/20130915203004_create_languages.rb @@ -1,4 +1,4 @@ -class CreateLanguages < ActiveRecord::Migration +class CreateLanguages < ActiveRecord::Migration[5.1] def change create_table :languages do |t| t.string :name diff --git a/db/migrate/20130916142010_create_global_roles.rb b/db/migrate/20130916142010_create_global_roles.rb index 40c1c048..bac93896 100644 --- a/db/migrate/20130916142010_create_global_roles.rb +++ b/db/migrate/20130916142010_create_global_roles.rb @@ -1,4 +1,4 @@ -class CreateGlobalRoles < ActiveRecord::Migration +class CreateGlobalRoles < ActiveRecord::Migration[5.1] def change create_table :global_roles do |t| t.string :name, :unique => true, :null => false diff --git a/db/migrate/20130916203844_add_initial_columns_to_users.rb b/db/migrate/20130916203844_add_initial_columns_to_users.rb index 2451bd65..75fba1e8 100644 --- a/db/migrate/20130916203844_add_initial_columns_to_users.rb +++ b/db/migrate/20130916203844_add_initial_columns_to_users.rb @@ -1,4 +1,4 @@ -class AddInitialColumnsToUsers < ActiveRecord::Migration +class AddInitialColumnsToUsers < ActiveRecord::Migration[5.1] def change add_column :users, :first_name, :string, index: true add_column :users, :last_name, :string, index: true diff --git a/db/migrate/20130918174151_create_stems.rb b/db/migrate/20130918174151_create_stems.rb index 0cf1e531..d9960e27 100644 --- a/db/migrate/20130918174151_create_stems.rb +++ b/db/migrate/20130918174151_create_stems.rb @@ -1,4 +1,4 @@ -class CreateStems < ActiveRecord::Migration +class CreateStems < ActiveRecord::Migration[5.1] def change create_table :stems do |t| t.text :preamble diff --git a/db/migrate/20130918190714_create_exercises.rb b/db/migrate/20130918190714_create_exercises.rb index 61cc00df..eee1528b 100644 --- a/db/migrate/20130918190714_create_exercises.rb +++ b/db/migrate/20130918190714_create_exercises.rb @@ -1,4 +1,4 @@ -class CreateExercises < ActiveRecord::Migration +class CreateExercises < ActiveRecord::Migration[5.1] def change create_table :exercises do |t| t.belongs_to :user, index: true, null: false diff --git a/db/migrate/20130923164556_rename_exercises_type_to_question_type.rb b/db/migrate/20130923164556_rename_exercises_type_to_question_type.rb index 13c464b4..b23220b0 100644 --- a/db/migrate/20130923164556_rename_exercises_type_to_question_type.rb +++ b/db/migrate/20130923164556_rename_exercises_type_to_question_type.rb @@ -1,4 +1,4 @@ -class RenameExercisesTypeToQuestionType < ActiveRecord::Migration +class RenameExercisesTypeToQuestionType < ActiveRecord::Migration[5.1] def change #create_table :exercises do |t| # t.belongs_to :user, index: true, null: false diff --git a/db/migrate/20131001051705_create_experience_column.rb b/db/migrate/20131001051705_create_experience_column.rb index d9df1e22..499f1ee3 100644 --- a/db/migrate/20131001051705_create_experience_column.rb +++ b/db/migrate/20131001051705_create_experience_column.rb @@ -1,4 +1,4 @@ -class CreateExperienceColumn < ActiveRecord::Migration +class CreateExperienceColumn < ActiveRecord::Migration[5.1] def change add_column :exercises, :experience, :integer end diff --git a/db/migrate/20131003025313_create_attempts.rb b/db/migrate/20131003025313_create_attempts.rb index dd909f85..f8e17b47 100644 --- a/db/migrate/20131003025313_create_attempts.rb +++ b/db/migrate/20131003025313_create_attempts.rb @@ -1,4 +1,4 @@ -class CreateAttempts < ActiveRecord::Migration +class CreateAttempts < ActiveRecord::Migration[5.1] def change create_table :attempts do |t| t.belongs_to :user, index: true, null: false diff --git a/db/migrate/20131009161911_add_tagtype_to_tags.rb b/db/migrate/20131009161911_add_tagtype_to_tags.rb index f16e3195..a6989f4b 100644 --- a/db/migrate/20131009161911_add_tagtype_to_tags.rb +++ b/db/migrate/20131009161911_add_tagtype_to_tags.rb @@ -1,4 +1,4 @@ -class AddTagtypeToTags < ActiveRecord::Migration +class AddTagtypeToTags < ActiveRecord::Migration[5.1] def change add_column :tags, :tagtype, :integer, :default => 0 end diff --git a/db/migrate/20131010184442_change_tags_in_exercise.rb b/db/migrate/20131010184442_change_tags_in_exercise.rb index 9d18d55f..72d95623 100644 --- a/db/migrate/20131010184442_change_tags_in_exercise.rb +++ b/db/migrate/20131010184442_change_tags_in_exercise.rb @@ -1,4 +1,4 @@ -class ChangeTagsInExercise < ActiveRecord::Migration +class ChangeTagsInExercise < ActiveRecord::Migration[5.1] def change remove_column :exercises, :language, :belongs_to #language now represented as a tag with tagtype=2 end diff --git a/db/migrate/20131011170027_create_total_exercise_and_total_experience_in_tag.rb b/db/migrate/20131011170027_create_total_exercise_and_total_experience_in_tag.rb index 88b8677c..19be0288 100644 --- a/db/migrate/20131011170027_create_total_exercise_and_total_experience_in_tag.rb +++ b/db/migrate/20131011170027_create_total_exercise_and_total_experience_in_tag.rb @@ -1,4 +1,4 @@ -class CreateTotalExerciseAndTotalExperienceInTag < ActiveRecord::Migration +class CreateTotalExerciseAndTotalExperienceInTag < ActiveRecord::Migration[5.1] def change add_column :tags, :total_exercises, :integer, :default => 0 add_column :tags, :total_experience, :integer, :default => 0 diff --git a/db/migrate/20131015080408_create_tag_user_scores.rb b/db/migrate/20131015080408_create_tag_user_scores.rb index b4350a29..81a3fd87 100644 --- a/db/migrate/20131015080408_create_tag_user_scores.rb +++ b/db/migrate/20131015080408_create_tag_user_scores.rb @@ -1,4 +1,4 @@ -class CreateTagUserScores < ActiveRecord::Migration +class CreateTagUserScores < ActiveRecord::Migration[5.1] def change create_table :tag_user_scores do |t| t.belongs_to :user, index: true, null: false diff --git a/db/migrate/20131015083558_rename_tag_name.rb b/db/migrate/20131015083558_rename_tag_name.rb index 8d5ecd8a..86560ef7 100644 --- a/db/migrate/20131015083558_rename_tag_name.rb +++ b/db/migrate/20131015083558_rename_tag_name.rb @@ -1,4 +1,4 @@ -class RenameTagName < ActiveRecord::Migration +class RenameTagName < ActiveRecord::Migration[5.1] def change rename_column :tags, :name, :tag_name end diff --git a/db/migrate/20131015151339_add_completed_exercises_to_tag_user_scores.rb b/db/migrate/20131015151339_add_completed_exercises_to_tag_user_scores.rb index 394fa313..88713100 100644 --- a/db/migrate/20131015151339_add_completed_exercises_to_tag_user_scores.rb +++ b/db/migrate/20131015151339_add_completed_exercises_to_tag_user_scores.rb @@ -1,4 +1,4 @@ -class AddCompletedExercisesToTagUserScores < ActiveRecord::Migration +class AddCompletedExercisesToTagUserScores < ActiveRecord::Migration[5.1] def change add_column :tag_user_scores, :completed_exercises, :integer, :default => 0 end diff --git a/db/migrate/20131016023405_change_language_to_tags.rb b/db/migrate/20131016023405_change_language_to_tags.rb index 1ec72520..407fbeb8 100644 --- a/db/migrate/20131016023405_change_language_to_tags.rb +++ b/db/migrate/20131016023405_change_language_to_tags.rb @@ -1,4 +1,4 @@ -class ChangeLanguageToTags < ActiveRecord::Migration +class ChangeLanguageToTags < ActiveRecord::Migration[5.1] def change drop_table :languages remove_column :exercises, :language_id diff --git a/db/migrate/20131016154908_create_workouts.rb b/db/migrate/20131016154908_create_workouts.rb index 43477884..ab9af3c6 100644 --- a/db/migrate/20131016154908_create_workouts.rb +++ b/db/migrate/20131016154908_create_workouts.rb @@ -1,4 +1,4 @@ -class CreateWorkouts < ActiveRecord::Migration +class CreateWorkouts < ActiveRecord::Migration[5.1] def change create_table :workouts do |t| t.string :name, null: false diff --git a/db/migrate/20131016175805_create_tags_workouts.rb b/db/migrate/20131016175805_create_tags_workouts.rb index bce10d4d..ce7b5601 100644 --- a/db/migrate/20131016175805_create_tags_workouts.rb +++ b/db/migrate/20131016175805_create_tags_workouts.rb @@ -1,4 +1,4 @@ -class CreateTagsWorkouts < ActiveRecord::Migration +class CreateTagsWorkouts < ActiveRecord::Migration[5.1] def change create_table :tags_workouts do |t| t.belongs_to :tag, index: true diff --git a/db/migrate/20131119032619_rename_workouts_exercises_exercises_workouts.rb b/db/migrate/20131119032619_rename_workouts_exercises_exercises_workouts.rb index f4de4434..98709ae0 100644 --- a/db/migrate/20131119032619_rename_workouts_exercises_exercises_workouts.rb +++ b/db/migrate/20131119032619_rename_workouts_exercises_exercises_workouts.rb @@ -1,4 +1,4 @@ -class RenameWorkoutsExercisesExercisesWorkouts < ActiveRecord::Migration +class RenameWorkoutsExercisesExercisesWorkouts < ActiveRecord::Migration[5.1] def change rename_table :workouts_exercises, :exercises_workouts #add_index "exercises_workouts", ["exercise_id"], name: "index_exercises_workouts_on_exercise_id" diff --git a/db/migrate/20131210061217_add_coding_exercise_columns.rb b/db/migrate/20131210061217_add_coding_exercise_columns.rb index 6da782fc..2cc33558 100644 --- a/db/migrate/20131210061217_add_coding_exercise_columns.rb +++ b/db/migrate/20131210061217_add_coding_exercise_columns.rb @@ -1,4 +1,4 @@ -class AddCodingExerciseColumns < ActiveRecord::Migration +class AddCodingExerciseColumns < ActiveRecord::Migration[5.1] def change add_column :exercises, :starter_code, :text diff --git a/db/migrate/20140422205525_update_exercise.rb b/db/migrate/20140422205525_update_exercise.rb index 70dc740c..e96c0841 100644 --- a/db/migrate/20140422205525_update_exercise.rb +++ b/db/migrate/20140422205525_update_exercise.rb @@ -1,4 +1,4 @@ -class UpdateExercise < ActiveRecord::Migration +class UpdateExercise < ActiveRecord::Migration[5.1] def change #allow empty titles in database change_column_null(:exercises, :title, true) diff --git a/db/migrate/20140428202518_create_resource_files.rb b/db/migrate/20140428202518_create_resource_files.rb index 40294876..2c9c8ceb 100644 --- a/db/migrate/20140428202518_create_resource_files.rb +++ b/db/migrate/20140428202518_create_resource_files.rb @@ -1,4 +1,4 @@ -class CreateResourceFiles < ActiveRecord::Migration +class CreateResourceFiles < ActiveRecord::Migration[5.1] def change create_table :resource_files do |t| t.column :filename, :string diff --git a/db/migrate/20141019133633_add_name_to_users.rb b/db/migrate/20141019133633_add_name_to_users.rb index bac750eb..3c0d3cb0 100644 --- a/db/migrate/20141019133633_add_name_to_users.rb +++ b/db/migrate/20141019133633_add_name_to_users.rb @@ -1,4 +1,4 @@ -class AddNameToUsers < ActiveRecord::Migration +class AddNameToUsers < ActiveRecord::Migration[5.1] def change add_column :users, :name, :string end diff --git a/db/migrate/20141019134233_create_identities.rb b/db/migrate/20141019134233_create_identities.rb index ea0b8ba8..8155c6d6 100644 --- a/db/migrate/20141019134233_create_identities.rb +++ b/db/migrate/20141019134233_create_identities.rb @@ -1,4 +1,4 @@ -class CreateIdentities < ActiveRecord::Migration +class CreateIdentities < ActiveRecord::Migration[5.1] def change create_table :identities do |t| t.references :user, index: true diff --git a/db/migrate/20141019235246_add_name_to_workouts.rb b/db/migrate/20141019235246_add_name_to_workouts.rb index b2a4c368..cc22e0ed 100644 --- a/db/migrate/20141019235246_add_name_to_workouts.rb +++ b/db/migrate/20141019235246_add_name_to_workouts.rb @@ -1,4 +1,4 @@ -class AddNameToWorkouts < ActiveRecord::Migration +class AddNameToWorkouts < ActiveRecord::Migration[5.1] def change add_column :workouts, :description, :text end diff --git a/db/migrate/20141019235449_add_target_group_to_workouts.rb b/db/migrate/20141019235449_add_target_group_to_workouts.rb index ecf3d9f1..4b3d4dc7 100644 --- a/db/migrate/20141019235449_add_target_group_to_workouts.rb +++ b/db/migrate/20141019235449_add_target_group_to_workouts.rb @@ -1,4 +1,4 @@ -class AddTargetGroupToWorkouts < ActiveRecord::Migration +class AddTargetGroupToWorkouts < ActiveRecord::Migration[5.1] def change add_column :workouts, :target_group, :string end diff --git a/db/migrate/20141019235637_add_points_multiplier_to_workouts.rb b/db/migrate/20141019235637_add_points_multiplier_to_workouts.rb index 82f44d13..83153800 100644 --- a/db/migrate/20141019235637_add_points_multiplier_to_workouts.rb +++ b/db/migrate/20141019235637_add_points_multiplier_to_workouts.rb @@ -1,4 +1,4 @@ -class AddPointsMultiplierToWorkouts < ActiveRecord::Migration +class AddPointsMultiplierToWorkouts < ActiveRecord::Migration[5.1] def change add_column :workouts, :points_multiplier, :integer end diff --git a/db/migrate/20141019235708_add_opening_date_to_workouts.rb b/db/migrate/20141019235708_add_opening_date_to_workouts.rb index 05a14f7e..9b5e4615 100644 --- a/db/migrate/20141019235708_add_opening_date_to_workouts.rb +++ b/db/migrate/20141019235708_add_opening_date_to_workouts.rb @@ -1,4 +1,4 @@ -class AddOpeningDateToWorkouts < ActiveRecord::Migration +class AddOpeningDateToWorkouts < ActiveRecord::Migration[5.1] def change add_column :workouts, :opening_date, :date end diff --git a/db/migrate/20141019235750_add_soft_deadline_to_workouts.rb b/db/migrate/20141019235750_add_soft_deadline_to_workouts.rb index a28484fd..73d0ac64 100644 --- a/db/migrate/20141019235750_add_soft_deadline_to_workouts.rb +++ b/db/migrate/20141019235750_add_soft_deadline_to_workouts.rb @@ -1,4 +1,4 @@ -class AddSoftDeadlineToWorkouts < ActiveRecord::Migration +class AddSoftDeadlineToWorkouts < ActiveRecord::Migration[5.1] def change add_column :workouts, :soft_deadline, :date end diff --git a/db/migrate/20141019235803_add_hard_deadline_to_workouts.rb b/db/migrate/20141019235803_add_hard_deadline_to_workouts.rb index 64009884..c2841eb6 100644 --- a/db/migrate/20141019235803_add_hard_deadline_to_workouts.rb +++ b/db/migrate/20141019235803_add_hard_deadline_to_workouts.rb @@ -1,4 +1,4 @@ -class AddHardDeadlineToWorkouts < ActiveRecord::Migration +class AddHardDeadlineToWorkouts < ActiveRecord::Migration[5.1] def change add_column :workouts, :hard_deadline, :date end diff --git a/db/migrate/20141102232155_create_join_table_course_offerings_workouts.rb b/db/migrate/20141102232155_create_join_table_course_offerings_workouts.rb index d8c6c79e..4d287941 100644 --- a/db/migrate/20141102232155_create_join_table_course_offerings_workouts.rb +++ b/db/migrate/20141102232155_create_join_table_course_offerings_workouts.rb @@ -1,4 +1,4 @@ -class CreateJoinTableCourseOfferingsWorkouts < ActiveRecord::Migration +class CreateJoinTableCourseOfferingsWorkouts < ActiveRecord::Migration[5.1] def change create_join_table :course_offerings, :workouts do |t| # t.index [:course_offering_id, :workout_id] diff --git a/db/migrate/20141109193127_create_workout_offerings.rb b/db/migrate/20141109193127_create_workout_offerings.rb index 005ea829..d7ca7ea1 100644 --- a/db/migrate/20141109193127_create_workout_offerings.rb +++ b/db/migrate/20141109193127_create_workout_offerings.rb @@ -1,4 +1,4 @@ -class CreateWorkoutOfferings < ActiveRecord::Migration +class CreateWorkoutOfferings < ActiveRecord::Migration[5.1] def change create_table :workout_offerings do |t| t.integer :course_offering_id diff --git a/db/migrate/20141109193909_add_deadlines_to_workout_offering.rb b/db/migrate/20141109193909_add_deadlines_to_workout_offering.rb index 2991b112..12bd1ad3 100644 --- a/db/migrate/20141109193909_add_deadlines_to_workout_offering.rb +++ b/db/migrate/20141109193909_add_deadlines_to_workout_offering.rb @@ -1,4 +1,4 @@ -class AddDeadlinesToWorkoutOffering < ActiveRecord::Migration +class AddDeadlinesToWorkoutOffering < ActiveRecord::Migration[5.1] def change add_column :workout_offerings, :opening_date, :date add_column :workout_offerings, :soft_deadline, :date diff --git a/db/migrate/20141109202442_create_exercise_workouts.rb b/db/migrate/20141109202442_create_exercise_workouts.rb index c735439b..a3fbc36c 100644 --- a/db/migrate/20141109202442_create_exercise_workouts.rb +++ b/db/migrate/20141109202442_create_exercise_workouts.rb @@ -1,4 +1,4 @@ -class CreateExerciseWorkouts < ActiveRecord::Migration +class CreateExerciseWorkouts < ActiveRecord::Migration[5.1] def change create_table :exercise_workouts do |t| t.integer :exercise_id diff --git a/db/migrate/20141109204133_fix_order_column_in_exercise_workouts.rb b/db/migrate/20141109204133_fix_order_column_in_exercise_workouts.rb index 8eb75d03..4fb5dea2 100644 --- a/db/migrate/20141109204133_fix_order_column_in_exercise_workouts.rb +++ b/db/migrate/20141109204133_fix_order_column_in_exercise_workouts.rb @@ -1,4 +1,4 @@ -class FixOrderColumnInExerciseWorkouts < ActiveRecord::Migration +class FixOrderColumnInExerciseWorkouts < ActiveRecord::Migration[5.1] def change rename_column :exercise_workouts, :order, :ordering end diff --git a/db/migrate/20141110010213_remove_deadlines_from_workouts.rb b/db/migrate/20141110010213_remove_deadlines_from_workouts.rb index e2651250..ee437307 100644 --- a/db/migrate/20141110010213_remove_deadlines_from_workouts.rb +++ b/db/migrate/20141110010213_remove_deadlines_from_workouts.rb @@ -1,4 +1,4 @@ -class RemoveDeadlinesFromWorkouts < ActiveRecord::Migration +class RemoveDeadlinesFromWorkouts < ActiveRecord::Migration[5.1] def change remove_column :workouts, :opening_date, :date remove_column :workouts, :soft_deadline, :date diff --git a/db/migrate/20141110023518_create_course_exercises.rb b/db/migrate/20141110023518_create_course_exercises.rb index 01be995f..796af32d 100644 --- a/db/migrate/20141110023518_create_course_exercises.rb +++ b/db/migrate/20141110023518_create_course_exercises.rb @@ -1,4 +1,4 @@ -class CreateCourseExercises < ActiveRecord::Migration +class CreateCourseExercises < ActiveRecord::Migration[5.1] def change create_table :course_exercises do |t| t.integer :course_id diff --git a/db/migrate/20150111180500_create_base_exercises.rb b/db/migrate/20150111180500_create_base_exercises.rb index 36129d4c..21c59d17 100644 --- a/db/migrate/20150111180500_create_base_exercises.rb +++ b/db/migrate/20150111180500_create_base_exercises.rb @@ -1,4 +1,4 @@ -class CreateBaseExercises < ActiveRecord::Migration +class CreateBaseExercises < ActiveRecord::Migration[5.1] def change create_table :base_exercises do |t| t.integer :user_id diff --git a/db/migrate/20150111182242_add_base_exercise_id_to_exercise.rb b/db/migrate/20150111182242_add_base_exercise_id_to_exercise.rb index b7457629..f6595795 100644 --- a/db/migrate/20150111182242_add_base_exercise_id_to_exercise.rb +++ b/db/migrate/20150111182242_add_base_exercise_id_to_exercise.rb @@ -1,4 +1,4 @@ -class AddBaseExerciseIdToExercise < ActiveRecord::Migration +class AddBaseExerciseIdToExercise < ActiveRecord::Migration[5.1] def change add_column :exercises, :base_exercise_id, :integer add_index :exercises, :base_exercise_id diff --git a/db/migrate/20150111185855_add_version_to_exercise.rb b/db/migrate/20150111185855_add_version_to_exercise.rb index 5b70a209..1653ac7a 100644 --- a/db/migrate/20150111185855_add_version_to_exercise.rb +++ b/db/migrate/20150111185855_add_version_to_exercise.rb @@ -1,4 +1,4 @@ -class AddVersionToExercise < ActiveRecord::Migration +class AddVersionToExercise < ActiveRecord::Migration[5.1] def change add_column :exercises, :version, :integer end diff --git a/db/migrate/20150111200649_remove_question_type_from_exercises.rb b/db/migrate/20150111200649_remove_question_type_from_exercises.rb index 8dda4ea4..1dbfe17b 100644 --- a/db/migrate/20150111200649_remove_question_type_from_exercises.rb +++ b/db/migrate/20150111200649_remove_question_type_from_exercises.rb @@ -1,4 +1,4 @@ -class RemoveQuestionTypeFromExercises < ActiveRecord::Migration +class RemoveQuestionTypeFromExercises < ActiveRecord::Migration[5.1] def change remove_column :exercises, :question_type, :integer end diff --git a/db/migrate/20150111204245_add_versions_to_base_exercises.rb b/db/migrate/20150111204245_add_versions_to_base_exercises.rb index 05cd9bdc..d45652ef 100644 --- a/db/migrate/20150111204245_add_versions_to_base_exercises.rb +++ b/db/migrate/20150111204245_add_versions_to_base_exercises.rb @@ -1,4 +1,4 @@ -class AddVersionsToBaseExercises < ActiveRecord::Migration +class AddVersionsToBaseExercises < ActiveRecord::Migration[5.1] def change add_column :base_exercises, :versions, :integer end diff --git a/db/migrate/20150111222945_remove_user_id_from_exercises.rb b/db/migrate/20150111222945_remove_user_id_from_exercises.rb index 02b2c811..6183d73c 100644 --- a/db/migrate/20150111222945_remove_user_id_from_exercises.rb +++ b/db/migrate/20150111222945_remove_user_id_from_exercises.rb @@ -1,4 +1,4 @@ -class RemoveUserIdFromExercises < ActiveRecord::Migration +class RemoveUserIdFromExercises < ActiveRecord::Migration[5.1] def change remove_column :exercises, :user_id, :integer end diff --git a/db/migrate/20150112141536_create_variation_groups.rb b/db/migrate/20150112141536_create_variation_groups.rb index b778c679..f8d8f0ed 100644 --- a/db/migrate/20150112141536_create_variation_groups.rb +++ b/db/migrate/20150112141536_create_variation_groups.rb @@ -1,4 +1,4 @@ -class CreateVariationGroups < ActiveRecord::Migration +class CreateVariationGroups < ActiveRecord::Migration[5.1] def change create_table :variation_groups do |t| t.string :title diff --git a/db/migrate/20150112143114_add_variation_group_id_to_base_exercise.rb b/db/migrate/20150112143114_add_variation_group_id_to_base_exercise.rb index e6587e36..d6518d2c 100644 --- a/db/migrate/20150112143114_add_variation_group_id_to_base_exercise.rb +++ b/db/migrate/20150112143114_add_variation_group_id_to_base_exercise.rb @@ -1,4 +1,4 @@ -class AddVariationGroupIdToBaseExercise < ActiveRecord::Migration +class AddVariationGroupIdToBaseExercise < ActiveRecord::Migration[5.1] def change add_column :base_exercises, :variation_group_id, :integer end diff --git a/db/migrate/20150117190855_create_workout_scores.rb b/db/migrate/20150117190855_create_workout_scores.rb index 849320a8..4e365f83 100644 --- a/db/migrate/20150117190855_create_workout_scores.rb +++ b/db/migrate/20150117190855_create_workout_scores.rb @@ -1,4 +1,4 @@ -class CreateWorkoutScores < ActiveRecord::Migration +class CreateWorkoutScores < ActiveRecord::Migration[5.1] def change create_table :workout_scores do |t| t.belongs_to :workout, index: true diff --git a/db/migrate/20150201192746_remove_starter_code_from_exercise.rb b/db/migrate/20150201192746_remove_starter_code_from_exercise.rb index a597797e..9dcf3bb6 100644 --- a/db/migrate/20150201192746_remove_starter_code_from_exercise.rb +++ b/db/migrate/20150201192746_remove_starter_code_from_exercise.rb @@ -1,4 +1,4 @@ -class RemoveStarterCodeFromExercise < ActiveRecord::Migration +class RemoveStarterCodeFromExercise < ActiveRecord::Migration[5.1] def change remove_column :exercises, :starter_code, :text end diff --git a/db/migrate/20150201224732_create_coding_questions.rb b/db/migrate/20150201224732_create_coding_questions.rb index c687a736..2684e9b5 100644 --- a/db/migrate/20150201224732_create_coding_questions.rb +++ b/db/migrate/20150201224732_create_coding_questions.rb @@ -1,4 +1,4 @@ -class CreateCodingQuestions < ActiveRecord::Migration +class CreateCodingQuestions < ActiveRecord::Migration[5.1] def change create_table :coding_questions do |t| t.string :base_class diff --git a/db/migrate/20150201230342_remove_columns_from_coding_question.rb b/db/migrate/20150201230342_remove_columns_from_coding_question.rb index ebba4028..731d197c 100644 --- a/db/migrate/20150201230342_remove_columns_from_coding_question.rb +++ b/db/migrate/20150201230342_remove_columns_from_coding_question.rb @@ -1,4 +1,4 @@ -class RemoveColumnsFromCodingQuestion < ActiveRecord::Migration +class RemoveColumnsFromCodingQuestion < ActiveRecord::Migration[5.1] def change remove_column :coding_questions, :base_class, :wrapper_code, :test_script end diff --git a/db/migrate/20150201230748_remove_columns_from_coding_question_2.rb b/db/migrate/20150201230748_remove_columns_from_coding_question_2.rb index 133fd10a..a62603c3 100644 --- a/db/migrate/20150201230748_remove_columns_from_coding_question_2.rb +++ b/db/migrate/20150201230748_remove_columns_from_coding_question_2.rb @@ -1,4 +1,4 @@ -class RemoveColumnsFromCodingQuestion2 < ActiveRecord::Migration +class RemoveColumnsFromCodingQuestion2 < ActiveRecord::Migration[5.1] def change remove_column :coding_questions, :wrapper_code remove_column :coding_questions, :test_script diff --git a/db/migrate/20150201231050_add_columns_to_coding_questions.rb b/db/migrate/20150201231050_add_columns_to_coding_questions.rb index 60fd28d2..a5a9caa9 100644 --- a/db/migrate/20150201231050_add_columns_to_coding_questions.rb +++ b/db/migrate/20150201231050_add_columns_to_coding_questions.rb @@ -1,4 +1,4 @@ -class AddColumnsToCodingQuestions < ActiveRecord::Migration +class AddColumnsToCodingQuestions < ActiveRecord::Migration[5.1] def change add_column :coding_questions, :base_class, :string add_column :coding_questions, :wrapper_code, :text diff --git a/db/migrate/20150201234250_add_feedback_to_coding_question.rb b/db/migrate/20150201234250_add_feedback_to_coding_question.rb index 80d11619..df7f491b 100644 --- a/db/migrate/20150201234250_add_feedback_to_coding_question.rb +++ b/db/migrate/20150201234250_add_feedback_to_coding_question.rb @@ -1,4 +1,4 @@ -class AddFeedbackToCodingQuestion < ActiveRecord::Migration +class AddFeedbackToCodingQuestion < ActiveRecord::Migration[5.1] def change add_column :coding_questions, :feedback, :text end diff --git a/db/migrate/20150201234351_remove_feedback_from_coding_question.rb b/db/migrate/20150201234351_remove_feedback_from_coding_question.rb index 7e38c183..51690638 100644 --- a/db/migrate/20150201234351_remove_feedback_from_coding_question.rb +++ b/db/migrate/20150201234351_remove_feedback_from_coding_question.rb @@ -1,4 +1,4 @@ -class RemoveFeedbackFromCodingQuestion < ActiveRecord::Migration +class RemoveFeedbackFromCodingQuestion < ActiveRecord::Migration[5.1] def change remove_column :coding_questions, :feedback, :text end diff --git a/db/migrate/20150201235152_create_test_case_results.rb b/db/migrate/20150201235152_create_test_case_results.rb index 9d38b2ca..ec2876a0 100644 --- a/db/migrate/20150201235152_create_test_case_results.rb +++ b/db/migrate/20150201235152_create_test_case_results.rb @@ -1,4 +1,4 @@ -class CreateTestCaseResults < ActiveRecord::Migration +class CreateTestCaseResults < ActiveRecord::Migration[5.1] def change create_table :test_case_results do |t| t.integer :test_case_id, index: true diff --git a/db/migrate/20150205220518_rectify_test_case_result.rb b/db/migrate/20150205220518_rectify_test_case_result.rb index 68a5af10..976d2f2c 100644 --- a/db/migrate/20150205220518_rectify_test_case_result.rb +++ b/db/migrate/20150205220518_rectify_test_case_result.rb @@ -1,4 +1,4 @@ -class RectifyTestCaseResult < ActiveRecord::Migration +class RectifyTestCaseResult < ActiveRecord::Migration[5.1] def change remove_column :test_case_results, :score, :float add_column :test_case_results, :pass, :boolean diff --git a/db/migrate/20150205220837_rectify_test_case_result2.rb b/db/migrate/20150205220837_rectify_test_case_result2.rb index 4fb8f8fd..5ab7c23c 100644 --- a/db/migrate/20150205220837_rectify_test_case_result2.rb +++ b/db/migrate/20150205220837_rectify_test_case_result2.rb @@ -1,4 +1,4 @@ -class RectifyTestCaseResult2 < ActiveRecord::Migration +class RectifyTestCaseResult2 < ActiveRecord::Migration[5.1] def change remove_column :test_case_results, :max, :boolean end diff --git a/db/migrate/20150205221653_change_score_in_attempts.rb b/db/migrate/20150205221653_change_score_in_attempts.rb index 64d4662d..f3281a22 100644 --- a/db/migrate/20150205221653_change_score_in_attempts.rb +++ b/db/migrate/20150205221653_change_score_in_attempts.rb @@ -1,4 +1,4 @@ -class ChangeScoreInAttempts < ActiveRecord::Migration +class ChangeScoreInAttempts < ActiveRecord::Migration[5.1] def change change_column :attempts, :score, :number, default: 0.0 end diff --git a/db/migrate/20150207221009_add_default_to_points_in_exercise_workouts.rb b/db/migrate/20150207221009_add_default_to_points_in_exercise_workouts.rb index d361a7a7..39fc84c8 100644 --- a/db/migrate/20150207221009_add_default_to_points_in_exercise_workouts.rb +++ b/db/migrate/20150207221009_add_default_to_points_in_exercise_workouts.rb @@ -1,4 +1,4 @@ -class AddDefaultToPointsInExerciseWorkouts < ActiveRecord::Migration +class AddDefaultToPointsInExerciseWorkouts < ActiveRecord::Migration[5.1] def change change_column :exercise_workouts, :points, :float, default: 1.0 end diff --git a/db/migrate/20150210001815_create_test_cases.rb b/db/migrate/20150210001815_create_test_cases.rb index 66e1fedf..740d8067 100644 --- a/db/migrate/20150210001815_create_test_cases.rb +++ b/db/migrate/20150210001815_create_test_cases.rb @@ -1,4 +1,4 @@ -class CreateTestCases < ActiveRecord::Migration +class CreateTestCases < ActiveRecord::Migration[5.1] def change # created in 2131210061217_add_coding_exercise_columns, # but here we blast it and recreate a new structure. diff --git a/db/migrate/20150210012044_add_test_method_to_coding_questions.rb b/db/migrate/20150210012044_add_test_method_to_coding_questions.rb index 3ee0f9c8..4d98807e 100644 --- a/db/migrate/20150210012044_add_test_method_to_coding_questions.rb +++ b/db/migrate/20150210012044_add_test_method_to_coding_questions.rb @@ -1,4 +1,4 @@ -class AddTestMethodToCodingQuestions < ActiveRecord::Migration +class AddTestMethodToCodingQuestions < ActiveRecord::Migration[5.1] def change add_column :coding_questions, :test_method, :string end diff --git a/db/migrate/20150218220059_fix_class_name_in_coding_questions.rb b/db/migrate/20150218220059_fix_class_name_in_coding_questions.rb index af9790d9..4aa8bcff 100644 --- a/db/migrate/20150218220059_fix_class_name_in_coding_questions.rb +++ b/db/migrate/20150218220059_fix_class_name_in_coding_questions.rb @@ -1,4 +1,4 @@ -class FixClassNameInCodingQuestions < ActiveRecord::Migration +class FixClassNameInCodingQuestions < ActiveRecord::Migration[5.1] def change rename_column :coding_questions, :base_class, :class_name end diff --git a/db/migrate/20150218220317_add_starter_code_to_coding_questions.rb b/db/migrate/20150218220317_add_starter_code_to_coding_questions.rb index fbb8a99c..244c99a1 100644 --- a/db/migrate/20150218220317_add_starter_code_to_coding_questions.rb +++ b/db/migrate/20150218220317_add_starter_code_to_coding_questions.rb @@ -1,4 +1,4 @@ -class AddStarterCodeToCodingQuestions < ActiveRecord::Migration +class AddStarterCodeToCodingQuestions < ActiveRecord::Migration[5.1] def change add_column :coding_questions, :starter_code, :text end diff --git a/db/migrate/20150219054901_fix_method_name_in_coding_questions.rb b/db/migrate/20150219054901_fix_method_name_in_coding_questions.rb index df69ccec..7d6f420d 100644 --- a/db/migrate/20150219054901_fix_method_name_in_coding_questions.rb +++ b/db/migrate/20150219054901_fix_method_name_in_coding_questions.rb @@ -1,4 +1,4 @@ -class FixMethodNameInCodingQuestions < ActiveRecord::Migration +class FixMethodNameInCodingQuestions < ActiveRecord::Migration[5.1] def change rename_column :coding_questions, :test_method, :method_name end diff --git a/db/migrate/20150312175933_add_creator_id_to_courses.rb b/db/migrate/20150312175933_add_creator_id_to_courses.rb index 29099c9e..fcaf04a9 100644 --- a/db/migrate/20150312175933_add_creator_id_to_courses.rb +++ b/db/migrate/20150312175933_add_creator_id_to_courses.rb @@ -1,4 +1,4 @@ -class AddCreatorIdToCourses < ActiveRecord::Migration +class AddCreatorIdToCourses < ActiveRecord::Migration[5.1] def change add_column :courses, :creator_id, :integer end diff --git a/db/migrate/20150312183927_add_creator_id_to_exercises.rb b/db/migrate/20150312183927_add_creator_id_to_exercises.rb index 0b57dcd4..99371dcb 100644 --- a/db/migrate/20150312183927_add_creator_id_to_exercises.rb +++ b/db/migrate/20150312183927_add_creator_id_to_exercises.rb @@ -1,4 +1,4 @@ -class AddCreatorIdToExercises < ActiveRecord::Migration +class AddCreatorIdToExercises < ActiveRecord::Migration[5.1] def change add_column :exercises, :creator_id, :integer end diff --git a/db/migrate/20150312184040_add_creator_id_to_base_exercises.rb b/db/migrate/20150312184040_add_creator_id_to_base_exercises.rb index dcb30a9c..833bd0a1 100644 --- a/db/migrate/20150312184040_add_creator_id_to_base_exercises.rb +++ b/db/migrate/20150312184040_add_creator_id_to_base_exercises.rb @@ -1,4 +1,4 @@ -class AddCreatorIdToBaseExercises < ActiveRecord::Migration +class AddCreatorIdToBaseExercises < ActiveRecord::Migration[5.1] def change add_column :base_exercises, :creator_id, :integer end diff --git a/db/migrate/20150312184111_add_creator_id_to_workouts.rb b/db/migrate/20150312184111_add_creator_id_to_workouts.rb index ff50203f..1245fd3f 100644 --- a/db/migrate/20150312184111_add_creator_id_to_workouts.rb +++ b/db/migrate/20150312184111_add_creator_id_to_workouts.rb @@ -1,4 +1,4 @@ -class AddCreatorIdToWorkouts < ActiveRecord::Migration +class AddCreatorIdToWorkouts < ActiveRecord::Migration[5.1] def change add_column :workouts, :creator_id, :integer end diff --git a/db/migrate/20150312184659_remove_creator_id_from_base_exercises.rb b/db/migrate/20150312184659_remove_creator_id_from_base_exercises.rb index 4b4762a1..708134ff 100644 --- a/db/migrate/20150312184659_remove_creator_id_from_base_exercises.rb +++ b/db/migrate/20150312184659_remove_creator_id_from_base_exercises.rb @@ -1,4 +1,4 @@ -class RemoveCreatorIdFromBaseExercises < ActiveRecord::Migration +class RemoveCreatorIdFromBaseExercises < ActiveRecord::Migration[5.1] def change remove_column :base_exercises, :creator_id, :integer end diff --git a/db/migrate/20150320002742_add_omniauth_columns_to_users.rb b/db/migrate/20150320002742_add_omniauth_columns_to_users.rb index 6814f682..3686ca46 100644 --- a/db/migrate/20150320002742_add_omniauth_columns_to_users.rb +++ b/db/migrate/20150320002742_add_omniauth_columns_to_users.rb @@ -1,4 +1,4 @@ -class AddOmniauthColumnsToUsers < ActiveRecord::Migration +class AddOmniauthColumnsToUsers < ActiveRecord::Migration[5.1] def change add_column :users, :provider, :string add_column :users, :uid, :string diff --git a/db/migrate/20150324135215_remove_omniauth_columns_from_users.rb b/db/migrate/20150324135215_remove_omniauth_columns_from_users.rb index 5aba20c0..64ace5a5 100644 --- a/db/migrate/20150324135215_remove_omniauth_columns_from_users.rb +++ b/db/migrate/20150324135215_remove_omniauth_columns_from_users.rb @@ -1,4 +1,4 @@ -class RemoveOmniauthColumnsFromUsers < ActiveRecord::Migration +class RemoveOmniauthColumnsFromUsers < ActiveRecord::Migration[5.1] def change remove_column :users, :provider, :string remove_column :users, :uid, :string diff --git a/db/migrate/20150325143018_add_avatar_to_users.rb b/db/migrate/20150325143018_add_avatar_to_users.rb index 7b4de37a..efc120b1 100644 --- a/db/migrate/20150325143018_add_avatar_to_users.rb +++ b/db/migrate/20150325143018_add_avatar_to_users.rb @@ -1,4 +1,4 @@ -class AddAvatarToUsers < ActiveRecord::Migration +class AddAvatarToUsers < ActiveRecord::Migration[5.1] def change add_column :users, :avatar, :string end diff --git a/db/migrate/20150325235931_rename_current_version_to_current_version_id_in_base_exercises.rb b/db/migrate/20150325235931_rename_current_version_to_current_version_id_in_base_exercises.rb index 2ef0a374..06ab6fe6 100644 --- a/db/migrate/20150325235931_rename_current_version_to_current_version_id_in_base_exercises.rb +++ b/db/migrate/20150325235931_rename_current_version_to_current_version_id_in_base_exercises.rb @@ -1,4 +1,4 @@ -class RenameCurrentVersionToCurrentVersionIdInBaseExercises < ActiveRecord::Migration +class RenameCurrentVersionToCurrentVersionIdInBaseExercises < ActiveRecord::Migration[5.1] def change rename_column :base_exercises, :current_version, :current_version_id end diff --git a/db/migrate/20150326123644_add_null_constraints_and_indices.rb b/db/migrate/20150326123644_add_null_constraints_and_indices.rb index 2d5002d7..e5ab06cf 100644 --- a/db/migrate/20150326123644_add_null_constraints_and_indices.rb +++ b/db/migrate/20150326123644_add_null_constraints_and_indices.rb @@ -1,4 +1,4 @@ -class AddNullConstraintsAndIndices < ActiveRecord::Migration +class AddNullConstraintsAndIndices < ActiveRecord::Migration[5.1] def change # identities change_column_null :identities, :user_id, false diff --git a/db/migrate/20150326163802_add_foreign_key_constraints.rb b/db/migrate/20150326163802_add_foreign_key_constraints.rb index c038c9d7..0e57ca08 100644 --- a/db/migrate/20150326163802_add_foreign_key_constraints.rb +++ b/db/migrate/20150326163802_add_foreign_key_constraints.rb @@ -1,4 +1,4 @@ -class AddForeignKeyConstraints < ActiveRecord::Migration +class AddForeignKeyConstraints < ActiveRecord::Migration[5.1] def change add_foreign_key :attempts, :exercises, dependent: :delete add_foreign_key :attempts, :users, dependent: :delete diff --git a/db/migrate/20150326173027_rename_title_to_name_in_variation_group.rb b/db/migrate/20150326173027_rename_title_to_name_in_variation_group.rb index 5d06e319..8a28f552 100644 --- a/db/migrate/20150326173027_rename_title_to_name_in_variation_group.rb +++ b/db/migrate/20150326173027_rename_title_to_name_in_variation_group.rb @@ -1,4 +1,4 @@ -class RenameTitleToNameInVariationGroup < ActiveRecord::Migration +class RenameTitleToNameInVariationGroup < ActiveRecord::Migration[5.1] def change rename_column :variation_groups, :title, :name end diff --git a/db/migrate/20150326193058_rename_ordering_to_order_in_exercise_workouts.rb b/db/migrate/20150326193058_rename_ordering_to_order_in_exercise_workouts.rb index 287b5152..c8771bc8 100644 --- a/db/migrate/20150326193058_rename_ordering_to_order_in_exercise_workouts.rb +++ b/db/migrate/20150326193058_rename_ordering_to_order_in_exercise_workouts.rb @@ -1,4 +1,4 @@ -class RenameOrderingToOrderInExerciseWorkouts < ActiveRecord::Migration +class RenameOrderingToOrderInExerciseWorkouts < ActiveRecord::Migration[5.1] def change rename_column :exercise_workouts, :ordering, :order end diff --git a/db/migrate/20150326193301_rename_title_to_name_in_exercises.rb b/db/migrate/20150326193301_rename_title_to_name_in_exercises.rb index bf76d18f..616e2e07 100644 --- a/db/migrate/20150326193301_rename_title_to_name_in_exercises.rb +++ b/db/migrate/20150326193301_rename_title_to_name_in_exercises.rb @@ -1,4 +1,4 @@ -class RenameTitleToNameInExercises < ActiveRecord::Migration +class RenameTitleToNameInExercises < ActiveRecord::Migration[5.1] def change rename_column :exercises, :title, :name end diff --git a/db/migrate/20150327213048_create_active_admin_comments.rb b/db/migrate/20150327213048_create_active_admin_comments.rb index 9efd1478..fd0c5aee 100644 --- a/db/migrate/20150327213048_create_active_admin_comments.rb +++ b/db/migrate/20150327213048_create_active_admin_comments.rb @@ -1,4 +1,4 @@ -class CreateActiveAdminComments < ActiveRecord::Migration +class CreateActiveAdminComments < ActiveRecord::Migration[5.1] def self.up create_table :active_admin_comments do |t| t.string :namespace diff --git a/db/migrate/20150328005919_rename_display_name_to_name_in_organizations.rb b/db/migrate/20150328005919_rename_display_name_to_name_in_organizations.rb index a7978380..2cefce0c 100644 --- a/db/migrate/20150328005919_rename_display_name_to_name_in_organizations.rb +++ b/db/migrate/20150328005919_rename_display_name_to_name_in_organizations.rb @@ -1,4 +1,4 @@ -class RenameDisplayNameToNameInOrganizations < ActiveRecord::Migration +class RenameDisplayNameToNameInOrganizations < ActiveRecord::Migration[5.1] def change rename_column :organizations, :display_name, :name end diff --git a/db/migrate/20150328011131_remove_name_from_users.rb b/db/migrate/20150328011131_remove_name_from_users.rb index 623cc753..b6082677 100644 --- a/db/migrate/20150328011131_remove_name_from_users.rb +++ b/db/migrate/20150328011131_remove_name_from_users.rb @@ -1,4 +1,4 @@ -class RemoveNameFromUsers < ActiveRecord::Migration +class RemoveNameFromUsers < ActiveRecord::Migration[5.1] def change remove_column :users, :name, :string end diff --git a/db/migrate/20150328150855_remove_name_from_course_offering.rb b/db/migrate/20150328150855_remove_name_from_course_offering.rb index 58dffa86..083834c6 100644 --- a/db/migrate/20150328150855_remove_name_from_course_offering.rb +++ b/db/migrate/20150328150855_remove_name_from_course_offering.rb @@ -1,4 +1,4 @@ -class RemoveNameFromCourseOffering < ActiveRecord::Migration +class RemoveNameFromCourseOffering < ActiveRecord::Migration[5.1] def change remove_column :course_offerings, :name, :string change_column_null :course_offerings, :label, false diff --git a/db/migrate/20150330194627_create_friendly_id_slugs.rb b/db/migrate/20150330194627_create_friendly_id_slugs.rb index 770f6264..6e7389c0 100644 --- a/db/migrate/20150330194627_create_friendly_id_slugs.rb +++ b/db/migrate/20150330194627_create_friendly_id_slugs.rb @@ -1,4 +1,4 @@ -class CreateFriendlyIdSlugs < ActiveRecord::Migration +class CreateFriendlyIdSlugs < ActiveRecord::Migration[5.1] def change create_table :friendly_id_slugs do |t| t.string :slug, :null => false diff --git a/db/migrate/20150331032124_add_slug_to_term.rb b/db/migrate/20150331032124_add_slug_to_term.rb index 5260747e..25ec49b8 100644 --- a/db/migrate/20150331032124_add_slug_to_term.rb +++ b/db/migrate/20150331032124_add_slug_to_term.rb @@ -1,4 +1,4 @@ -class AddSlugToTerm < ActiveRecord::Migration +class AddSlugToTerm < ActiveRecord::Migration[5.1] def up add_column :terms, :slug, :string # Force generation of slug values for all entries diff --git a/db/migrate/20150331121739_add_slug_to_organization.rb b/db/migrate/20150331121739_add_slug_to_organization.rb index a095a1ad..49abb980 100644 --- a/db/migrate/20150331121739_add_slug_to_organization.rb +++ b/db/migrate/20150331121739_add_slug_to_organization.rb @@ -1,4 +1,4 @@ -class AddSlugToOrganization < ActiveRecord::Migration +class AddSlugToOrganization < ActiveRecord::Migration[5.1] def up remove_column :organizations, :url_part, :string diff --git a/db/migrate/20150331153411_create_errors.rb b/db/migrate/20150331153411_create_errors.rb deleted file mode 100644 index 02d6fb77..00000000 --- a/db/migrate/20150331153411_create_errors.rb +++ /dev/null @@ -1,18 +0,0 @@ -class CreateErrors < ActiveRecord::Migration - def change - create_table :errors do |t| - t.string :usable_type - t.integer :usable_id - t.text :class_name - t.text :message - t.text :trace - t.text :target_url - t.text :referer_url - t.text :params - t.text :user_agent - t.timestamps - end - add_index :errors, :class_name - add_index :errors, :created_at - end -end \ No newline at end of file diff --git a/db/migrate/20150402033335_add_slug_to_course.rb b/db/migrate/20150402033335_add_slug_to_course.rb index 42219394..1bb771e1 100644 --- a/db/migrate/20150402033335_add_slug_to_course.rb +++ b/db/migrate/20150402033335_add_slug_to_course.rb @@ -1,4 +1,4 @@ -class AddSlugToCourse < ActiveRecord::Migration +class AddSlugToCourse < ActiveRecord::Migration[5.1] def up remove_index :courses, :url_part diff --git a/db/migrate/20150402043958_add_slug_to_user.rb b/db/migrate/20150402043958_add_slug_to_user.rb index 83353b7a..cdeb142d 100644 --- a/db/migrate/20150402043958_add_slug_to_user.rb +++ b/db/migrate/20150402043958_add_slug_to_user.rb @@ -1,4 +1,4 @@ -class AddSlugToUser < ActiveRecord::Migration +class AddSlugToUser < ActiveRecord::Migration[5.1] def up add_column :users, :slug, :string diff --git a/db/migrate/20150429122658_rename_exercises_to_exercise_versions.rb b/db/migrate/20150429122658_rename_exercises_to_exercise_versions.rb index 7b0563b6..46c2873e 100644 --- a/db/migrate/20150429122658_rename_exercises_to_exercise_versions.rb +++ b/db/migrate/20150429122658_rename_exercises_to_exercise_versions.rb @@ -1,4 +1,4 @@ -class RenameExercisesToExerciseVersions < ActiveRecord::Migration +class RenameExercisesToExerciseVersions < ActiveRecord::Migration[5.1] def change rename_table :exercises, :exercise_versions rename_column :attempts, :exercise_id, :exercise_version_id diff --git a/db/migrate/20150429132614_rename_base_exercises_to_exercises.rb b/db/migrate/20150429132614_rename_base_exercises_to_exercises.rb index 12046180..9bd0794d 100644 --- a/db/migrate/20150429132614_rename_base_exercises_to_exercises.rb +++ b/db/migrate/20150429132614_rename_base_exercises_to_exercises.rb @@ -1,4 +1,4 @@ -class RenameBaseExercisesToExercises < ActiveRecord::Migration +class RenameBaseExercisesToExercises < ActiveRecord::Migration[5.1] def change rename_table :base_exercises, :exercises rename_column :exercise_versions, :base_exercise_id, :exercise_id diff --git a/db/migrate/20150429135647_create_exercise_owners.rb b/db/migrate/20150429135647_create_exercise_owners.rb index fc352688..14dcd8a2 100644 --- a/db/migrate/20150429135647_create_exercise_owners.rb +++ b/db/migrate/20150429135647_create_exercise_owners.rb @@ -1,4 +1,4 @@ -class CreateExerciseOwners < ActiveRecord::Migration +class CreateExerciseOwners < ActiveRecord::Migration[5.1] def change create_table :exercise_owners do |t| t.belongs_to :exercise, null: false diff --git a/db/migrate/20150429160335_rename_variation_group_to_exercise_family.rb b/db/migrate/20150429160335_rename_variation_group_to_exercise_family.rb index 88650c87..073533ab 100644 --- a/db/migrate/20150429160335_rename_variation_group_to_exercise_family.rb +++ b/db/migrate/20150429160335_rename_variation_group_to_exercise_family.rb @@ -1,4 +1,4 @@ -class RenameVariationGroupToExerciseFamily < ActiveRecord::Migration +class RenameVariationGroupToExerciseFamily < ActiveRecord::Migration[5.1] def change rename_table :variation_groups, :exercise_families rename_column :exercises, :variation_group_id, :exercise_family_id diff --git a/db/migrate/20150429170252_remove_user_id_from_base_exercises.rb b/db/migrate/20150429170252_remove_user_id_from_base_exercises.rb index 246b9d64..0aa1b106 100644 --- a/db/migrate/20150429170252_remove_user_id_from_base_exercises.rb +++ b/db/migrate/20150429170252_remove_user_id_from_base_exercises.rb @@ -1,4 +1,4 @@ -class RemoveUserIdFromBaseExercises < ActiveRecord::Migration +class RemoveUserIdFromBaseExercises < ActiveRecord::Migration[5.1] def change remove_column :exercises, :user_id, :integer end diff --git a/db/migrate/20150430165328_rename_for_acts_as_list.rb b/db/migrate/20150430165328_rename_for_acts_as_list.rb index d1fee669..12ce39b3 100644 --- a/db/migrate/20150430165328_rename_for_acts_as_list.rb +++ b/db/migrate/20150430165328_rename_for_acts_as_list.rb @@ -1,4 +1,4 @@ -class RenameForActsAsList < ActiveRecord::Migration +class RenameForActsAsList < ActiveRecord::Migration[5.1] def change rename_column :choices, :order, :position rename_column :exercise_versions, :version, :position diff --git a/db/migrate/20150501192055_rename_prompt_features.rb b/db/migrate/20150501192055_rename_prompt_features.rb index 430a5d46..3030de55 100644 --- a/db/migrate/20150501192055_rename_prompt_features.rb +++ b/db/migrate/20150501192055_rename_prompt_features.rb @@ -1,4 +1,4 @@ -class RenamePromptFeatures < ActiveRecord::Migration +class RenamePromptFeatures < ActiveRecord::Migration[5.1] def change change_table :prompts do |t| t.remove :language_id, :integer diff --git a/db/migrate/20150502155416_rename_coding_question_in_test_cases.rb b/db/migrate/20150502155416_rename_coding_question_in_test_cases.rb index e0353351..5626cd95 100644 --- a/db/migrate/20150502155416_rename_coding_question_in_test_cases.rb +++ b/db/migrate/20150502155416_rename_coding_question_in_test_cases.rb @@ -1,4 +1,4 @@ -class RenameCodingQuestionInTestCases < ActiveRecord::Migration +class RenameCodingQuestionInTestCases < ActiveRecord::Migration[5.1] def change rename_column :test_cases, :coding_question_id, :coding_prompt_id end diff --git a/db/migrate/20150502155552_move_choices_from_exercise_versions_to_prompts.rb b/db/migrate/20150502155552_move_choices_from_exercise_versions_to_prompts.rb index f2fd6d8d..ebfe9add 100644 --- a/db/migrate/20150502155552_move_choices_from_exercise_versions_to_prompts.rb +++ b/db/migrate/20150502155552_move_choices_from_exercise_versions_to_prompts.rb @@ -1,4 +1,4 @@ -class MoveChoicesFromExerciseVersionsToPrompts < ActiveRecord::Migration +class MoveChoicesFromExerciseVersionsToPrompts < ActiveRecord::Migration[5.1] def up remove_foreign_key :choices, :exercise_versions Choice.delete_all diff --git a/db/migrate/20150502181403_move_features_from_exercise_versions_to_exercises.rb b/db/migrate/20150502181403_move_features_from_exercise_versions_to_exercises.rb index 1cce96ce..40d0cda8 100644 --- a/db/migrate/20150502181403_move_features_from_exercise_versions_to_exercises.rb +++ b/db/migrate/20150502181403_move_features_from_exercise_versions_to_exercises.rb @@ -1,4 +1,4 @@ -class MoveFeaturesFromExerciseVersionsToExercises < ActiveRecord::Migration +class MoveFeaturesFromExerciseVersionsToExercises < ActiveRecord::Migration[5.1] def up add_column :exercises, :name, :string add_column :exercises, :is_public, :boolean, null: false, default: false diff --git a/db/migrate/20150502203324_move_tags_from_exercise_versions_to_exercises.rb b/db/migrate/20150502203324_move_tags_from_exercise_versions_to_exercises.rb index 62a0cadb..5b6d7eb9 100644 --- a/db/migrate/20150502203324_move_tags_from_exercise_versions_to_exercises.rb +++ b/db/migrate/20150502203324_move_tags_from_exercise_versions_to_exercises.rb @@ -1,4 +1,4 @@ -class MoveTagsFromExerciseVersionsToExercises < ActiveRecord::Migration +class MoveTagsFromExerciseVersionsToExercises < ActiveRecord::Migration[5.1] def up drop_table :exercise_versions_tags create_table :exercises_tags, id: false do |t| diff --git a/db/migrate/20150502210227_add_stats_to_exercises.rb b/db/migrate/20150502210227_add_stats_to_exercises.rb index 9d01f770..f56379de 100644 --- a/db/migrate/20150502210227_add_stats_to_exercises.rb +++ b/db/migrate/20150502210227_add_stats_to_exercises.rb @@ -1,4 +1,4 @@ -class AddStatsToExercises < ActiveRecord::Migration +class AddStatsToExercises < ActiveRecord::Migration[5.1] def change change_table :exercises do |t| t.integer :attempt_count, null: false, default: 0 diff --git a/db/migrate/20150502210606_remove_question_from_exercise_versions.rb b/db/migrate/20150502210606_remove_question_from_exercise_versions.rb index 92249f97..53ddacab 100644 --- a/db/migrate/20150502210606_remove_question_from_exercise_versions.rb +++ b/db/migrate/20150502210606_remove_question_from_exercise_versions.rb @@ -1,4 +1,4 @@ -class RemoveQuestionFromExerciseVersions < ActiveRecord::Migration +class RemoveQuestionFromExerciseVersions < ActiveRecord::Migration[5.1] def up remove_column :exercise_versions, :question, :text change_column :choices, :answer, :text diff --git a/db/migrate/20150503003408_add_workout_offering_to_workout_score.rb b/db/migrate/20150503003408_add_workout_offering_to_workout_score.rb index 81871628..3c267068 100644 --- a/db/migrate/20150503003408_add_workout_offering_to_workout_score.rb +++ b/db/migrate/20150503003408_add_workout_offering_to_workout_score.rb @@ -1,4 +1,4 @@ -class AddWorkoutOfferingToWorkoutScore < ActiveRecord::Migration +class AddWorkoutOfferingToWorkoutScore < ActiveRecord::Migration[5.1] def change change_table :workout_scores do |t| t.belongs_to :workout_offering diff --git a/db/migrate/20150503004546_add_to_attempt.rb b/db/migrate/20150503004546_add_to_attempt.rb index 8f11a753..7a03e20c 100644 --- a/db/migrate/20150503004546_add_to_attempt.rb +++ b/db/migrate/20150503004546_add_to_attempt.rb @@ -1,4 +1,4 @@ -class AddToAttempt < ActiveRecord::Migration +class AddToAttempt < ActiveRecord::Migration[5.1] def change change_table :attempts do |t| t.belongs_to :workout_score diff --git a/db/migrate/20150503153952_create_workout_owners.rb b/db/migrate/20150503153952_create_workout_owners.rb index 72f1a64f..dccd31c9 100644 --- a/db/migrate/20150503153952_create_workout_owners.rb +++ b/db/migrate/20150503153952_create_workout_owners.rb @@ -1,4 +1,4 @@ -class CreateWorkoutOwners < ActiveRecord::Migration +class CreateWorkoutOwners < ActiveRecord::Migration[5.1] def change create_table :workout_owners do |t| t.belongs_to :workout, null: false diff --git a/db/migrate/20150503190401_fix_choice_answer.rb b/db/migrate/20150503190401_fix_choice_answer.rb index ab3dd506..ca9bddc8 100644 --- a/db/migrate/20150503190401_fix_choice_answer.rb +++ b/db/migrate/20150503190401_fix_choice_answer.rb @@ -1,4 +1,4 @@ -class FixChoiceAnswer < ActiveRecord::Migration +class FixChoiceAnswer < ActiveRecord::Migration[5.1] def up remove_column :choices, :answer add_column :choices, :answer, :text diff --git a/db/migrate/20150503232731_create_prompt_answer.rb b/db/migrate/20150503232731_create_prompt_answer.rb index 21102ca0..df3c70f1 100644 --- a/db/migrate/20150503232731_create_prompt_answer.rb +++ b/db/migrate/20150503232731_create_prompt_answer.rb @@ -1,4 +1,4 @@ -class CreatePromptAnswer < ActiveRecord::Migration +class CreatePromptAnswer < ActiveRecord::Migration[5.1] def change create_table :prompt_answers do |t| t.belongs_to :attempt, required: true diff --git a/db/migrate/20150504000235_create_coding_prompt_answer.rb b/db/migrate/20150504000235_create_coding_prompt_answer.rb index 700a2618..1b9668ed 100644 --- a/db/migrate/20150504000235_create_coding_prompt_answer.rb +++ b/db/migrate/20150504000235_create_coding_prompt_answer.rb @@ -1,4 +1,4 @@ -class CreateCodingPromptAnswer < ActiveRecord::Migration +class CreateCodingPromptAnswer < ActiveRecord::Migration[5.1] def change remove_column :attempts, :answer, :text remove_column :attempts, :workout_offering_id, :integer diff --git a/db/migrate/20150504002111_create_multiple_choice_prompt_answer.rb b/db/migrate/20150504002111_create_multiple_choice_prompt_answer.rb index b45e3ec4..5b39cfa8 100644 --- a/db/migrate/20150504002111_create_multiple_choice_prompt_answer.rb +++ b/db/migrate/20150504002111_create_multiple_choice_prompt_answer.rb @@ -1,4 +1,4 @@ -class CreateMultipleChoicePromptAnswer < ActiveRecord::Migration +class CreateMultipleChoicePromptAnswer < ActiveRecord::Migration[5.1] def change create_table :multiple_choice_prompt_answers do |t| end diff --git a/db/migrate/20150504004247_create_irt_data.rb b/db/migrate/20150504004247_create_irt_data.rb index e3f45c68..42d5c4eb 100644 --- a/db/migrate/20150504004247_create_irt_data.rb +++ b/db/migrate/20150504004247_create_irt_data.rb @@ -1,4 +1,4 @@ -class CreateIRTData < ActiveRecord::Migration +class CreateIRTData < ActiveRecord::Migration[5.1] def change create_table :irt_data do |t| t.integer :attempt_count, null: false diff --git a/db/migrate/20150504051530_add_cutoff_date_to_course_offerings.rb b/db/migrate/20150504051530_add_cutoff_date_to_course_offerings.rb index 13d879e0..baf141e6 100644 --- a/db/migrate/20150504051530_add_cutoff_date_to_course_offerings.rb +++ b/db/migrate/20150504051530_add_cutoff_date_to_course_offerings.rb @@ -1,4 +1,4 @@ -class AddCutoffDateToCourseOfferings < ActiveRecord::Migration +class AddCutoffDateToCourseOfferings < ActiveRecord::Migration[5.1] def change add_column :course_offerings, :cutoff_date, :date end diff --git a/db/migrate/20150506122722_create_attempts_tag_user_scores.rb b/db/migrate/20150506122722_create_attempts_tag_user_scores.rb index ef696c64..dbcde3dc 100644 --- a/db/migrate/20150506122722_create_attempts_tag_user_scores.rb +++ b/db/migrate/20150506122722_create_attempts_tag_user_scores.rb @@ -1,4 +1,4 @@ -class CreateAttemptsTagUserScores < ActiveRecord::Migration +class CreateAttemptsTagUserScores < ActiveRecord::Migration[5.1] def change # HABTM table attempts <-> tag_user_scores (many to many) create_table :attempts_tag_user_scores, id: false do |t| diff --git a/db/migrate/20150506124650_remove_target_group_from_workouts.rb b/db/migrate/20150506124650_remove_target_group_from_workouts.rb index fe5e2bfb..f4b56107 100644 --- a/db/migrate/20150506124650_remove_target_group_from_workouts.rb +++ b/db/migrate/20150506124650_remove_target_group_from_workouts.rb @@ -1,4 +1,4 @@ -class RemoveTargetGroupFromWorkouts < ActiveRecord::Migration +class RemoveTargetGroupFromWorkouts < ActiveRecord::Migration[5.1] def change remove_column :workouts, :target_group, :string end diff --git a/db/migrate/20150506161404_add.rb b/db/migrate/20150506161404_add.rb index 828aaf95..3d383b6d 100644 --- a/db/migrate/20150506161404_add.rb +++ b/db/migrate/20150506161404_add.rb @@ -1,4 +1,4 @@ -class Add < ActiveRecord::Migration +class Add < ActiveRecord::Migration[5.1] def change add_column :exercises, :external_id, :string add_index :exercises, :external_id, unique: true diff --git a/db/migrate/20150507004949_remove_is_scrambled_from_prompt.rb b/db/migrate/20150507004949_remove_is_scrambled_from_prompt.rb index b475f286..8a1b0059 100644 --- a/db/migrate/20150507004949_remove_is_scrambled_from_prompt.rb +++ b/db/migrate/20150507004949_remove_is_scrambled_from_prompt.rb @@ -1,4 +1,4 @@ -class RemoveIsScrambledFromPrompt < ActiveRecord::Migration +class RemoveIsScrambledFromPrompt < ActiveRecord::Migration[5.1] def change remove_column :prompts, :is_scrambled, :boolean end diff --git a/db/migrate/20150507140447_remove_null_constraint_from_exercise_current_version.rb b/db/migrate/20150507140447_remove_null_constraint_from_exercise_current_version.rb index 618b5c92..4e013488 100644 --- a/db/migrate/20150507140447_remove_null_constraint_from_exercise_current_version.rb +++ b/db/migrate/20150507140447_remove_null_constraint_from_exercise_current_version.rb @@ -1,4 +1,4 @@ -class RemoveNullConstraintFromExerciseCurrentVersion < ActiveRecord::Migration +class RemoveNullConstraintFromExerciseCurrentVersion < ActiveRecord::Migration[5.1] def change change_column_null :exercises, :current_version_id, true end diff --git a/db/migrate/20150507143058_rename_prompt_to_question_in_prompts.rb b/db/migrate/20150507143058_rename_prompt_to_question_in_prompts.rb index 6d41330b..2088243d 100644 --- a/db/migrate/20150507143058_rename_prompt_to_question_in_prompts.rb +++ b/db/migrate/20150507143058_rename_prompt_to_question_in_prompts.rb @@ -1,4 +1,4 @@ -class RenamePromptToQuestionInPrompts < ActiveRecord::Migration +class RenamePromptToQuestionInPrompts < ActiveRecord::Migration[5.1] def change rename_column :prompts, :prompt, :question end diff --git a/db/migrate/20150507163037_remove_tags.rb b/db/migrate/20150507163037_remove_tags.rb index 66a199cc..ae34cd61 100644 --- a/db/migrate/20150507163037_remove_tags.rb +++ b/db/migrate/20150507163037_remove_tags.rb @@ -1,4 +1,4 @@ -class RemoveTags < ActiveRecord::Migration +class RemoveTags < ActiveRecord::Migration[5.1] def up drop_table :exercises_tags remove_column :tag_user_scores, :tag_id, :integer diff --git a/db/migrate/20150507164239_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb b/db/migrate/20150507164239_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb index 6bbd5594..27b770f7 100644 --- a/db/migrate/20150507164239_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb +++ b/db/migrate/20150507164239_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb @@ -1,5 +1,5 @@ # This migration comes from acts_as_taggable_on_engine (originally 1) -class ActsAsTaggableOnMigration < ActiveRecord::Migration +class ActsAsTaggableOnMigration < ActiveRecord::Migration[5.1] def self.up create_table :tags do |t| t.string :name diff --git a/db/migrate/20150507164240_add_missing_unique_indices.acts_as_taggable_on_engine.rb b/db/migrate/20150507164240_add_missing_unique_indices.acts_as_taggable_on_engine.rb index 4ca676f6..404230a5 100644 --- a/db/migrate/20150507164240_add_missing_unique_indices.acts_as_taggable_on_engine.rb +++ b/db/migrate/20150507164240_add_missing_unique_indices.acts_as_taggable_on_engine.rb @@ -1,5 +1,5 @@ # This migration comes from acts_as_taggable_on_engine (originally 2) -class AddMissingUniqueIndices < ActiveRecord::Migration +class AddMissingUniqueIndices < ActiveRecord::Migration[5.1] def self.up add_index :tags, :name, unique: true diff --git a/db/migrate/20150507164241_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb b/db/migrate/20150507164241_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb index 8edb5080..c54fffea 100644 --- a/db/migrate/20150507164241_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb +++ b/db/migrate/20150507164241_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb @@ -1,5 +1,5 @@ # This migration comes from acts_as_taggable_on_engine (originally 3) -class AddTaggingsCounterCacheToTags < ActiveRecord::Migration +class AddTaggingsCounterCacheToTags < ActiveRecord::Migration[5.1] def self.up add_column :tags, :taggings_count, :integer, default: 0 diff --git a/db/migrate/20150507164242_add_missing_taggable_index.acts_as_taggable_on_engine.rb b/db/migrate/20150507164242_add_missing_taggable_index.acts_as_taggable_on_engine.rb index 71f2d7f4..a298379c 100644 --- a/db/migrate/20150507164242_add_missing_taggable_index.acts_as_taggable_on_engine.rb +++ b/db/migrate/20150507164242_add_missing_taggable_index.acts_as_taggable_on_engine.rb @@ -1,5 +1,5 @@ # This migration comes from acts_as_taggable_on_engine (originally 4) -class AddMissingTaggableIndex < ActiveRecord::Migration +class AddMissingTaggableIndex < ActiveRecord::Migration[5.1] def self.up add_index :taggings, [:taggable_id, :taggable_type, :context] end diff --git a/db/migrate/20150507164243_change_collation_for_tag_names.acts_as_taggable_on_engine.rb b/db/migrate/20150507164243_change_collation_for_tag_names.acts_as_taggable_on_engine.rb index bfb06bc7..980f110a 100644 --- a/db/migrate/20150507164243_change_collation_for_tag_names.acts_as_taggable_on_engine.rb +++ b/db/migrate/20150507164243_change_collation_for_tag_names.acts_as_taggable_on_engine.rb @@ -1,7 +1,7 @@ # This migration comes from acts_as_taggable_on_engine (originally 5) # This migration is added to circumvent issue #623 and have special characters # work properly -class ChangeCollationForTagNames < ActiveRecord::Migration +class ChangeCollationForTagNames < ActiveRecord::Migration[5.1] def up if ActsAsTaggableOn::Utils.using_mysql? execute("ALTER TABLE tags MODIFY name varchar(255) CHARACTER SET utf8 COLLATE utf8_bin;") diff --git a/db/migrate/20150510144703_rename_position_to_version_in_exercise_versions.rb b/db/migrate/20150510144703_rename_position_to_version_in_exercise_versions.rb index ffa9f6a5..cd4c668c 100644 --- a/db/migrate/20150510144703_rename_position_to_version_in_exercise_versions.rb +++ b/db/migrate/20150510144703_rename_position_to_version_in_exercise_versions.rb @@ -1,4 +1,4 @@ -class RenamePositionToVersionInExerciseVersions < ActiveRecord::Migration +class RenamePositionToVersionInExerciseVersions < ActiveRecord::Migration[5.1] def change rename_column :exercise_versions, :position, :version change_column_null :exercises, :versions, true diff --git a/db/migrate/20150511225412_actable_ids_are_not_unique.rb b/db/migrate/20150511225412_actable_ids_are_not_unique.rb index bd380e5a..339e0617 100644 --- a/db/migrate/20150511225412_actable_ids_are_not_unique.rb +++ b/db/migrate/20150511225412_actable_ids_are_not_unique.rb @@ -1,4 +1,4 @@ -class ActableIdsAreNotUnique < ActiveRecord::Migration +class ActableIdsAreNotUnique < ActiveRecord::Migration[5.1] def up # Remove unique: true from these two indices remove_index :prompts, :actable_id diff --git a/db/migrate/20150515205710_revise_test_case_structure.rb b/db/migrate/20150515205710_revise_test_case_structure.rb index a09085bb..b1ff1a11 100644 --- a/db/migrate/20150515205710_revise_test_case_structure.rb +++ b/db/migrate/20150515205710_revise_test_case_structure.rb @@ -1,4 +1,4 @@ -class ReviseTestCaseStructure < ActiveRecord::Migration +class ReviseTestCaseStructure < ActiveRecord::Migration[5.1] def up change_table :test_cases do |t| t.remove :test_script, :string diff --git a/db/migrate/20150522205618_add_answer_to_multiple_choice_prompt_answers.rb b/db/migrate/20150522205618_add_answer_to_multiple_choice_prompt_answers.rb index 460c7167..4e5c148e 100644 --- a/db/migrate/20150522205618_add_answer_to_multiple_choice_prompt_answers.rb +++ b/db/migrate/20150522205618_add_answer_to_multiple_choice_prompt_answers.rb @@ -1,4 +1,4 @@ -class AddAnswerToMultipleChoicePromptAnswers < ActiveRecord::Migration +class AddAnswerToMultipleChoicePromptAnswers < ActiveRecord::Migration[5.1] def change add_column :multiple_choice_prompt_answers, :answer, :string end diff --git a/db/migrate/20150525184958_remove_answer_from_multiple_choice_prompt_answers.rb b/db/migrate/20150525184958_remove_answer_from_multiple_choice_prompt_answers.rb index 67fc633d..7a99de60 100644 --- a/db/migrate/20150525184958_remove_answer_from_multiple_choice_prompt_answers.rb +++ b/db/migrate/20150525184958_remove_answer_from_multiple_choice_prompt_answers.rb @@ -1,4 +1,4 @@ -class RemoveAnswerFromMultipleChoicePromptAnswers < ActiveRecord::Migration +class RemoveAnswerFromMultipleChoicePromptAnswers < ActiveRecord::Migration[5.1] def change remove_column :multiple_choice_prompt_answers, :answer, :string end diff --git a/db/migrate/20150528120715_add_error_to_coding_prompt_answer.rb b/db/migrate/20150528120715_add_error_to_coding_prompt_answer.rb index adba7c7a..b5f117e0 100644 --- a/db/migrate/20150528120715_add_error_to_coding_prompt_answer.rb +++ b/db/migrate/20150528120715_add_error_to_coding_prompt_answer.rb @@ -1,4 +1,4 @@ -class AddErrorToCodingPromptAnswer < ActiveRecord::Migration +class AddErrorToCodingPromptAnswer < ActiveRecord::Migration[5.1] def change add_column :coding_prompt_answers, :error, :text end diff --git a/db/migrate/20150531004056_change_class_name_to_string_in_errors.rb b/db/migrate/20150531004056_change_class_name_to_string_in_errors.rb index 872a9d3c..71d3691c 100644 --- a/db/migrate/20150531004056_change_class_name_to_string_in_errors.rb +++ b/db/migrate/20150531004056_change_class_name_to_string_in_errors.rb @@ -1,4 +1,4 @@ -class ChangeClassNameToStringInErrors < ActiveRecord::Migration +class ChangeClassNameToStringInErrors < ActiveRecord::Migration[5.1] def change change_column :errors, :class_name, :string end diff --git a/db/migrate/20150604011650_add_published_to_workout_offerings.rb b/db/migrate/20150604011650_add_published_to_workout_offerings.rb index 59e4a5ca..cf56c5ef 100644 --- a/db/migrate/20150604011650_add_published_to_workout_offerings.rb +++ b/db/migrate/20150604011650_add_published_to_workout_offerings.rb @@ -1,4 +1,4 @@ -class AddPublishedToWorkoutOfferings < ActiveRecord::Migration +class AddPublishedToWorkoutOfferings < ActiveRecord::Migration[5.1] def change add_column :workout_offerings, :published, :boolean, null: false, default: true diff --git a/db/migrate/20150608001534_change_dates_to_datetimes_in_workout_offerings.rb b/db/migrate/20150608001534_change_dates_to_datetimes_in_workout_offerings.rb index 6c00878d..79d7acb0 100644 --- a/db/migrate/20150608001534_change_dates_to_datetimes_in_workout_offerings.rb +++ b/db/migrate/20150608001534_change_dates_to_datetimes_in_workout_offerings.rb @@ -1,4 +1,4 @@ -class ChangeDatesToDatetimesInWorkoutOfferings < ActiveRecord::Migration +class ChangeDatesToDatetimesInWorkoutOfferings < ActiveRecord::Migration[5.1] def change change_column :workout_offerings, :opening_date, :datetime change_column :workout_offerings, :soft_deadline, :datetime diff --git a/db/migrate/20150912035415_create_time_zones.rb b/db/migrate/20150912035415_create_time_zones.rb index 7c0241a4..f5ecb2c2 100644 --- a/db/migrate/20150912035415_create_time_zones.rb +++ b/db/migrate/20150912035415_create_time_zones.rb @@ -1,4 +1,4 @@ -class CreateTimeZones < ActiveRecord::Migration +class CreateTimeZones < ActiveRecord::Migration[5.1] def change create_table :time_zones do |t| t.string :name diff --git a/db/migrate/20150912200222_add_time_zone_id_to_users.rb b/db/migrate/20150912200222_add_time_zone_id_to_users.rb index 5a3f6ae0..86553f82 100644 --- a/db/migrate/20150912200222_add_time_zone_id_to_users.rb +++ b/db/migrate/20150912200222_add_time_zone_id_to_users.rb @@ -1,4 +1,4 @@ -class AddTimeZoneIdToUsers < ActiveRecord::Migration +class AddTimeZoneIdToUsers < ActiveRecord::Migration[5.1] def change add_reference :users, :time_zone, index: true end diff --git a/db/migrate/20150916031620_add_current_workout_score_to_users.rb b/db/migrate/20150916031620_add_current_workout_score_to_users.rb index 858b7a41..4271cf23 100644 --- a/db/migrate/20150916031620_add_current_workout_score_to_users.rb +++ b/db/migrate/20150916031620_add_current_workout_score_to_users.rb @@ -1,4 +1,4 @@ -class AddCurrentWorkoutScoreToUsers < ActiveRecord::Migration +class AddCurrentWorkoutScoreToUsers < ActiveRecord::Migration[5.1] def change change_table :users do |t| t.integer :current_workout_score_id diff --git a/db/migrate/20150921113747_add_is_public_to_workouts.rb b/db/migrate/20150921113747_add_is_public_to_workouts.rb index 132650ad..3d71d5f8 100644 --- a/db/migrate/20150921113747_add_is_public_to_workouts.rb +++ b/db/migrate/20150921113747_add_is_public_to_workouts.rb @@ -1,4 +1,4 @@ -class AddIsPublicToWorkouts < ActiveRecord::Migration +class AddIsPublicToWorkouts < ActiveRecord::Migration[5.1] def change add_column :workouts, :is_public, :boolean add_index :workouts, :is_public diff --git a/db/migrate/20150923144539_add_feedback_ready_to_attempts.rb b/db/migrate/20150923144539_add_feedback_ready_to_attempts.rb index 32e3f89a..ff66bdb8 100644 --- a/db/migrate/20150923144539_add_feedback_ready_to_attempts.rb +++ b/db/migrate/20150923144539_add_feedback_ready_to_attempts.rb @@ -1,4 +1,4 @@ -class AddFeedbackReadyToAttempts < ActiveRecord::Migration +class AddFeedbackReadyToAttempts < ActiveRecord::Migration[5.1] def change add_column :attempts, :feedback_ready, :boolean end diff --git a/db/migrate/20150927020504_create_student_extensions.rb b/db/migrate/20150927020504_create_student_extensions.rb index f489f3cb..e63ffd64 100644 --- a/db/migrate/20150927020504_create_student_extensions.rb +++ b/db/migrate/20150927020504_create_student_extensions.rb @@ -1,4 +1,4 @@ -class CreateStudentExtensions < ActiveRecord::Migration +class CreateStudentExtensions < ActiveRecord::Migration[5.1] def change create_table :student_extensions do |t| t.belongs_to :user, index: true diff --git a/db/migrate/20151015033713_add_time_limit_to_workout_offerings.rb b/db/migrate/20151015033713_add_time_limit_to_workout_offerings.rb index b6ae97ed..fe778300 100644 --- a/db/migrate/20151015033713_add_time_limit_to_workout_offerings.rb +++ b/db/migrate/20151015033713_add_time_limit_to_workout_offerings.rb @@ -1,4 +1,4 @@ -class AddTimeLimitToWorkoutOfferings < ActiveRecord::Migration +class AddTimeLimitToWorkoutOfferings < ActiveRecord::Migration[5.1] def change add_column :workout_offerings, :time_limit, :int end diff --git a/db/migrate/20151015035823_create_workout_policy.rb b/db/migrate/20151015035823_create_workout_policy.rb index 9a1e1279..ba2956a1 100644 --- a/db/migrate/20151015035823_create_workout_policy.rb +++ b/db/migrate/20151015035823_create_workout_policy.rb @@ -1,4 +1,4 @@ -class CreateWorkoutPolicy < ActiveRecord::Migration +class CreateWorkoutPolicy < ActiveRecord::Migration[5.1] def change create_table :workout_policies do |t| t.boolean :hide_thumbnails_before_start diff --git a/db/migrate/20151015044326_add_time_limit_to_student_extensions.rb b/db/migrate/20151015044326_add_time_limit_to_student_extensions.rb index e5ac608a..c45420a8 100644 --- a/db/migrate/20151015044326_add_time_limit_to_student_extensions.rb +++ b/db/migrate/20151015044326_add_time_limit_to_student_extensions.rb @@ -1,4 +1,4 @@ -class AddTimeLimitToStudentExtensions < ActiveRecord::Migration +class AddTimeLimitToStudentExtensions < ActiveRecord::Migration[5.1] def change add_column :student_extensions, :time_limit, :int end diff --git a/db/migrate/20160217060925_add_invisible_before_review_to_workout_policies.rb b/db/migrate/20160217060925_add_invisible_before_review_to_workout_policies.rb index e8e4b810..3af4327e 100644 --- a/db/migrate/20160217060925_add_invisible_before_review_to_workout_policies.rb +++ b/db/migrate/20160217060925_add_invisible_before_review_to_workout_policies.rb @@ -1,4 +1,4 @@ -class AddInvisibleBeforeReviewToWorkoutPolicies < ActiveRecord::Migration +class AddInvisibleBeforeReviewToWorkoutPolicies < ActiveRecord::Migration[5.1] def change add_column :workout_policies, :invisible_before_review, :boolean end diff --git a/db/migrate/20160224064748_add_opening_date_to_student_extensions.rb b/db/migrate/20160224064748_add_opening_date_to_student_extensions.rb index 8439845f..27f2bb02 100644 --- a/db/migrate/20160224064748_add_opening_date_to_student_extensions.rb +++ b/db/migrate/20160224064748_add_opening_date_to_student_extensions.rb @@ -1,4 +1,4 @@ -class AddOpeningDateToStudentExtensions < ActiveRecord::Migration +class AddOpeningDateToStudentExtensions < ActiveRecord::Migration[5.1] def change add_column :student_extensions, :opening_date, :datetime end diff --git a/db/migrate/20160225005739_add_continue_from_workout_id_to_workout_offerings.rb b/db/migrate/20160225005739_add_continue_from_workout_id_to_workout_offerings.rb index 9679d91a..08e26ea7 100644 --- a/db/migrate/20160225005739_add_continue_from_workout_id_to_workout_offerings.rb +++ b/db/migrate/20160225005739_add_continue_from_workout_id_to_workout_offerings.rb @@ -1,4 +1,4 @@ -class AddContinueFromWorkoutIdToWorkoutOfferings < ActiveRecord::Migration +class AddContinueFromWorkoutIdToWorkoutOfferings < ActiveRecord::Migration[5.1] def change change_table :workout_offerings do |t| t.integer :continue_from_workout_id diff --git a/db/migrate/20160512005525_add_keys.rb b/db/migrate/20160512005525_add_keys.rb index 9fba7eab..2cb120ee 100644 --- a/db/migrate/20160512005525_add_keys.rb +++ b/db/migrate/20160512005525_add_keys.rb @@ -1,4 +1,4 @@ -class AddKeys < ActiveRecord::Migration +class AddKeys < ActiveRecord::Migration[5.1] def change add_foreign_key "attempts", "workout_scores", name: "attempts_active_score_id_fk", column: "active_score_id" add_foreign_key "attempts", "exercise_versions", name: "attempts_exercise_version_id_fk" diff --git a/db/migrate/20160525210736_add_lis_info_to_workout_score.rb b/db/migrate/20160525210736_add_lis_info_to_workout_score.rb index a03d3cc0..2bc7ecfc 100644 --- a/db/migrate/20160525210736_add_lis_info_to_workout_score.rb +++ b/db/migrate/20160525210736_add_lis_info_to_workout_score.rb @@ -1,4 +1,4 @@ -class AddLisInfoToWorkoutScore < ActiveRecord::Migration +class AddLisInfoToWorkoutScore < ActiveRecord::Migration[5.1] def change add_column :workout_scores, :lis_outcome_service_url, :string add_column :workout_scores, :lis_result_sourcedid, :string diff --git a/db/migrate/20160602163822_create_lms_instances.rb b/db/migrate/20160602163822_create_lms_instances.rb index e2f70f00..bfe2366c 100644 --- a/db/migrate/20160602163822_create_lms_instances.rb +++ b/db/migrate/20160602163822_create_lms_instances.rb @@ -1,4 +1,4 @@ -class CreateLmsInstances < ActiveRecord::Migration +class CreateLmsInstances < ActiveRecord::Migration[5.1] def change create_table :lms_instances do |t| t.string :consumer_key diff --git a/db/migrate/20160602181823_add_url_to_lms_instance.rb b/db/migrate/20160602181823_add_url_to_lms_instance.rb index 9b3eefaf..808e20a3 100644 --- a/db/migrate/20160602181823_add_url_to_lms_instance.rb +++ b/db/migrate/20160602181823_add_url_to_lms_instance.rb @@ -1,4 +1,4 @@ -class AddUrlToLmsInstance < ActiveRecord::Migration +class AddUrlToLmsInstance < ActiveRecord::Migration[5.1] def change add_column :lms_instances, :url, :string diff --git a/db/migrate/20160602182001_create_lms_types.rb b/db/migrate/20160602182001_create_lms_types.rb index 76466e60..6c89d67c 100644 --- a/db/migrate/20160602182001_create_lms_types.rb +++ b/db/migrate/20160602182001_create_lms_types.rb @@ -1,4 +1,4 @@ -class CreateLmsTypes < ActiveRecord::Migration +class CreateLmsTypes < ActiveRecord::Migration[5.1] def change create_table :lms_types do |t| t.string :name, null: false diff --git a/db/migrate/20160602182220_add_lms_type_id_to_lms_instance.rb b/db/migrate/20160602182220_add_lms_type_id_to_lms_instance.rb index d707e7d7..33cecc60 100644 --- a/db/migrate/20160602182220_add_lms_type_id_to_lms_instance.rb +++ b/db/migrate/20160602182220_add_lms_type_id_to_lms_instance.rb @@ -1,4 +1,4 @@ -class AddLmsTypeIdToLmsInstance < ActiveRecord::Migration +class AddLmsTypeIdToLmsInstance < ActiveRecord::Migration[5.1] def change add_column :lms_instances, :lms_type_id, :integer add_foreign_key :lms_instances, :lms_types diff --git a/db/migrate/20160602185259_add_lms_instance_to_course_offering.rb b/db/migrate/20160602185259_add_lms_instance_to_course_offering.rb index a545eb18..3c286e74 100644 --- a/db/migrate/20160602185259_add_lms_instance_to_course_offering.rb +++ b/db/migrate/20160602185259_add_lms_instance_to_course_offering.rb @@ -1,4 +1,4 @@ -class AddLmsInstanceToCourseOffering < ActiveRecord::Migration +class AddLmsInstanceToCourseOffering < ActiveRecord::Migration[5.1] def change add_reference :course_offerings, :lms_instance, index: true end diff --git a/db/migrate/20160614153123_add_organization_ref_to_lms_instances.rb b/db/migrate/20160614153123_add_organization_ref_to_lms_instances.rb index 26dccce5..974df39a 100644 --- a/db/migrate/20160614153123_add_organization_ref_to_lms_instances.rb +++ b/db/migrate/20160614153123_add_organization_ref_to_lms_instances.rb @@ -1,4 +1,4 @@ -class AddOrganizationRefToLmsInstances < ActiveRecord::Migration +class AddOrganizationRefToLmsInstances < ActiveRecord::Migration[5.1] def change add_reference :lms_instances, :organization, index: true end diff --git a/db/migrate/20160706143029_add_lms_assignment_id_to_workout_offerings.rb b/db/migrate/20160706143029_add_lms_assignment_id_to_workout_offerings.rb index da283a71..32dc4c69 100644 --- a/db/migrate/20160706143029_add_lms_assignment_id_to_workout_offerings.rb +++ b/db/migrate/20160706143029_add_lms_assignment_id_to_workout_offerings.rb @@ -1,4 +1,4 @@ -class AddLmsAssignmentIdToWorkoutOfferings < ActiveRecord::Migration +class AddLmsAssignmentIdToWorkoutOfferings < ActiveRecord::Migration[5.1] def change add_column :workout_offerings, :lms_assignment_id, :string diff --git a/db/migrate/20160707200651_make_workout_offerings_published_by_default.rb b/db/migrate/20160707200651_make_workout_offerings_published_by_default.rb index d7f72f31..2d41c75a 100644 --- a/db/migrate/20160707200651_make_workout_offerings_published_by_default.rb +++ b/db/migrate/20160707200651_make_workout_offerings_published_by_default.rb @@ -1,4 +1,4 @@ -class MakeWorkoutOfferingsPublishedByDefault < ActiveRecord::Migration +class MakeWorkoutOfferingsPublishedByDefault < ActiveRecord::Migration[5.1] def change change_column :workout_offerings, :published, :boolean, default: true end diff --git a/db/migrate/20160829140059_add_description_to_workout_policies.rb b/db/migrate/20160829140059_add_description_to_workout_policies.rb index 3d5bf37a..fa5defa1 100644 --- a/db/migrate/20160829140059_add_description_to_workout_policies.rb +++ b/db/migrate/20160829140059_add_description_to_workout_policies.rb @@ -1,4 +1,4 @@ -class AddDescriptionToWorkoutPolicies < ActiveRecord::Migration +class AddDescriptionToWorkoutPolicies < ActiveRecord::Migration[5.1] def change add_column :workout_policies, :description, :string end diff --git a/db/migrate/20161129200944_add_most_recent_to_workout_offerings.rb b/db/migrate/20161129200944_add_most_recent_to_workout_offerings.rb index 424efadd..d4787bdf 100644 --- a/db/migrate/20161129200944_add_most_recent_to_workout_offerings.rb +++ b/db/migrate/20161129200944_add_most_recent_to_workout_offerings.rb @@ -1,4 +1,4 @@ -class AddMostRecentToWorkoutOfferings < ActiveRecord::Migration +class AddMostRecentToWorkoutOfferings < ActiveRecord::Migration[5.1] def change add_column :workout_offerings, :most_recent, :boolean, default: true end diff --git a/db/migrate/20170314235543_create_lti_identities.rb b/db/migrate/20170314235543_create_lti_identities.rb index 7e5ee5d3..e45ac145 100644 --- a/db/migrate/20170314235543_create_lti_identities.rb +++ b/db/migrate/20170314235543_create_lti_identities.rb @@ -1,4 +1,4 @@ -class CreateLtiIdentities < ActiveRecord::Migration +class CreateLtiIdentities < ActiveRecord::Migration[5.1] def change create_table :lti_identities do |t| t.string :lti_user_id diff --git a/db/migrate/20170411130659_add_example_hidden_static_ao_n_to_test_cases.rb b/db/migrate/20170411130659_add_example_hidden_static_ao_n_to_test_cases.rb index 08f54a8a..2e74d93c 100644 --- a/db/migrate/20170411130659_add_example_hidden_static_ao_n_to_test_cases.rb +++ b/db/migrate/20170411130659_add_example_hidden_static_ao_n_to_test_cases.rb @@ -1,4 +1,4 @@ -class AddExampleHiddenStaticAoNToTestCases < ActiveRecord::Migration +class AddExampleHiddenStaticAoNToTestCases < ActiveRecord::Migration[5.1] def change add_column :test_cases, :static, :boolean, null: false, default: false add_column :test_cases, :all_or_nothing, :boolean, null: false, default: false diff --git a/db/migrate/20170420144021_add_text_representation_to_exercise_version.rb b/db/migrate/20170420144021_add_text_representation_to_exercise_version.rb index 8dac6301..7cc5e81e 100644 --- a/db/migrate/20170420144021_add_text_representation_to_exercise_version.rb +++ b/db/migrate/20170420144021_add_text_representation_to_exercise_version.rb @@ -1,4 +1,4 @@ -class AddTextRepresentationToExerciseVersion < ActiveRecord::Migration +class AddTextRepresentationToExerciseVersion < ActiveRecord::Migration[5.1] def change add_column :exercise_versions, :text_representation, :text, limit: 16.megabytes - 1 end diff --git a/db/migrate/20170427154810_add_lms_assignment_url_to_workout_offerings.rb b/db/migrate/20170427154810_add_lms_assignment_url_to_workout_offerings.rb index e2c3baf7..cd6b7a8c 100644 --- a/db/migrate/20170427154810_add_lms_assignment_url_to_workout_offerings.rb +++ b/db/migrate/20170427154810_add_lms_assignment_url_to_workout_offerings.rb @@ -1,4 +1,4 @@ -class AddLmsAssignmentUrlToWorkoutOfferings < ActiveRecord::Migration +class AddLmsAssignmentUrlToWorkoutOfferings < ActiveRecord::Migration[5.1] def change add_column :workout_offerings, :lms_assignment_url, :string end diff --git a/db/migrate/20170430212102_rename_all_or_nothing_to_screening_in_test_case.rb b/db/migrate/20170430212102_rename_all_or_nothing_to_screening_in_test_case.rb index 27c04873..5b337d99 100644 --- a/db/migrate/20170430212102_rename_all_or_nothing_to_screening_in_test_case.rb +++ b/db/migrate/20170430212102_rename_all_or_nothing_to_screening_in_test_case.rb @@ -1,4 +1,4 @@ -class RenameAllOrNothingToScreeningInTestCase < ActiveRecord::Migration +class RenameAllOrNothingToScreeningInTestCase < ActiveRecord::Migration[5.1] def change rename_column :test_cases, :all_or_nothing, :screening end diff --git a/db/migrate/20170502163350_create_license_policies.rb b/db/migrate/20170502163350_create_license_policies.rb index 75542c2d..1db45262 100644 --- a/db/migrate/20170502163350_create_license_policies.rb +++ b/db/migrate/20170502163350_create_license_policies.rb @@ -1,4 +1,4 @@ -class CreateLicensePolicies < ActiveRecord::Migration +class CreateLicensePolicies < ActiveRecord::Migration[5.1] def change create_table :license_policies do |t| t.string :name diff --git a/db/migrate/20170502163602_create_licenses.rb b/db/migrate/20170502163602_create_licenses.rb index 49ba84be..9670123c 100644 --- a/db/migrate/20170502163602_create_licenses.rb +++ b/db/migrate/20170502163602_create_licenses.rb @@ -1,4 +1,4 @@ -class CreateLicenses < ActiveRecord::Migration +class CreateLicenses < ActiveRecord::Migration[5.1] def change create_table :licenses do |t| t.string :name diff --git a/db/migrate/20170502165648_create_user_groups.rb b/db/migrate/20170502165648_create_user_groups.rb index b3d61cfd..809f28ce 100644 --- a/db/migrate/20170502165648_create_user_groups.rb +++ b/db/migrate/20170502165648_create_user_groups.rb @@ -1,4 +1,4 @@ -class CreateUserGroups < ActiveRecord::Migration +class CreateUserGroups < ActiveRecord::Migration[5.1] def change create_table :user_groups do |t| t.string :name diff --git a/db/migrate/20170502165837_create_exercise_collections.rb b/db/migrate/20170502165837_create_exercise_collections.rb index b7452439..e8d7c6aa 100644 --- a/db/migrate/20170502165837_create_exercise_collections.rb +++ b/db/migrate/20170502165837_create_exercise_collections.rb @@ -1,4 +1,4 @@ -class CreateExerciseCollections < ActiveRecord::Migration +class CreateExerciseCollections < ActiveRecord::Migration[5.1] def change create_table :exercise_collections do |t| t.string :name diff --git a/db/migrate/20170502171412_add_exercise_collection_to_exercises.rb b/db/migrate/20170502171412_add_exercise_collection_to_exercises.rb index cf30076f..289dc9d8 100644 --- a/db/migrate/20170502171412_add_exercise_collection_to_exercises.rb +++ b/db/migrate/20170502171412_add_exercise_collection_to_exercises.rb @@ -1,4 +1,4 @@ -class AddExerciseCollectionToExercises < ActiveRecord::Migration +class AddExerciseCollectionToExercises < ActiveRecord::Migration[5.1] def change add_reference :exercises, :exercise_collection, index: true, foreign_key: true end diff --git a/db/migrate/20170502204756_create_memberships.rb b/db/migrate/20170502204756_create_memberships.rb index 9e9d9814..56a067e5 100644 --- a/db/migrate/20170502204756_create_memberships.rb +++ b/db/migrate/20170502204756_create_memberships.rb @@ -1,4 +1,4 @@ -class CreateMemberships < ActiveRecord::Migration +class CreateMemberships < ActiveRecord::Migration[5.1] def change create_table :memberships do |t| t.integer :user_id diff --git a/db/migrate/20170503154537_add_user_to_exercise_collection.rb b/db/migrate/20170503154537_add_user_to_exercise_collection.rb index a3568bd9..0df94577 100644 --- a/db/migrate/20170503154537_add_user_to_exercise_collection.rb +++ b/db/migrate/20170503154537_add_user_to_exercise_collection.rb @@ -1,4 +1,4 @@ -class AddUserToExerciseCollection < ActiveRecord::Migration +class AddUserToExerciseCollection < ActiveRecord::Migration[5.1] def change add_reference :exercise_collections, :user, index: true, foreign_key: true end diff --git a/db/migrate/20170509003343_add_hide_examples_to_coding_prompt.rb b/db/migrate/20170509003343_add_hide_examples_to_coding_prompt.rb index 459e3034..d36eee5c 100644 --- a/db/migrate/20170509003343_add_hide_examples_to_coding_prompt.rb +++ b/db/migrate/20170509003343_add_hide_examples_to_coding_prompt.rb @@ -1,4 +1,4 @@ -class AddHideExamplesToCodingPrompt < ActiveRecord::Migration +class AddHideExamplesToCodingPrompt < ActiveRecord::Migration[5.1] def change add_column :coding_prompts, :hide_examples, :boolean, null: false, default: false end diff --git a/db/migrate/20170518161546_add_user_group_to_course.rb b/db/migrate/20170518161546_add_user_group_to_course.rb index 3d202fb5..42e67b33 100644 --- a/db/migrate/20170518161546_add_user_group_to_course.rb +++ b/db/migrate/20170518161546_add_user_group_to_course.rb @@ -1,4 +1,4 @@ -class AddUserGroupToCourse < ActiveRecord::Migration +class AddUserGroupToCourse < ActiveRecord::Migration[5.1] def change add_reference :courses, :user_group, index: true, foreign_key: true end diff --git a/db/migrate/20170518161825_add_course_offering_to_exercise_collection.rb b/db/migrate/20170518161825_add_course_offering_to_exercise_collection.rb index 5d6e3006..e2f92292 100644 --- a/db/migrate/20170518161825_add_course_offering_to_exercise_collection.rb +++ b/db/migrate/20170518161825_add_course_offering_to_exercise_collection.rb @@ -1,4 +1,4 @@ -class AddCourseOfferingToExerciseCollection < ActiveRecord::Migration +class AddCourseOfferingToExerciseCollection < ActiveRecord::Migration[5.1] def change add_reference :exercise_collections, :course_offering, index: true, foreign_key: true end diff --git a/db/migrate/20170530210400_add_description_to_user_groups.rb b/db/migrate/20170530210400_add_description_to_user_groups.rb index fcc69e43..1a71678e 100644 --- a/db/migrate/20170530210400_add_description_to_user_groups.rb +++ b/db/migrate/20170530210400_add_description_to_user_groups.rb @@ -1,4 +1,4 @@ -class AddDescriptionToUserGroups < ActiveRecord::Migration +class AddDescriptionToUserGroups < ActiveRecord::Migration[5.1] def change add_column :user_groups, :description, :text end diff --git a/db/migrate/20170531150805_create_group_access_requests.rb b/db/migrate/20170531150805_create_group_access_requests.rb index d9118bfa..b32e9ff8 100644 --- a/db/migrate/20170531150805_create_group_access_requests.rb +++ b/db/migrate/20170531150805_create_group_access_requests.rb @@ -1,4 +1,4 @@ -class CreateGroupAccessRequests < ActiveRecord::Migration +class CreateGroupAccessRequests < ActiveRecord::Migration[5.1] def change create_table :group_access_requests do |t| t.references :user, index: true, foreign_key: true diff --git a/db/migrate/20170810205035_add_feedback_line_to_test_case_results.rb b/db/migrate/20170810205035_add_feedback_line_to_test_case_results.rb index 187fb1bd..6088d47b 100644 --- a/db/migrate/20170810205035_add_feedback_line_to_test_case_results.rb +++ b/db/migrate/20170810205035_add_feedback_line_to_test_case_results.rb @@ -1,4 +1,4 @@ -class AddFeedbackLineToTestCaseResults < ActiveRecord::Migration +class AddFeedbackLineToTestCaseResults < ActiveRecord::Migration[5.1] def change add_column :test_case_results, :feedback_line_no, :integer, :after => :execution_feedback diff --git a/db/migrate/20170830160216_add_is_hidden_to_course.rb b/db/migrate/20170830160216_add_is_hidden_to_course.rb index 6fcec9ed..8c921836 100644 --- a/db/migrate/20170830160216_add_is_hidden_to_course.rb +++ b/db/migrate/20170830160216_add_is_hidden_to_course.rb @@ -1,4 +1,4 @@ -class AddIsHiddenToCourse < ActiveRecord::Migration +class AddIsHiddenToCourse < ActiveRecord::Migration[5.1] def change add_column :courses, :is_hidden, :boolean, default: false end diff --git a/db/migrate/20170830164617_add_is_hidden_to_organization.rb b/db/migrate/20170830164617_add_is_hidden_to_organization.rb index 48bdf035..1b39f9e7 100644 --- a/db/migrate/20170830164617_add_is_hidden_to_organization.rb +++ b/db/migrate/20170830164617_add_is_hidden_to_organization.rb @@ -1,4 +1,4 @@ -class AddIsHiddenToOrganization < ActiveRecord::Migration +class AddIsHiddenToOrganization < ActiveRecord::Migration[5.1] def change add_column :organizations, :is_hidden, :boolean, default: false end diff --git a/db/migrate/20170920191837_remove_lms_assignment_id_index_from_workout_offerings.rb b/db/migrate/20170920191837_remove_lms_assignment_id_index_from_workout_offerings.rb index 0d9f13ac..2e5e899e 100644 --- a/db/migrate/20170920191837_remove_lms_assignment_id_index_from_workout_offerings.rb +++ b/db/migrate/20170920191837_remove_lms_assignment_id_index_from_workout_offerings.rb @@ -1,4 +1,4 @@ -class RemoveLmsAssignmentIdIndexFromWorkoutOfferings < ActiveRecord::Migration +class RemoveLmsAssignmentIdIndexFromWorkoutOfferings < ActiveRecord::Migration[5.1] def change remove_index :workout_offerings, :lms_assignment_id # remove it to get rid of unique requirement diff --git a/db/migrate/20180718193136_create_visualization_loggings.rb b/db/migrate/20180718193136_create_visualization_loggings.rb index 58a5061c..4824e465 100644 --- a/db/migrate/20180718193136_create_visualization_loggings.rb +++ b/db/migrate/20180718193136_create_visualization_loggings.rb @@ -1,4 +1,4 @@ -class CreateVisualizationLoggings < ActiveRecord::Migration +class CreateVisualizationLoggings < ActiveRecord::Migration[5.1] def change create_table :visualization_loggings do |t| t.references :user, index: true diff --git a/db/migrate/20190131151757_add_attempt_limit_to_workout_offerings.rb b/db/migrate/20190131151757_add_attempt_limit_to_workout_offerings.rb index 4c2339b5..f3a1363a 100644 --- a/db/migrate/20190131151757_add_attempt_limit_to_workout_offerings.rb +++ b/db/migrate/20190131151757_add_attempt_limit_to_workout_offerings.rb @@ -1,4 +1,4 @@ -class AddAttemptLimitToWorkoutOfferings < ActiveRecord::Migration +class AddAttemptLimitToWorkoutOfferings < ActiveRecord::Migration[5.1] def change add_column :workout_offerings, :attempt_limit, :integer, default: nil end diff --git a/db/migrate/20190416161435_add_feedback_times_to_attempt.rb b/db/migrate/20190416161435_add_feedback_times_to_attempt.rb index dbfbc825..2133e42d 100644 --- a/db/migrate/20190416161435_add_feedback_times_to_attempt.rb +++ b/db/migrate/20190416161435_add_feedback_times_to_attempt.rb @@ -1,4 +1,4 @@ -class AddFeedbackTimesToAttempt < ActiveRecord::Migration +class AddFeedbackTimesToAttempt < ActiveRecord::Migration[5.1] def change add_column :attempts, :time_taken, :decimal add_column :attempts, :feedback_timeout, :decimal diff --git a/db/migrate/20190422155326_create_lti_workouts.rb b/db/migrate/20190422155326_create_lti_workouts.rb index 1aaaf6be..a81fd1c6 100644 --- a/db/migrate/20190422155326_create_lti_workouts.rb +++ b/db/migrate/20190422155326_create_lti_workouts.rb @@ -1,4 +1,4 @@ -class CreateLtiWorkouts < ActiveRecord::Migration +class CreateLtiWorkouts < ActiveRecord::Migration[5.1] def change create_table :lti_workouts do |t| t.references :workout, index: true diff --git a/db/migrate/20190712171251_tie_workout_scores_with_lms_instance.rb b/db/migrate/20190712171251_tie_workout_scores_with_lms_instance.rb index 5d964815..f926e721 100644 --- a/db/migrate/20190712171251_tie_workout_scores_with_lms_instance.rb +++ b/db/migrate/20190712171251_tie_workout_scores_with_lms_instance.rb @@ -1,4 +1,4 @@ -class TieWorkoutScoresWithLmsInstance < ActiveRecord::Migration +class TieWorkoutScoresWithLmsInstance < ActiveRecord::Migration[5.1] def change add_reference :lti_workouts, :lms_instance, index: true, foreign_key: true add_reference :workout_scores, :lti_workout, index: true, foreign_key: true diff --git a/db/migrate/20240207035240_add_compound_index_to_workout_scores.rb b/db/migrate/20240207035240_add_compound_index_to_workout_scores.rb index 1be6f06f..52ca4a00 100644 --- a/db/migrate/20240207035240_add_compound_index_to_workout_scores.rb +++ b/db/migrate/20240207035240_add_compound_index_to_workout_scores.rb @@ -1,4 +1,4 @@ -class AddCompoundIndexToWorkoutScores < ActiveRecord::Migration +class AddCompoundIndexToWorkoutScores < ActiveRecord::Migration[4.2] def change add_index :workout_scores, [:user_id, :workout_id, :workout_offering_id], name: 'idx_ws_on_user_workout_workout_offering' diff --git a/db/migrate/20240207040304_add_compound_index_to_attempts.rb b/db/migrate/20240207040304_add_compound_index_to_attempts.rb index 6c3d48b6..cbda48c9 100644 --- a/db/migrate/20240207040304_add_compound_index_to_attempts.rb +++ b/db/migrate/20240207040304_add_compound_index_to_attempts.rb @@ -1,4 +1,4 @@ -class AddCompoundIndexToAttempts < ActiveRecord::Migration +class AddCompoundIndexToAttempts < ActiveRecord::Migration[4.2] def change add_index :attempts, [:user_id, :exercise_version_id], name: 'idx_attempts_on_user_exercise_version' diff --git a/db/migrate/20240207161742_add_lti_user_id_index_to_lti_identities.rb b/db/migrate/20240207161742_add_lti_user_id_index_to_lti_identities.rb index 6a94b856..f04b9f7c 100644 --- a/db/migrate/20240207161742_add_lti_user_id_index_to_lti_identities.rb +++ b/db/migrate/20240207161742_add_lti_user_id_index_to_lti_identities.rb @@ -1,4 +1,4 @@ -class AddLtiUserIdIndexToLtiIdentities < ActiveRecord::Migration +class AddLtiUserIdIndexToLtiIdentities < ActiveRecord::Migration[4.2] def change add_index :lti_identities, :lti_user_id end diff --git a/db/migrate/20250218154318_upgrade_errors_table.rb b/db/migrate/20250218154318_upgrade_errors_table.rb new file mode 100644 index 00000000..2cdf61ca --- /dev/null +++ b/db/migrate/20250218154318_upgrade_errors_table.rb @@ -0,0 +1,21 @@ +class UpgradeErrorsTable < ActiveRecord::Migration[5.2] + + # Upgrades the structure of the "errors" table used to store exception + # data using the exception_handler gem. The gem changed the table structure + # without including a corresponding migration of its own, so this migration + # is intended to change the structure to match the gem's 0.8.0.0 version. + + # The list of attributes from the exception model class in the gem: + # ATTRS = %i(class_name status message trace target referrer params user_agent) + + # The old structure: (class_name message trace target_url referer_url params user_agent) + + def change + change_table :errors do |t| + t.rename :target_url, :target + t.rename :referer_url, :referrer + t.change :class_name, :text + t.text :status + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 29315d8d..a73a45ac 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 # This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. @@ -11,712 +10,677 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20240207161742) do +ActiveRecord::Schema.define(version: 2025_02_18_154318) do - create_table "active_admin_comments", force: :cascade do |t| - t.string "namespace", limit: 255 - t.text "body", limit: 65535 - t.string "resource_id", limit: 255, default: "", null: false - t.string "resource_type", limit: 255, default: "", null: false - t.integer "author_id", limit: 4 - t.string "author_type", limit: 255 + create_table "active_admin_comments", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| + t.string "namespace" + t.text "body" + t.string "resource_id", default: "", null: false + t.string "resource_type", default: "", null: false + t.integer "author_id" + t.string "author_type" t.datetime "created_at" t.datetime "updated_at" + t.index ["author_type", "author_id"], name: "index_active_admin_comments_on_author_type_and_author_id" + t.index ["namespace"], name: "index_active_admin_comments_on_namespace" + t.index ["resource_type", "resource_id"], name: "index_active_admin_comments_on_resource_type_and_resource_id" end - add_index "active_admin_comments", ["author_type", "author_id"], name: "index_active_admin_comments_on_author_type_and_author_id", using: :btree - add_index "active_admin_comments", ["namespace"], name: "index_active_admin_comments_on_namespace", using: :btree - add_index "active_admin_comments", ["resource_type", "resource_id"], name: "index_active_admin_comments_on_resource_type_and_resource_id", using: :btree - - create_table "attempts", force: :cascade do |t| - t.integer "user_id", limit: 4, null: false - t.integer "exercise_version_id", limit: 4, null: false - t.datetime "submit_time", null: false - t.integer "submit_num", limit: 4, null: false - t.float "score", limit: 24, default: 0.0 - t.integer "experience_earned", limit: 4 + create_table "attempts", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| + t.integer "user_id", null: false + t.integer "exercise_version_id", null: false + t.datetime "submit_time", null: false + t.integer "submit_num", null: false + t.float "score", default: 0.0 + t.integer "experience_earned" t.datetime "created_at" t.datetime "updated_at" - t.integer "workout_score_id", limit: 4 - t.integer "active_score_id", limit: 4 - t.boolean "feedback_ready" - t.decimal "time_taken", precision: 10 - t.decimal "feedback_timeout", precision: 10 - t.decimal "worker_time", precision: 10 + t.integer "workout_score_id" + t.integer "active_score_id" + t.boolean "feedback_ready" + t.decimal "time_taken", precision: 10 + t.decimal "feedback_timeout", precision: 10 + t.decimal "worker_time", precision: 10 + t.index ["active_score_id"], name: "index_attempts_on_active_score_id" + t.index ["exercise_version_id"], name: "index_attempts_on_exercise_version_id" + t.index ["user_id", "exercise_version_id"], name: "idx_attempts_on_user_exercise_version" + t.index ["user_id"], name: "index_attempts_on_user_id" + t.index ["workout_score_id", "exercise_version_id"], name: "idx_attempts_on_workout_score_exercise_version" + t.index ["workout_score_id"], name: "index_attempts_on_workout_score_id" end - add_index "attempts", ["active_score_id"], name: "index_attempts_on_active_score_id", using: :btree - add_index "attempts", ["exercise_version_id"], name: "index_attempts_on_exercise_version_id", using: :btree - add_index "attempts", ["user_id", "exercise_version_id"], name: "idx_attempts_on_user_exercise_version", using: :btree - add_index "attempts", ["user_id"], name: "index_attempts_on_user_id", using: :btree - add_index "attempts", ["workout_score_id", "exercise_version_id"], name: "idx_attempts_on_workout_score_exercise_version", using: :btree - add_index "attempts", ["workout_score_id"], name: "index_attempts_on_workout_score_id", using: :btree - - create_table "attempts_tag_user_scores", id: false, force: :cascade do |t| - t.integer "attempt_id", limit: 4 - t.integer "tag_user_score_id", limit: 4 + create_table "attempts_tag_user_scores", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| + t.integer "attempt_id" + t.integer "tag_user_score_id" + t.index ["attempt_id", "tag_user_score_id"], name: "attempts_tag_user_scores_idx", unique: true + t.index ["tag_user_score_id"], name: "attempts_tag_user_scores_tag_user_score_id_fk" end - add_index "attempts_tag_user_scores", ["attempt_id", "tag_user_score_id"], name: "attempts_tag_user_scores_idx", unique: true, using: :btree - add_index "attempts_tag_user_scores", ["tag_user_score_id"], name: "attempts_tag_user_scores_tag_user_score_id_fk", using: :btree - - create_table "choices", force: :cascade do |t| - t.integer "multiple_choice_prompt_id", limit: 4, null: false - t.integer "position", limit: 4, null: false - t.text "feedback", limit: 65535 - t.float "value", limit: 24, null: false + create_table "choices", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| + t.integer "multiple_choice_prompt_id", null: false + t.integer "position", null: false + t.text "feedback" + t.float "value", null: false t.datetime "created_at" t.datetime "updated_at" - t.text "answer", limit: 65535, null: false + t.text "answer", null: false + t.index ["multiple_choice_prompt_id"], name: "index_choices_on_multiple_choice_prompt_id" end - add_index "choices", ["multiple_choice_prompt_id"], name: "index_choices_on_multiple_choice_prompt_id", using: :btree - - create_table "choices_multiple_choice_prompt_answers", id: false, force: :cascade do |t| - t.integer "choice_id", limit: 4 - t.integer "multiple_choice_prompt_answer_id", limit: 4 + create_table "choices_multiple_choice_prompt_answers", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| + t.integer "choice_id" + t.integer "multiple_choice_prompt_answer_id" + t.index ["choice_id", "multiple_choice_prompt_answer_id"], name: "choices_multiple_choice_prompt_answers_idx", unique: true + t.index ["multiple_choice_prompt_answer_id"], name: "choices_MC_prompt_answers_MC_prompt_answer_id_fk" end - add_index "choices_multiple_choice_prompt_answers", ["choice_id", "multiple_choice_prompt_answer_id"], name: "choices_multiple_choice_prompt_answers_idx", unique: true, using: :btree - add_index "choices_multiple_choice_prompt_answers", ["multiple_choice_prompt_answer_id"], name: "choices_MC_prompt_answers_MC_prompt_answer_id_fk", using: :btree - - create_table "coding_prompt_answers", force: :cascade do |t| - t.text "answer", limit: 65535 - t.text "error", limit: 65535 - t.integer "error_line_no", limit: 4 + create_table "coding_prompt_answers", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| + t.text "answer" + t.text "error" + t.integer "error_line_no" end - create_table "coding_prompts", force: :cascade do |t| + create_table "coding_prompts", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| t.datetime "created_at" t.datetime "updated_at" - t.string "class_name", limit: 255 - t.text "wrapper_code", limit: 65535, null: false - t.text "test_script", limit: 65535, null: false - t.string "method_name", limit: 255 - t.text "starter_code", limit: 65535 - t.boolean "hide_examples", default: false, null: false + t.string "class_name" + t.text "wrapper_code", null: false + t.text "test_script", null: false + t.string "method_name" + t.text "starter_code" + t.boolean "hide_examples", default: false, null: false end - create_table "course_enrollments", force: :cascade do |t| - t.integer "user_id", limit: 4, null: false - t.integer "course_offering_id", limit: 4, null: false - t.integer "course_role_id", limit: 4, null: false + create_table "course_enrollments", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| + t.integer "user_id", null: false + t.integer "course_offering_id", null: false + t.integer "course_role_id", null: false + t.index ["course_offering_id"], name: "index_course_enrollments_on_course_offering_id" + t.index ["course_role_id"], name: "index_course_enrollments_on_course_role_id" + t.index ["user_id", "course_offering_id"], name: "index_course_enrollments_on_user_id_and_course_offering_id", unique: true + t.index ["user_id"], name: "index_course_enrollments_on_user_id" end - add_index "course_enrollments", ["course_offering_id"], name: "index_course_enrollments_on_course_offering_id", using: :btree - add_index "course_enrollments", ["course_role_id"], name: "index_course_enrollments_on_course_role_id", using: :btree - add_index "course_enrollments", ["user_id", "course_offering_id"], name: "index_course_enrollments_on_user_id_and_course_offering_id", unique: true, using: :btree - add_index "course_enrollments", ["user_id"], name: "index_course_enrollments_on_user_id", using: :btree - - create_table "course_exercises", force: :cascade do |t| - t.integer "course_id", limit: 4, null: false - t.integer "exercise_id", limit: 4, null: false + create_table "course_exercises", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| + t.integer "course_id", null: false + t.integer "exercise_id", null: false t.datetime "created_at" t.datetime "updated_at" + t.index ["course_id"], name: "course_exercises_course_id_fk" + t.index ["exercise_id"], name: "course_exercises_exercise_id_fk" end - add_index "course_exercises", ["course_id"], name: "course_exercises_course_id_fk", using: :btree - add_index "course_exercises", ["exercise_id"], name: "course_exercises_exercise_id_fk", using: :btree - - create_table "course_offerings", force: :cascade do |t| - t.integer "course_id", limit: 4, null: false - t.integer "term_id", limit: 4, null: false - t.string "label", limit: 255, default: "", null: false - t.string "url", limit: 255 - t.boolean "self_enrollment_allowed" + create_table "course_offerings", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| + t.integer "course_id", null: false + t.integer "term_id", null: false + t.string "label", default: "", null: false + t.string "url" + t.boolean "self_enrollment_allowed" t.datetime "created_at" t.datetime "updated_at" - t.date "cutoff_date" - t.integer "lms_instance_id", limit: 4 + t.date "cutoff_date" + t.integer "lms_instance_id" + t.index ["course_id"], name: "index_course_offerings_on_course_id" + t.index ["lms_instance_id"], name: "index_course_offerings_on_lms_instance_id" + t.index ["term_id"], name: "index_course_offerings_on_term_id" end - add_index "course_offerings", ["course_id"], name: "index_course_offerings_on_course_id", using: :btree - add_index "course_offerings", ["lms_instance_id"], name: "index_course_offerings_on_lms_instance_id", using: :btree - add_index "course_offerings", ["term_id"], name: "index_course_offerings_on_term_id", using: :btree - - create_table "course_roles", force: :cascade do |t| - t.string "name", limit: 255, default: "", null: false - t.boolean "can_manage_course", default: false, null: false - t.boolean "can_manage_assignments", default: false, null: false - t.boolean "can_grade_submissions", default: false, null: false - t.boolean "can_view_other_submissions", default: false, null: false - t.boolean "builtin", default: false, null: false + create_table "course_roles", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| + t.string "name", default: "", null: false + t.boolean "can_manage_course", default: false, null: false + t.boolean "can_manage_assignments", default: false, null: false + t.boolean "can_grade_submissions", default: false, null: false + t.boolean "can_view_other_submissions", default: false, null: false + t.boolean "builtin", default: false, null: false end - create_table "courses", force: :cascade do |t| - t.string "name", limit: 255, default: "", null: false - t.string "number", limit: 255, default: "", null: false - t.integer "organization_id", limit: 4, null: false + create_table "courses", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| + t.string "name", default: "", null: false + t.string "number", default: "", null: false + t.integer "organization_id", null: false t.datetime "created_at" t.datetime "updated_at" - t.integer "creator_id", limit: 4 - t.string "slug", limit: 255, default: "", null: false - t.integer "user_group_id", limit: 4 - t.boolean "is_hidden", default: false + t.integer "creator_id" + t.string "slug", default: "", null: false + t.integer "user_group_id" + t.boolean "is_hidden", default: false + t.index ["organization_id"], name: "index_courses_on_organization_id" + t.index ["slug"], name: "index_courses_on_slug" + t.index ["user_group_id"], name: "index_courses_on_user_group_id" end - add_index "courses", ["organization_id"], name: "index_courses_on_organization_id", using: :btree - add_index "courses", ["slug"], name: "index_courses_on_slug", using: :btree - add_index "courses", ["user_group_id"], name: "index_courses_on_user_group_id", using: :btree - - create_table "errors", force: :cascade do |t| - t.string "usable_type", limit: 255 - t.integer "usable_id", limit: 4 - t.string "class_name", limit: 255 - t.text "message", limit: 65535 - t.text "trace", limit: 65535 - t.text "target_url", limit: 65535 - t.text "referer_url", limit: 65535 - t.text "params", limit: 65535 - t.text "user_agent", limit: 65535 + create_table "errors", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| + t.string "usable_type" + t.integer "usable_id" + t.text "class_name" + t.text "message" + t.text "trace" + t.text "target" + t.text "referrer" + t.text "params" + t.text "user_agent" t.datetime "created_at" t.datetime "updated_at" + t.text "status" + t.index ["class_name"], name: "index_errors_on_class_name", length: 1024 + t.index ["created_at"], name: "index_errors_on_created_at" end - add_index "errors", ["class_name"], name: "index_errors_on_class_name", using: :btree - add_index "errors", ["created_at"], name: "index_errors_on_created_at", using: :btree - - create_table "exercise_collections", force: :cascade do |t| - t.string "name", limit: 255 - t.text "description", limit: 65535 - t.integer "user_group_id", limit: 4 - t.integer "license_id", limit: 4 + create_table "exercise_collections", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| + t.string "name" + t.text "description" + t.integer "user_group_id" + t.integer "license_id" t.datetime "created_at" t.datetime "updated_at" - t.integer "user_id", limit: 4 - t.integer "course_offering_id", limit: 4 + t.integer "user_id" + t.integer "course_offering_id" + t.index ["course_offering_id"], name: "index_exercise_collections_on_course_offering_id" + t.index ["license_id"], name: "index_exercise_collections_on_license_id" + t.index ["user_group_id"], name: "index_exercise_collections_on_user_group_id" + t.index ["user_id"], name: "index_exercise_collections_on_user_id" end - add_index "exercise_collections", ["course_offering_id"], name: "index_exercise_collections_on_course_offering_id", using: :btree - add_index "exercise_collections", ["license_id"], name: "index_exercise_collections_on_license_id", using: :btree - add_index "exercise_collections", ["user_group_id"], name: "index_exercise_collections_on_user_group_id", using: :btree - add_index "exercise_collections", ["user_id"], name: "index_exercise_collections_on_user_id", using: :btree - - create_table "exercise_families", force: :cascade do |t| - t.string "name", limit: 255, default: "", null: false + create_table "exercise_families", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| + t.string "name", default: "", null: false t.datetime "created_at" t.datetime "updated_at" end - create_table "exercise_owners", force: :cascade do |t| - t.integer "exercise_id", limit: 4, null: false - t.integer "owner_id", limit: 4, null: false + create_table "exercise_owners", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| + t.integer "exercise_id", null: false + t.integer "owner_id", null: false + t.index ["exercise_id", "owner_id"], name: "index_exercise_owners_on_exercise_id_and_owner_id", unique: true + t.index ["owner_id"], name: "exercise_owners_owner_id_fk" end - add_index "exercise_owners", ["exercise_id", "owner_id"], name: "index_exercise_owners_on_exercise_id_and_owner_id", unique: true, using: :btree - add_index "exercise_owners", ["owner_id"], name: "exercise_owners_owner_id_fk", using: :btree - - create_table "exercise_versions", force: :cascade do |t| - t.integer "stem_id", limit: 4 + create_table "exercise_versions", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| + t.integer "stem_id" t.datetime "created_at" t.datetime "updated_at" - t.integer "exercise_id", limit: 4, null: false - t.integer "version", limit: 4, null: false - t.integer "creator_id", limit: 4 - t.integer "irt_data_id", limit: 4 - t.text "text_representation", limit: 16777215 + t.integer "exercise_id", null: false + t.integer "version", null: false + t.integer "creator_id" + t.integer "irt_data_id" + t.text "text_representation", limit: 16777215 + t.index ["creator_id"], name: "exercise_versions_creator_id_fk" + t.index ["exercise_id"], name: "index_exercise_versions_on_exercise_id" + t.index ["irt_data_id"], name: "exercise_versions_irt_data_id_fk" + t.index ["stem_id"], name: "index_exercise_versions_on_stem_id" end - add_index "exercise_versions", ["creator_id"], name: "exercise_versions_creator_id_fk", using: :btree - add_index "exercise_versions", ["irt_data_id"], name: "exercise_versions_irt_data_id_fk", using: :btree - add_index "exercise_versions", ["stem_id"], name: "index_exercise_versions_on_stem_id", using: :btree - - create_table "exercise_versions_resource_files", id: false, force: :cascade do |t| - t.integer "exercise_version_id", limit: 4, null: false - t.integer "resource_file_id", limit: 4, null: false + create_table "exercise_versions_resource_files", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| + t.integer "exercise_version_id", null: false + t.integer "resource_file_id", null: false + t.index ["exercise_version_id"], name: "index_exercise_versions_resource_files_on_exercise_version_id" + t.index ["resource_file_id"], name: "index_exercise_versions_resource_files_on_resource_file_id" end - add_index "exercise_versions_resource_files", ["exercise_version_id"], name: "index_exercise_versions_resource_files_on_exercise_version_id", using: :btree - add_index "exercise_versions_resource_files", ["resource_file_id"], name: "index_exercise_versions_resource_files_on_resource_file_id", using: :btree - - create_table "exercise_workouts", force: :cascade do |t| - t.integer "exercise_id", limit: 4, null: false - t.integer "workout_id", limit: 4, null: false - t.integer "position", limit: 4, null: false - t.float "points", limit: 24, default: 1.0 + create_table "exercise_workouts", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| + t.integer "exercise_id", null: false + t.integer "workout_id", null: false + t.integer "position", null: false + t.float "points", default: 1.0 t.datetime "created_at" t.datetime "updated_at" + t.index ["exercise_id"], name: "exercise_workouts_exercise_id_fk" + t.index ["workout_id"], name: "exercise_workouts_workout_id_fk" end - add_index "exercise_workouts", ["exercise_id"], name: "exercise_workouts_exercise_id_fk", using: :btree - add_index "exercise_workouts", ["workout_id"], name: "exercise_workouts_workout_id_fk", using: :btree - - create_table "exercises", force: :cascade do |t| - t.integer "question_type", limit: 4, null: false - t.integer "current_version_id", limit: 4 + create_table "exercises", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| + t.integer "question_type", null: false + t.integer "current_version_id" t.datetime "created_at" t.datetime "updated_at" - t.integer "versions", limit: 4 - t.integer "exercise_family_id", limit: 4 - t.string "name", limit: 255 - t.boolean "is_public", default: false, null: false - t.integer "experience", limit: 4, null: false - t.integer "irt_data_id", limit: 4 - t.string "external_id", limit: 255 - t.integer "exercise_collection_id", limit: 4 + t.integer "versions" + t.integer "exercise_family_id" + t.string "name" + t.boolean "is_public", default: false, null: false + t.integer "experience", null: false + t.integer "irt_data_id" + t.string "external_id" + t.integer "exercise_collection_id" + t.index ["current_version_id"], name: "index_exercises_on_current_version_id" + t.index ["exercise_collection_id"], name: "index_exercises_on_exercise_collection_id" + t.index ["exercise_family_id"], name: "index_exercises_on_exercise_family_id" + t.index ["external_id"], name: "index_exercises_on_external_id", unique: true + t.index ["irt_data_id"], name: "exercises_irt_data_id_fk" + t.index ["is_public"], name: "index_exercises_on_is_public" end - add_index "exercises", ["exercise_collection_id"], name: "index_exercises_on_exercise_collection_id", using: :btree - add_index "exercises", ["exercise_family_id"], name: "index_exercises_on_exercise_family_id", using: :btree - add_index "exercises", ["external_id"], name: "index_exercises_on_external_id", unique: true, using: :btree - add_index "exercises", ["irt_data_id"], name: "exercises_irt_data_id_fk", using: :btree - add_index "exercises", ["is_public"], name: "index_exercises_on_is_public", using: :btree - - create_table "friendly_id_slugs", force: :cascade do |t| - t.string "slug", limit: 255, default: "", null: false - t.integer "sluggable_id", limit: 4, null: false - t.string "sluggable_type", limit: 50 - t.string "scope", limit: 255 + create_table "friendly_id_slugs", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| + t.string "slug", default: "", null: false + t.integer "sluggable_id", null: false + t.string "sluggable_type", limit: 50 + t.string "scope" t.datetime "created_at" + t.index ["slug", "sluggable_type", "scope"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type_and_scope", unique: true + t.index ["slug", "sluggable_type"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type" + t.index ["sluggable_id"], name: "index_friendly_id_slugs_on_sluggable_id" + t.index ["sluggable_type"], name: "index_friendly_id_slugs_on_sluggable_type" end - add_index "friendly_id_slugs", ["slug", "sluggable_type", "scope"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type_and_scope", unique: true, using: :btree - add_index "friendly_id_slugs", ["slug", "sluggable_type"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type", using: :btree - add_index "friendly_id_slugs", ["sluggable_id"], name: "index_friendly_id_slugs_on_sluggable_id", using: :btree - add_index "friendly_id_slugs", ["sluggable_type"], name: "index_friendly_id_slugs_on_sluggable_type", using: :btree - - create_table "global_roles", force: :cascade do |t| - t.string "name", limit: 255, default: "", null: false - t.boolean "can_manage_all_courses", default: false, null: false - t.boolean "can_edit_system_configuration", default: false, null: false - t.boolean "builtin", default: false, null: false + create_table "global_roles", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| + t.string "name", default: "", null: false + t.boolean "can_manage_all_courses", default: false, null: false + t.boolean "can_edit_system_configuration", default: false, null: false + t.boolean "builtin", default: false, null: false end - create_table "group_access_requests", force: :cascade do |t| - t.integer "user_id", limit: 4 - t.integer "user_group_id", limit: 4 - t.boolean "pending", default: true - t.boolean "decision" + create_table "group_access_requests", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| + t.integer "user_id" + t.integer "user_group_id" + t.boolean "pending", default: true + t.boolean "decision" t.datetime "created_at" t.datetime "updated_at" + t.index ["user_group_id"], name: "index_group_access_requests_on_user_group_id" + t.index ["user_id"], name: "index_group_access_requests_on_user_id" end - add_index "group_access_requests", ["user_group_id"], name: "index_group_access_requests_on_user_group_id", using: :btree - add_index "group_access_requests", ["user_id"], name: "index_group_access_requests_on_user_id", using: :btree - - create_table "identities", force: :cascade do |t| - t.integer "user_id", limit: 4, null: false - t.string "provider", limit: 255, default: "", null: false - t.string "uid", limit: 255, default: "", null: false + create_table "identities", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| + t.integer "user_id", null: false + t.string "provider", default: "", null: false + t.string "uid", default: "", null: false t.datetime "created_at" t.datetime "updated_at" + t.index ["uid", "provider"], name: "index_identities_on_uid_and_provider" + t.index ["user_id"], name: "index_identities_on_user_id" end - add_index "identities", ["uid", "provider"], name: "index_identities_on_uid_and_provider", using: :btree - add_index "identities", ["user_id"], name: "index_identities_on_user_id", using: :btree - - create_table "irt_data", force: :cascade do |t| - t.integer "attempt_count", limit: 4, null: false - t.float "sum_of_scores", limit: 24, null: false - t.float "difficulty", limit: 24, null: false - t.float "discrimination", limit: 24, null: false + create_table "irt_data", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| + t.integer "attempt_count", null: false + t.float "sum_of_scores", null: false + t.float "difficulty", null: false + t.float "discrimination", null: false end - create_table "license_policies", force: :cascade do |t| - t.string "name", limit: 255 - t.text "description", limit: 65535 - t.boolean "can_fork" - t.boolean "is_public" + create_table "license_policies", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| + t.string "name" + t.text "description" + t.boolean "can_fork" + t.boolean "is_public" t.datetime "created_at" t.datetime "updated_at" end - create_table "licenses", force: :cascade do |t| - t.string "name", limit: 255 - t.text "description", limit: 65535 - t.string "url", limit: 255 - t.integer "license_policy_id", limit: 4 + create_table "licenses", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| + t.string "name" + t.text "description" + t.string "url" + t.integer "license_policy_id" t.datetime "created_at" t.datetime "updated_at" + t.index ["license_policy_id"], name: "index_licenses_on_license_policy_id" end - add_index "licenses", ["license_policy_id"], name: "index_licenses_on_license_policy_id", using: :btree - - create_table "lms_instances", force: :cascade do |t| - t.string "consumer_key", limit: 255 - t.string "consumer_secret", limit: 255 + create_table "lms_instances", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| + t.string "consumer_key" + t.string "consumer_secret" t.datetime "created_at" t.datetime "updated_at" - t.string "url", limit: 255 - t.integer "lms_type_id", limit: 4 - t.integer "organization_id", limit: 4 + t.string "url" + t.integer "lms_type_id" + t.integer "organization_id" + t.index ["lms_type_id"], name: "lms_instances_lms_type_id_fk" + t.index ["organization_id"], name: "index_lms_instances_on_organization_id" + t.index ["url"], name: "index_lms_instances_on_url", unique: true end - add_index "lms_instances", ["lms_type_id"], name: "lms_instances_lms_type_id_fk", using: :btree - add_index "lms_instances", ["organization_id"], name: "index_lms_instances_on_organization_id", using: :btree - add_index "lms_instances", ["url"], name: "index_lms_instances_on_url", unique: true, using: :btree - - create_table "lms_types", force: :cascade do |t| - t.string "name", limit: 255, null: false + create_table "lms_types", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| + t.string "name", null: false t.datetime "created_at" t.datetime "updated_at" + t.index ["name"], name: "index_lms_types_on_name", unique: true end - add_index "lms_types", ["name"], name: "index_lms_types_on_name", unique: true, using: :btree - - create_table "lti_identities", force: :cascade do |t| - t.string "lti_user_id", limit: 255 - t.integer "user_id", limit: 4 - t.integer "lms_instance_id", limit: 4 + create_table "lti_identities", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| + t.string "lti_user_id" + t.integer "user_id" + t.integer "lms_instance_id" t.datetime "created_at" t.datetime "updated_at" + t.index ["lms_instance_id"], name: "index_lti_identities_on_lms_instance_id" + t.index ["lti_user_id"], name: "index_lti_identities_on_lti_user_id" + t.index ["user_id"], name: "index_lti_identities_on_user_id" end - add_index "lti_identities", ["lms_instance_id"], name: "index_lti_identities_on_lms_instance_id", using: :btree - add_index "lti_identities", ["lti_user_id"], name: "index_lti_identities_on_lti_user_id", using: :btree - add_index "lti_identities", ["user_id"], name: "index_lti_identities_on_user_id", using: :btree - - create_table "lti_workouts", force: :cascade do |t| - t.integer "workout_id", limit: 4 - t.string "lms_assignment_id", limit: 255, null: false + create_table "lti_workouts", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| + t.integer "workout_id" + t.string "lms_assignment_id", null: false t.datetime "created_at" t.datetime "updated_at" - t.integer "lms_instance_id", limit: 4 + t.integer "lms_instance_id" + t.index ["lms_instance_id"], name: "index_lti_workouts_on_lms_instance_id" + t.index ["workout_id"], name: "index_lti_workouts_on_workout_id" end - add_index "lti_workouts", ["lms_instance_id"], name: "index_lti_workouts_on_lms_instance_id", using: :btree - add_index "lti_workouts", ["workout_id"], name: "index_lti_workouts_on_workout_id", using: :btree - - create_table "memberships", force: :cascade do |t| - t.integer "user_id", limit: 4 - t.integer "user_group_id", limit: 4 + create_table "memberships", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| + t.integer "user_id" + t.integer "user_group_id" t.datetime "created_at" t.datetime "updated_at" end - create_table "multiple_choice_prompt_answers", force: :cascade do |t| + create_table "multiple_choice_prompt_answers", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| end - create_table "multiple_choice_prompts", force: :cascade do |t| + create_table "multiple_choice_prompts", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| t.boolean "allow_multiple", default: false, null: false - t.boolean "is_scrambled", default: true, null: false + t.boolean "is_scrambled", default: true, null: false end - create_table "organizations", force: :cascade do |t| - t.string "name", limit: 255, default: "", null: false + create_table "organizations", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| + t.string "name", default: "", null: false t.datetime "created_at" t.datetime "updated_at" - t.string "abbreviation", limit: 255 - t.string "slug", limit: 255, default: "", null: false - t.boolean "is_hidden", default: false + t.string "abbreviation" + t.string "slug", default: "", null: false + t.boolean "is_hidden", default: false + t.index ["slug"], name: "index_organizations_on_slug", unique: true end - add_index "organizations", ["slug"], name: "index_organizations_on_slug", unique: true, using: :btree - - create_table "ownerships", force: :cascade do |t| - t.string "filename", limit: 255 - t.integer "resource_file_id", limit: 4 - t.integer "exercise_version_id", limit: 4 - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + create_table "ownerships", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| + t.string "filename" + t.integer "resource_file_id" + t.integer "exercise_version_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["exercise_version_id"], name: "index_ownerships_on_exercise_version_id" + t.index ["filename"], name: "index_ownerships_on_filename" + t.index ["resource_file_id"], name: "index_ownerships_on_resource_file_id" end - add_index "ownerships", ["exercise_version_id"], name: "index_ownerships_on_exercise_version_id", using: :btree - add_index "ownerships", ["filename"], name: "index_ownerships_on_filename", using: :btree - - create_table "prompt_answers", force: :cascade do |t| - t.integer "attempt_id", limit: 4 - t.integer "prompt_id", limit: 4 - t.integer "actable_id", limit: 4 - t.string "actable_type", limit: 255 + create_table "prompt_answers", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| + t.integer "attempt_id" + t.integer "prompt_id" + t.integer "actable_id" + t.string "actable_type" + t.index ["actable_id"], name: "index_prompt_answers_on_actable_id" + t.index ["attempt_id", "prompt_id"], name: "index_prompt_answers_on_attempt_id_and_prompt_id", unique: true + t.index ["attempt_id"], name: "index_prompt_answers_on_attempt_id" + t.index ["prompt_id"], name: "index_prompt_answers_on_prompt_id" end - add_index "prompt_answers", ["actable_id"], name: "index_prompt_answers_on_actable_id", using: :btree - add_index "prompt_answers", ["attempt_id", "prompt_id"], name: "index_prompt_answers_on_attempt_id_and_prompt_id", unique: true, using: :btree - add_index "prompt_answers", ["attempt_id"], name: "index_prompt_answers_on_attempt_id", using: :btree - add_index "prompt_answers", ["prompt_id"], name: "index_prompt_answers_on_prompt_id", using: :btree - - create_table "prompts", force: :cascade do |t| - t.integer "exercise_version_id", limit: 4, null: false - t.text "question", limit: 65535, null: false - t.integer "position", limit: 4, null: false - t.text "feedback", limit: 65535 + create_table "prompts", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| + t.integer "exercise_version_id", null: false + t.text "question", null: false + t.integer "position", null: false + t.text "feedback" t.datetime "created_at" t.datetime "updated_at" - t.integer "actable_id", limit: 4 - t.string "actable_type", limit: 255 - t.integer "irt_data_id", limit: 4 + t.integer "actable_id" + t.string "actable_type" + t.integer "irt_data_id" + t.index ["actable_id"], name: "index_prompts_on_actable_id" + t.index ["exercise_version_id"], name: "index_prompts_on_exercise_version_id" + t.index ["irt_data_id"], name: "prompts_irt_data_id_fk" end - add_index "prompts", ["actable_id"], name: "index_prompts_on_actable_id", using: :btree - add_index "prompts", ["irt_data_id"], name: "prompts_irt_data_id_fk", using: :btree - - create_table "resource_files", force: :cascade do |t| - t.string "filename", limit: 255 - t.string "token", limit: 255, default: "", null: false - t.integer "user_id", limit: 4, null: false - t.boolean "public", default: true + create_table "resource_files", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| + t.string "filename" + t.string "token", default: "", null: false + t.integer "user_id", null: false + t.boolean "public", default: true t.datetime "created_at" t.datetime "updated_at" - t.string "hashval", limit: 255 + t.string "hashval" + t.index ["hashval"], name: "index_resource_files_on_hashval" + t.index ["token"], name: "index_resource_files_on_token" + t.index ["user_id"], name: "index_resource_files_on_user_id" end - add_index "resource_files", ["hashval"], name: "index_resource_files_on_hashval", using: :btree - add_index "resource_files", ["token"], name: "index_resource_files_on_token", using: :btree - add_index "resource_files", ["user_id"], name: "index_resource_files_on_user_id", using: :btree - - create_table "signups", force: :cascade do |t| - t.string "first_name", limit: 255 - t.string "last_name_name", limit: 255 - t.string "email", limit: 255 - t.string "institution", limit: 255 - t.text "comments", limit: 65535 + create_table "signups", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| + t.string "first_name" + t.string "last_name_name" + t.string "email" + t.string "institution" + t.text "comments" t.datetime "created_at" t.datetime "updated_at" end - create_table "stems", force: :cascade do |t| - t.text "preamble", limit: 65535 + create_table "stems", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| + t.text "preamble" t.datetime "created_at" t.datetime "updated_at" end - create_table "student_extensions", force: :cascade do |t| - t.integer "user_id", limit: 4 - t.integer "workout_offering_id", limit: 4 + create_table "student_extensions", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| + t.integer "user_id" + t.integer "workout_offering_id" t.datetime "soft_deadline" t.datetime "hard_deadline" t.datetime "created_at" t.datetime "updated_at" - t.integer "time_limit", limit: 4 + t.integer "time_limit" t.datetime "opening_date" + t.index ["user_id"], name: "index_student_extensions_on_user_id" + t.index ["workout_offering_id"], name: "index_student_extensions_on_workout_offering_id" end - add_index "student_extensions", ["user_id"], name: "index_student_extensions_on_user_id", using: :btree - add_index "student_extensions", ["workout_offering_id"], name: "index_student_extensions_on_workout_offering_id", using: :btree - - create_table "tag_user_scores", force: :cascade do |t| - t.integer "user_id", limit: 4, null: false - t.integer "experience", limit: 4, default: 0 + create_table "tag_user_scores", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| + t.integer "user_id", null: false + t.integer "experience", default: 0 t.datetime "created_at" t.datetime "updated_at" - t.integer "completed_exercises", limit: 4, default: 0 + t.integer "completed_exercises", default: 0 + t.index ["user_id"], name: "index_tag_user_scores_on_user_id" end - add_index "tag_user_scores", ["user_id"], name: "index_tag_user_scores_on_user_id", using: :btree - - create_table "taggings", force: :cascade do |t| - t.integer "tag_id", limit: 4 - t.integer "taggable_id", limit: 4 - t.string "taggable_type", limit: 255 - t.integer "tagger_id", limit: 4 - t.string "tagger_type", limit: 255 - t.string "context", limit: 128 + create_table "taggings", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| + t.integer "tag_id" + t.integer "taggable_id" + t.string "taggable_type" + t.integer "tagger_id" + t.string "tagger_type" + t.string "context", limit: 128 t.datetime "created_at" + t.index ["context"], name: "index_taggings_on_context" + t.index ["tag_id", "taggable_id", "taggable_type", "context", "tagger_id", "tagger_type"], name: "taggings_idx", unique: true + t.index ["tag_id"], name: "index_taggings_on_tag_id" + t.index ["taggable_id", "taggable_type", "context"], name: "index_taggings_on_taggable_id_and_taggable_type_and_context" + t.index ["taggable_id", "taggable_type", "tagger_id", "context"], name: "taggings_idy" + t.index ["taggable_id"], name: "index_taggings_on_taggable_id" + t.index ["taggable_type"], name: "index_taggings_on_taggable_type" + t.index ["tagger_id", "tagger_type"], name: "index_taggings_on_tagger_id_and_tagger_type" + t.index ["tagger_id"], name: "index_taggings_on_tagger_id" end - add_index "taggings", ["context"], name: "index_taggings_on_context", using: :btree - add_index "taggings", ["tag_id", "taggable_id", "taggable_type", "context", "tagger_id", "tagger_type"], name: "taggings_idx", unique: true, using: :btree - add_index "taggings", ["tag_id"], name: "index_taggings_on_tag_id", using: :btree - add_index "taggings", ["taggable_id", "taggable_type", "context"], name: "index_taggings_on_taggable_id_and_taggable_type_and_context", using: :btree - add_index "taggings", ["taggable_id", "taggable_type", "tagger_id", "context"], name: "taggings_idy", using: :btree - add_index "taggings", ["taggable_id"], name: "index_taggings_on_taggable_id", using: :btree - add_index "taggings", ["taggable_type"], name: "index_taggings_on_taggable_type", using: :btree - add_index "taggings", ["tagger_id", "tagger_type"], name: "index_taggings_on_tagger_id_and_tagger_type", using: :btree - add_index "taggings", ["tagger_id"], name: "index_taggings_on_tagger_id", using: :btree - - create_table "tags", force: :cascade do |t| - t.string "name", limit: 255 - t.integer "taggings_count", limit: 4, default: 0 + create_table "tags", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| + t.string "name" + t.integer "taggings_count", default: 0 + t.index ["name"], name: "index_tags_on_name", unique: true end - add_index "tags", ["name"], name: "index_tags_on_name", unique: true, using: :btree - - create_table "terms", force: :cascade do |t| - t.integer "season", limit: 4, null: false - t.date "starts_on", null: false - t.date "ends_on", null: false - t.integer "year", limit: 4, null: false + create_table "terms", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| + t.integer "season", null: false + t.date "starts_on", null: false + t.date "ends_on", null: false + t.integer "year", null: false t.datetime "created_at" t.datetime "updated_at" - t.string "slug", limit: 255, default: "", null: false + t.string "slug", default: "", null: false + t.index ["slug"], name: "index_terms_on_slug", unique: true + t.index ["year", "season"], name: "index_terms_on_year_and_season" end - add_index "terms", ["slug"], name: "index_terms_on_slug", unique: true, using: :btree - add_index "terms", ["year", "season"], name: "index_terms_on_year_and_season", using: :btree - - create_table "test_case_results", force: :cascade do |t| - t.integer "test_case_id", limit: 4, null: false - t.integer "user_id", limit: 4, null: false - t.text "execution_feedback", limit: 65535 - t.integer "feedback_line_no", limit: 4 + create_table "test_case_results", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| + t.integer "test_case_id", null: false + t.integer "user_id", null: false + t.text "execution_feedback" + t.integer "feedback_line_no" t.datetime "created_at" t.datetime "updated_at" - t.boolean "pass", null: false - t.integer "coding_prompt_answer_id", limit: 4 + t.boolean "pass", null: false + t.integer "coding_prompt_answer_id" + t.index ["coding_prompt_answer_id"], name: "index_test_case_results_on_coding_prompt_answer_id" + t.index ["test_case_id"], name: "index_test_case_results_on_test_case_id" + t.index ["user_id"], name: "index_test_case_results_on_user_id" end - add_index "test_case_results", ["coding_prompt_answer_id"], name: "index_test_case_results_on_coding_prompt_answer_id", using: :btree - add_index "test_case_results", ["test_case_id"], name: "index_test_case_results_on_test_case_id", using: :btree - add_index "test_case_results", ["user_id"], name: "index_test_case_results_on_user_id", using: :btree - - create_table "test_cases", force: :cascade do |t| - t.text "negative_feedback", limit: 65535 - t.float "weight", limit: 24, null: false - t.text "description", limit: 65535 + create_table "test_cases", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| + t.text "negative_feedback" + t.float "weight", null: false + t.text "description" t.datetime "created_at" t.datetime "updated_at" - t.integer "coding_prompt_id", limit: 4, null: false - t.text "input", limit: 65535, null: false - t.text "expected_output", limit: 65535, null: false - t.boolean "static", default: false, null: false - t.boolean "screening", default: false, null: false - t.boolean "example", default: false, null: false - t.boolean "hidden", default: false, null: false + t.integer "coding_prompt_id", null: false + t.text "input", null: false + t.text "expected_output", null: false + t.boolean "static", default: false, null: false + t.boolean "screening", default: false, null: false + t.boolean "example", default: false, null: false + t.boolean "hidden", default: false, null: false + t.index ["coding_prompt_id"], name: "index_test_cases_on_coding_prompt_id" end - create_table "time_zones", force: :cascade do |t| - t.string "name", limit: 255 - t.string "zone", limit: 255 - t.string "display_as", limit: 255 + create_table "time_zones", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| + t.string "name" + t.string "zone" + t.string "display_as" t.datetime "created_at" t.datetime "updated_at" end - create_table "user_groups", force: :cascade do |t| - t.string "name", limit: 255 + create_table "user_groups", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| + t.string "name" t.datetime "created_at" t.datetime "updated_at" - t.text "description", limit: 65535 + t.text "description" end - create_table "users", force: :cascade do |t| - t.string "email", limit: 255, default: "", null: false - t.string "encrypted_password", limit: 255, default: "", null: false - t.string "reset_password_token", limit: 255 + create_table "users", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| + t.string "email", default: "", null: false + t.string "encrypted_password", default: "", null: false + t.string "reset_password_token" t.datetime "reset_password_sent_at" t.datetime "remember_created_at" - t.integer "sign_in_count", limit: 4, default: 0, null: false + t.integer "sign_in_count", default: 0, null: false t.datetime "current_sign_in_at" t.datetime "last_sign_in_at" - t.string "current_sign_in_ip", limit: 255 - t.string "last_sign_in_ip", limit: 255 - t.string "confirmation_token", limit: 255 + t.string "current_sign_in_ip" + t.string "last_sign_in_ip" + t.string "confirmation_token" t.datetime "confirmed_at" t.datetime "confirmation_sent_at" t.datetime "created_at" t.datetime "updated_at" - t.string "first_name", limit: 255 - t.string "last_name", limit: 255 - t.integer "global_role_id", limit: 4, null: false - t.string "avatar", limit: 255 - t.string "slug", limit: 255, default: "", null: false - t.integer "current_workout_score_id", limit: 4 - t.integer "time_zone_id", limit: 4 + t.string "first_name" + t.string "last_name" + t.integer "global_role_id", null: false + t.string "avatar" + t.string "slug", default: "", null: false + t.integer "current_workout_score_id" + t.integer "time_zone_id" + t.index ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true + t.index ["current_workout_score_id"], name: "index_users_on_current_workout_score_id", unique: true + t.index ["email"], name: "index_users_on_email", unique: true + t.index ["global_role_id"], name: "index_users_on_global_role_id" + t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true + t.index ["slug"], name: "index_users_on_slug", unique: true + t.index ["time_zone_id"], name: "index_users_on_time_zone_id" end - add_index "users", ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true, using: :btree - add_index "users", ["current_workout_score_id"], name: "index_users_on_current_workout_score_id", unique: true, using: :btree - add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree - add_index "users", ["global_role_id"], name: "index_users_on_global_role_id", using: :btree - add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree - add_index "users", ["slug"], name: "index_users_on_slug", unique: true, using: :btree - add_index "users", ["time_zone_id"], name: "index_users_on_time_zone_id", using: :btree - - create_table "visualization_loggings", force: :cascade do |t| - t.integer "user_id", limit: 4 - t.integer "exercise_id", limit: 4 - t.integer "workout_id", limit: 4 - t.integer "workout_offering_id", limit: 4 + create_table "visualization_loggings", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| + t.integer "user_id" + t.integer "exercise_id" + t.integer "workout_id" + t.integer "workout_offering_id" t.datetime "created_at" t.datetime "updated_at" + t.index ["exercise_id"], name: "index_visualization_loggings_on_exercise_id" + t.index ["user_id"], name: "index_visualization_loggings_on_user_id" + t.index ["workout_id"], name: "index_visualization_loggings_on_workout_id" + t.index ["workout_offering_id"], name: "index_visualization_loggings_on_workout_offering_id" end - add_index "visualization_loggings", ["exercise_id"], name: "index_visualization_loggings_on_exercise_id", using: :btree - add_index "visualization_loggings", ["user_id"], name: "index_visualization_loggings_on_user_id", using: :btree - add_index "visualization_loggings", ["workout_id"], name: "index_visualization_loggings_on_workout_id", using: :btree - add_index "visualization_loggings", ["workout_offering_id"], name: "index_visualization_loggings_on_workout_offering_id", using: :btree - - create_table "workout_offerings", force: :cascade do |t| - t.integer "course_offering_id", limit: 4, null: false - t.integer "workout_id", limit: 4, null: false + create_table "workout_offerings", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| + t.integer "course_offering_id", null: false + t.integer "workout_id", null: false t.datetime "created_at" t.datetime "updated_at" t.datetime "opening_date" t.datetime "soft_deadline" t.datetime "hard_deadline" - t.boolean "published", default: true, null: false - t.integer "time_limit", limit: 4 - t.integer "workout_policy_id", limit: 4 - t.integer "continue_from_workout_id", limit: 4 - t.string "lms_assignment_id", limit: 255 - t.boolean "most_recent", default: true - t.string "lms_assignment_url", limit: 255 - t.integer "attempt_limit", limit: 4 - end - - add_index "workout_offerings", ["continue_from_workout_id"], name: "workout_offerings_continue_from_workout_id_fk", using: :btree - add_index "workout_offerings", ["course_offering_id"], name: "index_workout_offerings_on_course_offering_id", using: :btree - add_index "workout_offerings", ["lms_assignment_id"], name: "index_workout_offerings_on_lms_assignment_id", using: :btree - add_index "workout_offerings", ["workout_id"], name: "index_workout_offerings_on_workout_id", using: :btree - add_index "workout_offerings", ["workout_policy_id"], name: "index_workout_offerings_on_workout_policy_id", using: :btree - - create_table "workout_owners", force: :cascade do |t| - t.integer "workout_id", limit: 4, null: false - t.integer "owner_id", limit: 4, null: false - end - - add_index "workout_owners", ["owner_id"], name: "workout_owners_owner_id_fk", using: :btree - add_index "workout_owners", ["workout_id", "owner_id"], name: "index_workout_owners_on_workout_id_and_owner_id", unique: true, using: :btree - - create_table "workout_policies", force: :cascade do |t| - t.boolean "hide_thumbnails_before_start" - t.boolean "hide_feedback_before_finish" - t.boolean "hide_compilation_feedback_before_finish" - t.boolean "no_review_before_close" - t.boolean "hide_feedback_in_review_before_close" - t.boolean "hide_thumbnails_in_review_before_close" - t.boolean "no_hints" - t.boolean "no_faq" - t.string "name", limit: 255 - t.datetime "created_at" - t.datetime "updated_at" - t.boolean "invisible_before_review" - t.string "description", limit: 255 - t.boolean "hide_score_before_finish" - t.boolean "hide_score_in_review_before_close" - end - - create_table "workout_scores", force: :cascade do |t| - t.integer "workout_id", limit: 4, null: false - t.integer "user_id", limit: 4, null: false - t.float "score", limit: 24 - t.boolean "completed" + t.boolean "published", default: true, null: false + t.integer "time_limit" + t.integer "workout_policy_id" + t.integer "continue_from_workout_id" + t.string "lms_assignment_id" + t.boolean "most_recent", default: true + t.string "lms_assignment_url" + t.integer "attempt_limit" + t.index ["continue_from_workout_id"], name: "workout_offerings_continue_from_workout_id_fk" + t.index ["course_offering_id"], name: "index_workout_offerings_on_course_offering_id" + t.index ["lms_assignment_id"], name: "index_workout_offerings_on_lms_assignment_id" + t.index ["workout_id"], name: "index_workout_offerings_on_workout_id" + t.index ["workout_policy_id"], name: "index_workout_offerings_on_workout_policy_id" + end + + create_table "workout_owners", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| + t.integer "workout_id", null: false + t.integer "owner_id", null: false + t.index ["owner_id"], name: "workout_owners_owner_id_fk" + t.index ["workout_id", "owner_id"], name: "index_workout_owners_on_workout_id_and_owner_id", unique: true + end + + create_table "workout_policies", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| + t.boolean "hide_thumbnails_before_start" + t.boolean "hide_feedback_before_finish" + t.boolean "hide_compilation_feedback_before_finish" + t.boolean "no_review_before_close" + t.boolean "hide_feedback_in_review_before_close" + t.boolean "hide_thumbnails_in_review_before_close" + t.boolean "no_hints" + t.boolean "no_faq" + t.string "name" + t.datetime "created_at" + t.datetime "updated_at" + t.boolean "invisible_before_review" + t.string "description" + t.boolean "hide_score_before_finish" + t.boolean "hide_score_in_review_before_close" + end + + create_table "workout_scores", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| + t.integer "workout_id", null: false + t.integer "user_id", null: false + t.float "score" + t.boolean "completed" t.datetime "completed_at" t.datetime "last_attempted_at" - t.integer "exercises_completed", limit: 4 - t.integer "exercises_remaining", limit: 4 + t.integer "exercises_completed" + t.integer "exercises_remaining" t.datetime "created_at" t.datetime "updated_at" - t.integer "workout_offering_id", limit: 4 - t.string "lis_outcome_service_url", limit: 255 - t.string "lis_result_sourcedid", limit: 255 - t.integer "lti_workout_id", limit: 4 + t.integer "workout_offering_id" + t.string "lis_outcome_service_url" + t.string "lis_result_sourcedid" + t.integer "lti_workout_id" t.datetime "started_at" + t.index ["lti_workout_id"], name: "index_workout_scores_on_lti_workout_id" + t.index ["user_id", "workout_id", "workout_offering_id"], name: "idx_ws_on_user_workout_workout_offering" + t.index ["user_id"], name: "index_workout_scores_on_user_id" + t.index ["workout_id"], name: "index_workout_scores_on_workout_id" + t.index ["workout_offering_id"], name: "workout_scores_workout_offering_id_fk" end - add_index "workout_scores", ["lti_workout_id"], name: "index_workout_scores_on_lti_workout_id", using: :btree - add_index "workout_scores", ["user_id", "workout_id", "workout_offering_id"], name: "idx_ws_on_user_workout_workout_offering", using: :btree - add_index "workout_scores", ["user_id"], name: "index_workout_scores_on_user_id", using: :btree - add_index "workout_scores", ["workout_id"], name: "index_workout_scores_on_workout_id", using: :btree - add_index "workout_scores", ["workout_offering_id"], name: "workout_scores_workout_offering_id_fk", using: :btree - - create_table "workouts", force: :cascade do |t| - t.string "name", limit: 255, default: "", null: false - t.boolean "scrambled", default: false + create_table "workouts", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci", force: :cascade do |t| + t.string "name", default: "", null: false + t.boolean "scrambled", default: false t.datetime "created_at" t.datetime "updated_at" - t.text "description", limit: 65535 - t.integer "points_multiplier", limit: 4 - t.integer "creator_id", limit: 4 - t.string "external_id", limit: 255 - t.boolean "is_public" + t.text "description" + t.integer "points_multiplier" + t.integer "creator_id" + t.string "external_id" + t.boolean "is_public" + t.index ["creator_id"], name: "workouts_creator_id_fk" + t.index ["external_id"], name: "index_workouts_on_external_id", unique: true + t.index ["is_public"], name: "index_workouts_on_is_public" end - add_index "workouts", ["creator_id"], name: "workouts_creator_id_fk", using: :btree - add_index "workouts", ["external_id"], name: "index_workouts_on_external_id", unique: true, using: :btree - add_index "workouts", ["is_public"], name: "index_workouts_on_is_public", using: :btree - add_foreign_key "attempts", "exercise_versions", name: "attempts_exercise_version_id_fk" add_foreign_key "attempts", "users", name: "attempts_user_id_fk" add_foreign_key "attempts", "workout_scores", column: "active_score_id", name: "attempts_active_score_id_fk" @@ -734,7 +698,9 @@ add_foreign_key "course_offerings", "courses", name: "course_offerings_course_id_fk" add_foreign_key "course_offerings", "terms", name: "course_offerings_term_id_fk" add_foreign_key "courses", "organizations", name: "courses_organization_id_fk" + add_foreign_key "exercise_owners", "exercises", name: "exercise_owners_exercise_id_fk" add_foreign_key "exercise_owners", "users", column: "owner_id", name: "exercise_owners_owner_id_fk" + add_foreign_key "exercise_versions", "exercises", name: "exercise_versions_exercise_id_fk" add_foreign_key "exercise_versions", "irt_data", column: "irt_data_id", name: "exercise_versions_irt_data_id_fk" add_foreign_key "exercise_versions", "stems", name: "exercise_versions_stem_id_fk" add_foreign_key "exercise_versions", "users", column: "creator_id", name: "exercise_versions_creator_id_fk" @@ -743,13 +709,16 @@ add_foreign_key "exercise_workouts", "exercises", name: "exercise_workouts_exercise_id_fk" add_foreign_key "exercise_workouts", "workouts", name: "exercise_workouts_workout_id_fk" add_foreign_key "exercises", "exercise_families", name: "exercises_exercise_family_id_fk" + add_foreign_key "exercises", "exercise_versions", column: "current_version_id", name: "exercises_current_version_id_fk" add_foreign_key "exercises", "irt_data", column: "irt_data_id", name: "exercises_irt_data_id_fk" add_foreign_key "identities", "users", name: "identities_user_id_fk" add_foreign_key "lms_instances", "lms_types", name: "lms_instances_lms_type_id_fk" add_foreign_key "lti_workouts", "lms_instances" add_foreign_key "ownerships", "exercise_versions" + add_foreign_key "ownerships", "resource_files" add_foreign_key "prompt_answers", "attempts", name: "prompt_answers_attempt_id_fk" add_foreign_key "prompt_answers", "prompts", name: "prompt_answers_prompt_id_fk" + add_foreign_key "prompts", "exercise_versions", name: "prompts_exercise_version_id_fk" add_foreign_key "prompts", "irt_data", column: "irt_data_id", name: "prompts_irt_data_id_fk" add_foreign_key "resource_files", "users", name: "resource_files_user_id_fk" add_foreign_key "student_extensions", "users", name: "student_extensions_user_id_fk" @@ -758,6 +727,7 @@ add_foreign_key "test_case_results", "coding_prompt_answers", name: "test_case_results_coding_prompt_answer_id_fk" add_foreign_key "test_case_results", "test_cases", name: "test_case_results_test_case_id_fk" add_foreign_key "test_case_results", "users", name: "test_case_results_user_id_fk" + add_foreign_key "test_cases", "coding_prompts", name: "test_cases_coding_prompt_id_fk" add_foreign_key "users", "global_roles", name: "users_global_role_id_fk" add_foreign_key "users", "time_zones", name: "users_time_zone_id_fk" add_foreign_key "users", "workout_scores", column: "current_workout_score_id", name: "users_current_workout_score_id_fk" diff --git a/docker-compose.yml b/docker-compose.yml index 91facf81..00794a27 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,7 @@ version: '3.8' services: db_dev: - image: mysql:5.7 + image: mariadb:10.2 environment: MYSQL_ROOT_PASSWORD: root MYSQL_USER: codeworkout @@ -10,9 +10,9 @@ services: ports: - "3307:3306" volumes: - - dbdata:/var/lib/mysql:delegated + - dbdata:/var/lib/mariadb:delegated db_test: - image: mysql:5.7 + image: mariadb:10.2 environment: MYSQL_ROOT_PASSWORD: root MYSQL_USER: codeworkout @@ -30,6 +30,7 @@ services: stdin_open: true tty: true environment: + RUBYOPT: -W:no-deprecated DB_USERNAME: codeworkout DB_PASSWORD: codeworkout DB_DATABASE: codeworkout diff --git a/docker-run.sh b/docker-run.sh new file mode 100644 index 00000000..1311af5e --- /dev/null +++ b/docker-run.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +container_name=code-workout + +echo "Stop Container: $container_name" +docker container stop $container_name + +echo "Remove Container: $container_name" +docker container rm $container_name + +echo "Build Container: $container_name" + +docker build \ + -t $container_name . \ + --build-arg RAILS_ENV='development' \ + --build-arg UID=$(echo $UID) + +echo "Start Container: $container_name" +docker run \ + -v $PWD:/code-workout \ + --name $container_name \ + -p 9292:9292 $container_name:latest + +#docker container ps +#docker exec -it $container_name /bin/bash + + + +#docker build -t opendsa-lti . --build-arg RAILS_ENV='development' +#docker run -p 3000:3000 -it opendsa-lti /bin/bash +# +#bundle exec thin start --ssl --ssl-key-file server.key --ssl-cert-file server.crt -p 3000 +#bundle exec thin start -p 3000 diff --git a/runservers.sh b/runservers.sh index edd2f4c7..6ce8035e 100755 --- a/runservers.sh +++ b/runservers.sh @@ -1 +1 @@ -bundle exec thin start -p 9292 --debug +RUBYOPT='-W:no-deprecated' RAILS_ENV=development bundle exec thin start -p 9292 --debug diff --git a/start.sh b/start.sh new file mode 100755 index 00000000..9d398199 --- /dev/null +++ b/start.sh @@ -0,0 +1,45 @@ +#!/bin/bash + +#LOCALHOST +APP_DIR="/code-workout/" +# EFS_DIR="/var/tmp/credentials" +#EFS_DIR="${APP_DIR}" + +PORT="80" +#PORT="3000" + +ENVIRONMENT=$RAILS_ENV + +ERROR_FOUND=false; + +# echo "Copying files from NFS conf directory" +# cp "${EFS_DIR}/database.yml" "${APP_DIR}/config/database.yml" || ERROR_FOUND=true +#chmod +x "${APP_DIR}/email_notification.sh" + + +#echo "rm -rf /opendsa/Books/" +#rm -rf /opendsa/Books/ +#cd /opendsa +#find -type l -delete + +# echo "ln -s /var/tmp/credentials/opendsa/Books /opendsa" +# ln -s /var/tmp/credentials/opendsa/Books /opendsa + +#echo "Script finished." + +if [[ "${ERROR_FOUND}" == true ]]; then exit 1; fi; + +echo "Start cron process in foreground." + +cd "${APP_DIR}" + +echo "RAILS_ENV=$RAILS_ENV bundle exec thin start -p ${PORT}" + +#lsof -t -i tcp:${PORT} | xargs kill -9 + +#echo "RAILS_ENV=$RAILS_ENV rails s -b 0.0.0.0 -p ${PORT}" +#RAILS_ENV=${ENVIRONMENT} rails s -b 0.0.0.0 -p ${PORT} >> /var/log/opendsa-lti.log 2>&1 + +# Start process ithe background - Executes delayed_jobs +nohup bash -c "rake jobs:work >> /code-workout/log/development.log 2>&1" +RAILS_ENV=${ENVIRONMENT} bundle exec thin start -p ${PORT} >> /var/log/code-workout.log 2>&1