Description:
update migration
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r822:f42556ce3209 - - 77 files changed: 120 inserted, 111 deleted
@@ -277,97 +277,97 | |||||
|
277 | actionpack (>= 5.2) |
|
277 | actionpack (>= 5.2) |
|
278 | activemodel (>= 5.2) |
|
278 | activemodel (>= 5.2) |
|
279 | spring (2.1.1) |
|
279 | spring (2.1.1) |
|
280 | spring-watcher-listen (2.0.1) |
|
280 | spring-watcher-listen (2.0.1) |
|
281 | listen (>= 2.7, < 4.0) |
|
281 | listen (>= 2.7, < 4.0) |
|
282 | spring (>= 1.2, < 3.0) |
|
282 | spring (>= 1.2, < 3.0) |
|
283 | sprockets (4.0.2) |
|
283 | sprockets (4.0.2) |
|
284 | concurrent-ruby (~> 1.0) |
|
284 | concurrent-ruby (~> 1.0) |
|
285 | rack (> 1, < 3) |
|
285 | rack (> 1, < 3) |
|
286 | sprockets-rails (3.4.2) |
|
286 | sprockets-rails (3.4.2) |
|
287 | actionpack (>= 5.2) |
|
287 | actionpack (>= 5.2) |
|
288 | activesupport (>= 5.2) |
|
288 | activesupport (>= 5.2) |
|
289 | sprockets (>= 3.0.0) |
|
289 | sprockets (>= 3.0.0) |
|
290 | sqlite3 (1.4.2) |
|
290 | sqlite3 (1.4.2) |
|
291 | strscan (3.0.1) |
|
291 | strscan (3.0.1) |
|
292 | temple (0.8.2) |
|
292 | temple (0.8.2) |
|
293 | thor (1.2.1) |
|
293 | thor (1.2.1) |
|
294 | tilt (2.0.10) |
|
294 | tilt (2.0.10) |
|
295 | timeout (0.2.0) |
|
295 | timeout (0.2.0) |
|
296 | tzinfo (2.0.4) |
|
296 | tzinfo (2.0.4) |
|
297 | concurrent-ruby (~> 1.0) |
|
297 | concurrent-ruby (~> 1.0) |
|
298 | uglifier (4.2.0) |
|
298 | uglifier (4.2.0) |
|
299 | execjs (>= 0.3.0, < 3) |
|
299 | execjs (>= 0.3.0, < 3) |
|
300 | web-console (4.2.0) |
|
300 | web-console (4.2.0) |
|
301 | actionview (>= 6.0.0) |
|
301 | actionview (>= 6.0.0) |
|
302 | activemodel (>= 6.0.0) |
|
302 | activemodel (>= 6.0.0) |
|
303 | bindex (>= 0.4.0) |
|
303 | bindex (>= 0.4.0) |
|
304 | railties (>= 6.0.0) |
|
304 | railties (>= 6.0.0) |
|
305 | webdrivers (5.0.0) |
|
305 | webdrivers (5.0.0) |
|
306 | nokogiri (~> 1.6) |
|
306 | nokogiri (~> 1.6) |
|
307 | rubyzip (>= 1.3.0) |
|
307 | rubyzip (>= 1.3.0) |
|
308 | selenium-webdriver (~> 4.0) |
|
308 | selenium-webdriver (~> 4.0) |
|
309 | websocket-driver (0.7.5) |
|
309 | websocket-driver (0.7.5) |
|
310 | websocket-extensions (>= 0.1.0) |
|
310 | websocket-extensions (>= 0.1.0) |
|
311 | websocket-extensions (0.1.5) |
|
311 | websocket-extensions (0.1.5) |
|
312 | xpath (3.2.0) |
|
312 | xpath (3.2.0) |
|
313 | nokogiri (~> 1.8) |
|
313 | nokogiri (~> 1.8) |
|
314 | yaml_db (0.7.0) |
|
314 | yaml_db (0.7.0) |
|
315 | rails (>= 3.0) |
|
315 | rails (>= 3.0) |
|
316 | rake (>= 0.8.7) |
|
316 | rake (>= 0.8.7) |
|
317 | zeitwerk (2.5.3) |
|
317 | zeitwerk (2.5.3) |
|
318 |
|
318 | ||
|
319 | PLATFORMS |
|
319 | PLATFORMS |
|
320 | x86_64-linux |
|
320 | x86_64-linux |
|
321 |
|
321 | ||
|
322 | DEPENDENCIES |
|
322 | DEPENDENCIES |
|
323 | ace-rails-ap |
|
323 | ace-rails-ap |
|
324 | activerecord-session_store |
|
324 | activerecord-session_store |
|
325 | autoprefixer-rails |
|
325 | autoprefixer-rails |
|
326 | best_in_place! |
|
326 | best_in_place! |
|
327 | bootsnap |
|
327 | bootsnap |
|
328 | bootstrap-sass (~> 3.4.1) |
|
328 | bootstrap-sass (~> 3.4.1) |
|
329 | bootstrap-switch-rails |
|
329 | bootstrap-switch-rails |
|
330 | bootstrap-toggle-rails |
|
330 | bootstrap-toggle-rails |
|
331 | bootstrap3-datetimepicker-rails (~> 4.17.47) |
|
331 | bootstrap3-datetimepicker-rails (~> 4.17.47) |
|
332 | capybara |
|
332 | capybara |
|
333 | coffee-rails |
|
333 | coffee-rails |
|
334 | debug |
|
334 | debug |
|
335 | dynamic_form |
|
335 | dynamic_form |
|
336 | fuzzy-string-match |
|
336 | fuzzy-string-match |
|
337 | haml |
|
337 | haml |
|
338 | haml-rails |
|
338 | haml-rails |
|
339 | in_place_editing |
|
339 | in_place_editing |
|
340 | jbuilder |
|
340 | jbuilder |
|
341 | jquery-countdown-rails |
|
341 | jquery-countdown-rails |
|
342 | jquery-rails |
|
342 | jquery-rails |
|
343 | jquery-tablesorter |
|
343 | jquery-tablesorter |
|
344 | jquery-ui-rails |
|
344 | jquery-ui-rails |
|
345 | listen (>= 3.0.5, < 3.2) |
|
345 | listen (>= 3.0.5, < 3.2) |
|
346 |
|
346 | ||
|
347 | minitest-reporters |
|
347 | minitest-reporters |
|
348 | momentjs-rails (>= 2.9.0) |
|
348 | momentjs-rails (>= 2.9.0) |
|
349 | mysql2 |
|
349 | mysql2 |
|
350 | puma |
|
350 | puma |
|
351 | rails (~> 7.0) |
|
351 | rails (~> 7.0) |
|
352 | rails-controller-testing |
|
352 | rails-controller-testing |
|
353 | rails_bootstrap_sortable |
|
353 | rails_bootstrap_sortable |
|
354 | rdiscount |
|
354 | rdiscount |
|
355 | rouge |
|
355 | rouge |
|
356 | sassc-rails |
|
356 | sassc-rails |
|
357 | select2-rails |
|
357 | select2-rails |
|
358 | selenium-webdriver |
|
358 | selenium-webdriver |
|
359 | simple_form |
|
359 | simple_form |
|
360 | spring |
|
360 | spring |
|
361 | spring-watcher-listen (~> 2.0.0) |
|
361 | spring-watcher-listen (~> 2.0.0) |
|
362 | sprockets-rails |
|
362 | sprockets-rails |
|
363 | sqlite3 |
|
363 | sqlite3 |
|
364 | uglifier |
|
364 | uglifier |
|
365 | web-console (>= 3.3.0) |
|
365 | web-console (>= 3.3.0) |
|
366 | webdrivers |
|
366 | webdrivers |
|
367 | yaml_db |
|
367 | yaml_db |
|
368 |
|
368 | ||
|
369 | RUBY VERSION |
|
369 | RUBY VERSION |
|
370 | ruby 3.1.0p0 |
|
370 | ruby 3.1.0p0 |
|
371 |
|
371 | ||
|
372 | BUNDLED WITH |
|
372 | BUNDLED WITH |
|
373 |
- 2.3. |
|
373 | + 2.3.3 |
@@ -1,149 +1,159 | |||||
|
1 | == Installation |
|
1 | == Installation |
|
2 |
|
2 | ||
|
3 | Installing cafe-grader can be done in the following steps. |
|
3 | Installing cafe-grader can be done in the following steps. |
|
4 |
|
4 | ||
|
5 | 1. Set up database. We need MySQL 5 database name, username and password. |
|
5 | 1. Set up database. We need MySQL 5 database name, username and password. |
|
6 | 2. Install RVM. cafe-grader runs on Ruby on Rails and the best way to install it is to use RVM. |
|
6 | 2. Install RVM. cafe-grader runs on Ruby on Rails and the best way to install it is to use RVM. |
|
7 | 3. Install necessary package for the system |
|
7 | 3. Install necessary package for the system |
|
8 | 4. Install cafe-grader from github |
|
8 | 4. Install cafe-grader from github |
|
9 | 5. Deploy cafe-grader on apache with Phusion Passenger |
|
9 | 5. Deploy cafe-grader on apache with Phusion Passenger |
|
10 |
|
10 | ||
|
11 | Very important!!! All commands should be run from a normal user. |
|
11 | Very important!!! All commands should be run from a normal user. |
|
12 |
|
12 | ||
|
13 | The detail of each step are provided as follows. |
|
13 | The detail of each step are provided as follows. |
|
14 |
|
14 | ||
|
15 | === 1. Install MySQL 5 |
|
15 | === 1. Install MySQL 5 |
|
16 |
|
16 | ||
|
17 | Install MySQL server for the server. |
|
17 | Install MySQL server for the server. |
|
18 |
|
18 | ||
|
19 | cafe@grader:~$ sudo apt install mysql-server |
|
19 | cafe@grader:~$ sudo apt install mysql-server |
|
20 |
|
20 | ||
|
21 | Next, we will connect to mysql as root and set up the database. You can choose your DATABASENAME, USERNAME and PASSWORD as you wish. |
|
21 | Next, we will connect to mysql as root and set up the database. You can choose your DATABASENAME, USERNAME and PASSWORD as you wish. |
|
22 |
|
22 | ||
|
23 | cafe@grader:~$ sudo mysql -u root |
|
23 | cafe@grader:~$ sudo mysql -u root |
|
24 |
|
24 | ||
|
25 | mysql> create database DATABASENAME; |
|
25 | mysql> create database DATABASENAME; |
|
26 | Query OK, 1 row affected (0.00 sec) |
|
26 | Query OK, 1 row affected (0.00 sec) |
|
27 |
|
27 | ||
|
28 | mysql> grant all privileges on DATABASENAME.* to USERNAME@localhost identified by 'PASSWORD'; |
|
28 | mysql> grant all privileges on DATABASENAME.* to USERNAME@localhost identified by 'PASSWORD'; |
|
29 | Query OK, 0 rows affected, 1 warning (0.00 sec) |
|
29 | Query OK, 0 rows affected, 1 warning (0.00 sec) |
|
30 |
|
30 | ||
|
31 | mysql> flush privileges; |
|
31 | mysql> flush privileges; |
|
32 | Query OK, 0 rows affected (0.00 sec) |
|
32 | Query OK, 0 rows affected (0.00 sec) |
|
33 |
|
33 | ||
|
34 | === 2. Install RVM |
|
34 | === 2. Install RVM |
|
35 |
|
35 | ||
|
36 | Since Ubuntu has dedicated package for RVM we will use that. Just follow instruction given in https://github.com/rvm/ubuntu_rvm. For your convenience, the step are reproduced here. |
|
36 | Since Ubuntu has dedicated package for RVM we will use that. Just follow instruction given in https://github.com/rvm/ubuntu_rvm. For your convenience, the step are reproduced here. |
|
37 |
|
37 | ||
|
38 | First, we install necessary package for installing RVM. |
|
38 | First, we install necessary package for installing RVM. |
|
39 |
|
39 | ||
|
40 | cafe@grader:~$ sudo apt install software-properties-common |
|
40 | cafe@grader:~$ sudo apt install software-properties-common |
|
41 |
|
41 | ||
|
42 | Second, we add the custom PPA, update the system and install RVM. |
|
42 | Second, we add the custom PPA, update the system and install RVM. |
|
43 |
|
43 | ||
|
44 | cafe@grader:~$ sudo apt-add-repository -y ppa:rael-gc/rvm |
|
44 | cafe@grader:~$ sudo apt-add-repository -y ppa:rael-gc/rvm |
|
45 | cafe@grader:~$ sudo apt-get update |
|
45 | cafe@grader:~$ sudo apt-get update |
|
46 | cafe@grader:~$ sudo apt-get install rvm |
|
46 | cafe@grader:~$ sudo apt-get install rvm |
|
47 |
|
47 | ||
|
48 | We also need to add our user to the rvm group |
|
48 | We also need to add our user to the rvm group |
|
49 |
|
49 | ||
|
50 | sudo usermod -a -G rvm $USER |
|
50 | sudo usermod -a -G rvm $USER |
|
51 |
|
51 | ||
|
52 | This is very important. |
|
52 | This is very important. |
|
53 | 1. You have to reboot since RVM change a lots of system. |
|
53 | 1. You have to reboot since RVM change a lots of system. |
|
54 | 2. If you are using GUI version of Ubuntu, be sure to have Gnome Terminal (or any other terminal you are using) perform login every time. This can be done by mark the check box "Run command as a login shell" in Gnome terminal or by adding --login to bash. |
|
54 | 2. If you are using GUI version of Ubuntu, be sure to have Gnome Terminal (or any other terminal you are using) perform login every time. This can be done by mark the check box "Run command as a login shell" in Gnome terminal or by adding --login to bash. |
|
55 |
|
55 | ||
|
56 | - === 3. Install necessary package |
|
56 | + === 3. Install necessary package and nodejs |
|
|
57 | + | ||
|
|
58 | + First, we install required package via apt. | ||
|
|
59 | + | ||
|
|
60 | + cafe@grader:~$ sudo apt install libmysqlclient-dev default-jdk unzip php-cli apache2 dirmngr gnupg apache2-dev | ||
|
57 |
|
61 | ||
|
58 | - cafe@grader:~$ sudo apt install libmysqlclient-dev default-jdk unzip nodejs php-cli apache2 dirmngr gnupg apache2-dev |
|
62 | + Since nodejs that comes with ubuntu 18.04 is very outdated, we need to install it manually. This follow the method outlined in https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-ubuntu-18-04 under *Installing Node.js with Apt Using a NodeSource PPA* |
|
|
63 | + | ||
|
|
64 | + cd ~ | ||
|
|
65 | + curl -sL https://deb.nodesource.com/setup_17.x -o nodesource_setup.sh | ||
|
|
66 | + sudo bash nodesource_setup.sh | ||
|
|
67 | + sudo apt install nodejs | ||
|
|
68 | + | ||
|
59 |
|
69 | ||
|
60 | === 4. Install cafe-grader |
|
70 | === 4. Install cafe-grader |
|
61 |
|
71 | ||
|
62 | First, ensure that RVM is installed correctly. |
|
72 | First, ensure that RVM is installed correctly. |
|
63 |
|
73 | ||
|
64 | cafe@grader:~$ rvm |
|
74 | cafe@grader:~$ rvm |
|
65 |
|
75 | ||
|
66 | If you get a result similar to this. |
|
76 | If you get a result similar to this. |
|
67 |
|
77 | ||
|
68 | Command 'rvm' not found, but there are 21 similar ones. |
|
78 | Command 'rvm' not found, but there are 21 similar ones. |
|
69 |
|
79 | ||
|
70 | It is very likely that you have not re-login or you are using bash without --login. Please do so and re-read the installation of RVM on Ubuntu https://github.com/rvm/ubuntu_rvm again. |
|
80 | It is very likely that you have not re-login or you are using bash without --login. Please do so and re-read the installation of RVM on Ubuntu https://github.com/rvm/ubuntu_rvm again. |
|
71 |
|
81 | ||
|
72 | Next, we will let the install script do the work of installing cafe-grader. Please prepare the DATABASENAME, USERNAME and PASSWORD as the script will ask for that. Make sure that you run the script from the home directory of the user. |
|
82 | Next, we will let the install script do the work of installing cafe-grader. Please prepare the DATABASENAME, USERNAME and PASSWORD as the script will ask for that. Make sure that you run the script from the home directory of the user. |
|
73 |
|
83 | ||
|
74 | cafe@grader:~$ wget https://github.com/cafe-grader-team/cafe-grader-judge-scripts/raw/master/installer/install.sh |
|
84 | cafe@grader:~$ wget https://github.com/cafe-grader-team/cafe-grader-judge-scripts/raw/master/installer/install.sh |
|
75 | cafe@grader:~$ . ./install.sh |
|
85 | cafe@grader:~$ . ./install.sh |
|
76 |
|
86 | ||
|
77 | After installation is finished, grader is ready to run in development mode via WEBrick. We will try that by the following command which will start a grader accessible via http://localhost:3000/. You can try logging in to the system and verify that it is actually work. |
|
87 | After installation is finished, grader is ready to run in development mode via WEBrick. We will try that by the following command which will start a grader accessible via http://localhost:3000/. You can try logging in to the system and verify that it is actually work. |
|
78 |
|
88 | ||
|
79 | cafe@grader:~/cafe_grader/web$ rails s |
|
89 | cafe@grader:~/cafe_grader/web$ rails s |
|
80 |
|
90 | ||
|
81 | If Everything is OK, stop the WEBrick by Ctrl-C. |
|
91 | If Everything is OK, stop the WEBrick by Ctrl-C. |
|
82 |
|
92 | ||
|
83 | We are almost done. The last step is to set up apache and Phusion so that cafe-grader is served by apache. |
|
93 | We are almost done. The last step is to set up apache and Phusion so that cafe-grader is served by apache. |
|
84 |
|
94 | ||
|
85 | === 5. Deploy cafe-grader on Phusion passenger via apache |
|
95 | === 5. Deploy cafe-grader on Phusion passenger via apache |
|
86 |
|
96 | ||
|
87 | This will install a Passenger mod for apache. You can start by visiting https://www.phusionpassenger.com/library/walkthroughs/deploy/ruby/ownserver/apache/oss/install_passenger_main.html and fllow through the guide. We have reproduce the step here for Ubuntu 18.04. For other version, please select the appropriate one on the previous link. |
|
97 | This will install a Passenger mod for apache. You can start by visiting https://www.phusionpassenger.com/library/walkthroughs/deploy/ruby/ownserver/apache/oss/install_passenger_main.html and fllow through the guide. We have reproduce the step here for Ubuntu 18.04. For other version, please select the appropriate one on the previous link. |
|
88 |
|
98 | ||
|
89 | The deploy is divided into two parts: Installing Passenger and deploying the app. |
|
99 | The deploy is divided into two parts: Installing Passenger and deploying the app. |
|
90 |
|
100 | ||
|
91 | ==== 5.1. Installing Passenger as a mod for apache via PPA and enable it. |
|
101 | ==== 5.1. Installing Passenger as a mod for apache via PPA and enable it. |
|
92 |
|
102 | ||
|
93 | cafe@grader:~$ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 561F9B9CAC40B2F7 |
|
103 | cafe@grader:~$ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 561F9B9CAC40B2F7 |
|
94 | cafe@grader:~$ sudo apt-get install -y apt-transport-https ca-certificates |
|
104 | cafe@grader:~$ sudo apt-get install -y apt-transport-https ca-certificates |
|
95 | cafe@grader:~$ sudo sh -c 'echo deb https://oss-binaries.phusionpassenger.com/apt/passenger bionic main > /etc/apt/sources.list.d/passenger.list' |
|
105 | cafe@grader:~$ sudo sh -c 'echo deb https://oss-binaries.phusionpassenger.com/apt/passenger bionic main > /etc/apt/sources.list.d/passenger.list' |
|
96 | cafe@grader:~$ sudo apt-get update |
|
106 | cafe@grader:~$ sudo apt-get update |
|
97 | cafe@grader:~$ sudo apt-get install -y libapache2-mod-passenger |
|
107 | cafe@grader:~$ sudo apt-get install -y libapache2-mod-passenger |
|
98 | cafe@grader:~$ sudo a2enmod passenger |
|
108 | cafe@grader:~$ sudo a2enmod passenger |
|
99 |
|
109 | ||
|
100 |
|
110 | ||
|
101 | cafe@grader:~$ sudo apache2ctl restart |
|
111 | cafe@grader:~$ sudo apache2ctl restart |
|
102 |
|
112 | ||
|
103 | Finally, we should check that passenger is installed correctly. Run the following command and fix anything as suggested by the command. |
|
113 | Finally, we should check that passenger is installed correctly. Run the following command and fix anything as suggested by the command. |
|
104 |
|
114 | ||
|
105 | cafe@grader:~$ sudo /usr/bin/passenger-config validate-install |
|
115 | cafe@grader:~$ sudo /usr/bin/passenger-config validate-install |
|
106 |
|
116 | ||
|
107 | ==== 5.2. Deploying the app. First, we determine the exact location of our ruby that is installed via RVM. |
|
117 | ==== 5.2. Deploying the app. First, we determine the exact location of our ruby that is installed via RVM. |
|
108 |
|
118 | ||
|
109 | cafe@grader:~$ passenger-config about ruby-command |
|
119 | cafe@grader:~$ passenger-config about ruby-command |
|
110 | passenger-config was invoked through the following Ruby interpreter: |
|
120 | passenger-config was invoked through the following Ruby interpreter: |
|
111 | Command: /home/cafe/.rvm/gems/ruby-2.3.7/wrappers/ruby |
|
121 | Command: /home/cafe/.rvm/gems/ruby-2.3.7/wrappers/ruby |
|
112 | Version: ruby 2.3.7p456 (2018-03-28 revision 63024) [x86_64-linux] |
|
122 | Version: ruby 2.3.7p456 (2018-03-28 revision 63024) [x86_64-linux] |
|
113 | To use in Apache: PassengerRuby /home/cafe/.rvm/gems/ruby-2.3.7/wrappers/ruby |
|
123 | To use in Apache: PassengerRuby /home/cafe/.rvm/gems/ruby-2.3.7/wrappers/ruby |
|
114 | To use in Nginx : passenger_ruby /home/cafe/.rvm/gems/ruby-2.3.7/wrappers/ruby |
|
124 | To use in Nginx : passenger_ruby /home/cafe/.rvm/gems/ruby-2.3.7/wrappers/ruby |
|
115 | To use with Standalone: /home/cafe/.rvm/gems/ruby-2.3.7/wrappers/ruby /usr/bin/passenger start |
|
125 | To use with Standalone: /home/cafe/.rvm/gems/ruby-2.3.7/wrappers/ruby /usr/bin/passenger start |
|
116 |
|
126 | ||
|
117 | Then, take note of the path after "Command". For this guide, it is /home/cafe/.rvm/gems/ruby-2.3.7/wrappers/ruby |
|
127 | Then, take note of the path after "Command". For this guide, it is /home/cafe/.rvm/gems/ruby-2.3.7/wrappers/ruby |
|
118 |
|
128 | ||
|
119 | Assuming that cafe-grader is installed at /home/cafe/cafe_grader, we will edit the Apache's site config file /etc/apache2/site-enabled/000-default.conf as follow. |
|
129 | Assuming that cafe-grader is installed at /home/cafe/cafe_grader, we will edit the Apache's site config file /etc/apache2/site-enabled/000-default.conf as follow. |
|
120 |
|
130 | ||
|
121 | <VirtualHost *:80> |
|
131 | <VirtualHost *:80> |
|
122 | #ServerName www.example.com |
|
132 | #ServerName www.example.com |
|
123 |
|
133 | ||
|
124 | ServerAdmin webmaster@localhost |
|
134 | ServerAdmin webmaster@localhost |
|
125 | # dont forget to change the document root |
|
135 | # dont forget to change the document root |
|
126 | DocumentRoot /home/cafe/cafe_grader/web/public |
|
136 | DocumentRoot /home/cafe/cafe_grader/web/public |
|
127 |
|
137 | ||
|
128 | ErrorLog ${APACHE_LOG_DIR}/error.log |
|
138 | ErrorLog ${APACHE_LOG_DIR}/error.log |
|
129 | CustomLog ${APACHE_LOG_DIR}/access.log combined |
|
139 | CustomLog ${APACHE_LOG_DIR}/access.log combined |
|
130 |
|
140 | ||
|
131 | # add Passenger |
|
141 | # add Passenger |
|
132 | PassengerRuby /home/cafe/.rvm/gems/ruby-2.3.7/wrappers/ruby |
|
142 | PassengerRuby /home/cafe/.rvm/gems/ruby-2.3.7/wrappers/ruby |
|
133 |
|
143 | ||
|
134 | # our cafe-grader app |
|
144 | # our cafe-grader app |
|
135 | <Directory /home/cafe/cafe_grader/web/public> |
|
145 | <Directory /home/cafe/cafe_grader/web/public> |
|
136 | Allow from all |
|
146 | Allow from all |
|
137 | Options -MultiViews |
|
147 | Options -MultiViews |
|
138 | Require all granted |
|
148 | Require all granted |
|
139 | </Directory> |
|
149 | </Directory> |
|
140 | </VirtualHost> |
|
150 | </VirtualHost> |
|
141 |
|
151 | ||
|
142 |
|
152 | ||
|
143 | Be noted that we make 3 modifications: 1) change DocumentRoot, 2) add PassengerRuby option and add 3) Directory directive |
|
153 | Be noted that we make 3 modifications: 1) change DocumentRoot, 2) add PassengerRuby option and add 3) Directory directive |
|
144 | As the last step, we restart apache again and the site is ready to be used. |
|
154 | As the last step, we restart apache again and the site is ready to be used. |
|
145 |
|
155 | ||
|
146 | cafe@grader:~$ sudo apache2ctl restart |
|
156 | cafe@grader:~$ sudo apache2ctl restart |
|
147 |
|
157 | ||
|
148 | Now it is done, you can login to the grader with user 'root' and password 'ioionrails' |
|
158 | Now it is done, you can login to the grader with user 'root' and password 'ioionrails' |
|
149 |
|
159 |
@@ -1,17 +1,17 | |||||
|
1 | - class CreateUsers < ActiveRecord::Migration |
|
1 | + class CreateUsers < ActiveRecord::Migration[4.2] |
|
2 | def self.up |
|
2 | def self.up |
|
3 | - create_table :users do |t| |
|
3 | + create_table :users, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t| |
|
4 | t.column :login, :string, :limit => 10 |
|
4 | t.column :login, :string, :limit => 10 |
|
5 | t.column :full_name, :string |
|
5 | t.column :full_name, :string |
|
6 | t.column :hashed_password, :string |
|
6 | t.column :hashed_password, :string |
|
7 | t.column :salt, :string, :limit => 5 |
|
7 | t.column :salt, :string, :limit => 5 |
|
8 | t.column :alias, :string |
|
8 | t.column :alias, :string |
|
9 | end |
|
9 | end |
|
10 | # force unique name |
|
10 | # force unique name |
|
11 | add_index :users, :login, :unique => true |
|
11 | add_index :users, :login, :unique => true |
|
12 | end |
|
12 | end |
|
13 |
|
13 | ||
|
14 | def self.down |
|
14 | def self.down |
|
15 | drop_table :users |
|
15 | drop_table :users |
|
16 | end |
|
16 | end |
|
17 | end |
|
17 | end |
@@ -1,15 +1,15 | |||||
|
1 | - class CreateProblems < ActiveRecord::Migration |
|
1 | + class CreateProblems < ActiveRecord::Migration[4.2] |
|
2 | def self.up |
|
2 | def self.up |
|
3 | - create_table :problems do |t| |
|
3 | + create_table :problems, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t| |
|
4 | t.column :name, :string, :limit => 30 |
|
4 | t.column :name, :string, :limit => 30 |
|
5 | t.column :full_name, :string |
|
5 | t.column :full_name, :string |
|
6 | t.column :full_score, :integer |
|
6 | t.column :full_score, :integer |
|
7 | t.column :date_added, :date |
|
7 | t.column :date_added, :date |
|
8 | t.column :available, :boolean |
|
8 | t.column :available, :boolean |
|
9 | end |
|
9 | end |
|
10 | end |
|
10 | end |
|
11 |
|
11 | ||
|
12 | def self.down |
|
12 | def self.down |
|
13 | drop_table :problems |
|
13 | drop_table :problems |
|
14 | end |
|
14 | end |
|
15 | end |
|
15 | end |
@@ -1,21 +1,21 | |||||
|
1 | - class CreateSubmissions < ActiveRecord::Migration |
|
1 | + class CreateSubmissions < ActiveRecord::Migration[4.2] |
|
2 | def self.up |
|
2 | def self.up |
|
3 | - create_table :submissions do |t| |
|
3 | + create_table :submissions, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t| |
|
4 | t.column :user_id, :integer |
|
4 | t.column :user_id, :integer |
|
5 | t.column :problem_id, :integer |
|
5 | t.column :problem_id, :integer |
|
6 | t.column :language_id, :integer |
|
6 | t.column :language_id, :integer |
|
7 | t.column :source, :text |
|
7 | t.column :source, :text |
|
8 | t.column :binary, :binary |
|
8 | t.column :binary, :binary |
|
9 | t.column :submitted_at, :datetime |
|
9 | t.column :submitted_at, :datetime |
|
10 | t.column :compiled_at, :datetime |
|
10 | t.column :compiled_at, :datetime |
|
11 | t.column :compiler_message, :text |
|
11 | t.column :compiler_message, :text |
|
12 | t.column :graded_at, :datetime |
|
12 | t.column :graded_at, :datetime |
|
13 | t.column :points, :integer |
|
13 | t.column :points, :integer |
|
14 | t.column :grader_comment, :text |
|
14 | t.column :grader_comment, :text |
|
15 | end |
|
15 | end |
|
16 | end |
|
16 | end |
|
17 |
|
17 | ||
|
18 | def self.down |
|
18 | def self.down |
|
19 | drop_table :submissions |
|
19 | drop_table :submissions |
|
20 | end |
|
20 | end |
|
21 | end |
|
21 | end |
@@ -1,16 +1,16 | |||||
|
1 | - class CreateLanguages < ActiveRecord::Migration |
|
1 | + class CreateLanguages < ActiveRecord::Migration[4.2] |
|
2 | def self.up |
|
2 | def self.up |
|
3 | - create_table :languages do |t| |
|
3 | + create_table :languages, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t| |
|
4 | t.column :name, :string, :limit => 10 |
|
4 | t.column :name, :string, :limit => 10 |
|
5 | t.column :pretty_name, :string |
|
5 | t.column :pretty_name, :string |
|
6 | end |
|
6 | end |
|
7 |
|
7 | ||
|
8 | Language.create(:name => "c", :pretty_name => "C") |
|
8 | Language.create(:name => "c", :pretty_name => "C") |
|
9 | Language.create(:name => "cpp", :pretty_name => "C++") |
|
9 | Language.create(:name => "cpp", :pretty_name => "C++") |
|
10 | Language.create(:name => "pas", :pretty_name => "Pascal") |
|
10 | Language.create(:name => "pas", :pretty_name => "Pascal") |
|
11 | end |
|
11 | end |
|
12 |
|
12 | ||
|
13 | def self.down |
|
13 | def self.down |
|
14 | drop_table :languages |
|
14 | drop_table :languages |
|
15 | end |
|
15 | end |
|
16 | end |
|
16 | end |
@@ -1,9 +1,9 | |||||
|
1 | - class AddIndexToSubmissions < ActiveRecord::Migration |
|
1 | + class AddIndexToSubmissions < ActiveRecord::Migration[4.2] |
|
2 | def self.up |
|
2 | def self.up |
|
3 | add_index :submissions, [:user_id, :problem_id] |
|
3 | add_index :submissions, [:user_id, :problem_id] |
|
4 | end |
|
4 | end |
|
5 |
|
5 | ||
|
6 | def self.down |
|
6 | def self.down |
|
7 | remove_index :submissions, :column => [:user_id, :problem_id] |
|
7 | remove_index :submissions, :column => [:user_id, :problem_id] |
|
8 | end |
|
8 | end |
|
9 | end |
|
9 | end |
@@ -1,19 +1,19 | |||||
|
1 | - class CreateRoles < ActiveRecord::Migration |
|
1 | + class CreateRoles < ActiveRecord::Migration[4.2] |
|
2 | def self.up |
|
2 | def self.up |
|
3 | - create_table :roles do |t| |
|
3 | + create_table :roles, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t| |
|
4 | t.column 'name', :string |
|
4 | t.column 'name', :string |
|
5 | end |
|
5 | end |
|
6 |
|
6 | ||
|
7 | - create_table :roles_users, :id => false do |t| |
|
7 | + create_table :roles_users, :id => false, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t| |
|
8 | t.column 'role_id', :integer |
|
8 | t.column 'role_id', :integer |
|
9 | t.column 'user_id', :integer |
|
9 | t.column 'user_id', :integer |
|
10 | end |
|
10 | end |
|
11 |
|
11 | ||
|
12 | add_index :roles_users, :user_id |
|
12 | add_index :roles_users, :user_id |
|
13 | end |
|
13 | end |
|
14 |
|
14 | ||
|
15 | def self.down |
|
15 | def self.down |
|
16 | drop_table :roles_users |
|
16 | drop_table :roles_users |
|
17 | drop_table :roles |
|
17 | drop_table :roles |
|
18 | end |
|
18 | end |
|
19 | end |
|
19 | end |
@@ -1,21 +1,21 | |||||
|
1 | - class CreateRights < ActiveRecord::Migration |
|
1 | + class CreateRights < ActiveRecord::Migration[4.2] |
|
2 | def self.up |
|
2 | def self.up |
|
3 | - create_table :rights do |t| |
|
3 | + create_table :rights, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t| |
|
4 | t.column 'name', :string |
|
4 | t.column 'name', :string |
|
5 | t.column 'controller', :string |
|
5 | t.column 'controller', :string |
|
6 | t.column 'action', :string |
|
6 | t.column 'action', :string |
|
7 | end |
|
7 | end |
|
8 |
|
8 | ||
|
9 | - create_table :rights_roles, :id => false do |t| |
|
9 | + create_table :rights_roles, :id => false, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t| |
|
10 | t.column 'right_id', :integer |
|
10 | t.column 'right_id', :integer |
|
11 | t.column 'role_id', :integer |
|
11 | t.column 'role_id', :integer |
|
12 | end |
|
12 | end |
|
13 |
|
13 | ||
|
14 | add_index :rights_roles, :role_id |
|
14 | add_index :rights_roles, :role_id |
|
15 | end |
|
15 | end |
|
16 |
|
16 | ||
|
17 | def self.down |
|
17 | def self.down |
|
18 | drop_table :rights_roles |
|
18 | drop_table :rights_roles |
|
19 | drop_table :rights |
|
19 | drop_table :rights |
|
20 | end |
|
20 | end |
|
21 | end |
|
21 | end |
@@ -1,12 +1,12 | |||||
|
1 | - class CreateTasks < ActiveRecord::Migration |
|
1 | + class CreateTasks < ActiveRecord::Migration[4.2] |
|
2 | def self.up |
|
2 | def self.up |
|
3 | - create_table :tasks do |t| |
|
3 | + create_table :tasks, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t| |
|
4 | t.column 'submission_id', :integer |
|
4 | t.column 'submission_id', :integer |
|
5 | t.column 'created_at', :datetime |
|
5 | t.column 'created_at', :datetime |
|
6 | end |
|
6 | end |
|
7 | end |
|
7 | end |
|
8 |
|
8 | ||
|
9 | def self.down |
|
9 | def self.down |
|
10 | drop_table :tasks |
|
10 | drop_table :tasks |
|
11 | end |
|
11 | end |
|
12 | end |
|
12 | end |
@@ -1,16 +1,16 | |||||
|
1 | - class AddSessions < ActiveRecord::Migration |
|
1 | + class AddSessions < ActiveRecord::Migration[4.2] |
|
2 | def self.up |
|
2 | def self.up |
|
3 | - create_table :sessions do |t| |
|
3 | + create_table :sessions, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t| |
|
4 | t.column :session_id, :string |
|
4 | t.column :session_id, :string |
|
5 | t.column :data, :text |
|
5 | t.column :data, :text |
|
6 | t.column :updated_at, :datetime |
|
6 | t.column :updated_at, :datetime |
|
7 | end |
|
7 | end |
|
8 |
|
8 | ||
|
9 | add_index :sessions, :session_id |
|
9 | add_index :sessions, :session_id |
|
10 | add_index :sessions, :updated_at |
|
10 | add_index :sessions, :updated_at |
|
11 | end |
|
11 | end |
|
12 |
|
12 | ||
|
13 | def self.down |
|
13 | def self.down |
|
14 | drop_table :sessions |
|
14 | drop_table :sessions |
|
15 | end |
|
15 | end |
|
16 | end |
|
16 | end |
@@ -1,16 +1,16 | |||||
|
1 | - class AddLanguageExt < ActiveRecord::Migration |
|
1 | + class AddLanguageExt < ActiveRecord::Migration[4.2] |
|
2 | def self.up |
|
2 | def self.up |
|
3 | add_column :languages, :ext, :string, :limit => 10 |
|
3 | add_column :languages, :ext, :string, :limit => 10 |
|
4 |
|
4 | ||
|
5 | Language.reset_column_information |
|
5 | Language.reset_column_information |
|
6 | langs = Language.all |
|
6 | langs = Language.all |
|
7 | langs.each do |l| |
|
7 | langs.each do |l| |
|
8 | l.ext = l.name |
|
8 | l.ext = l.name |
|
9 | l.save |
|
9 | l.save |
|
10 | end |
|
10 | end |
|
11 | end |
|
11 | end |
|
12 |
|
12 | ||
|
13 | def self.down |
|
13 | def self.down |
|
14 | remove_column :languages, :ext |
|
14 | remove_column :languages, :ext |
|
15 | end |
|
15 | end |
|
16 | end |
|
16 | end |
@@ -1,9 +1,9 | |||||
|
1 | - class AddEmailToUsers < ActiveRecord::Migration |
|
1 | + class AddEmailToUsers < ActiveRecord::Migration[4.2] |
|
2 | def self.up |
|
2 | def self.up |
|
3 | add_column :users, :email, :string |
|
3 | add_column :users, :email, :string |
|
4 | end |
|
4 | end |
|
5 |
|
5 | ||
|
6 | def self.down |
|
6 | def self.down |
|
7 | remove_column :users, :email |
|
7 | remove_column :users, :email |
|
8 | end |
|
8 | end |
|
9 | end |
|
9 | end |
@@ -1,9 +1,9 | |||||
|
1 | - class AddUrlToProblem < ActiveRecord::Migration |
|
1 | + class AddUrlToProblem < ActiveRecord::Migration[4.2] |
|
2 | def self.up |
|
2 | def self.up |
|
3 | add_column :problems, :url, :string |
|
3 | add_column :problems, :url, :string |
|
4 | end |
|
4 | end |
|
5 |
|
5 | ||
|
6 | def self.down |
|
6 | def self.down |
|
7 | remove_column :problems, :url |
|
7 | remove_column :problems, :url |
|
8 | end |
|
8 | end |
|
9 | end |
|
9 | end |
@@ -1,16 +1,16 | |||||
|
1 | - class CreateGraderProcesses < ActiveRecord::Migration |
|
1 | + class CreateGraderProcesses < ActiveRecord::Migration[4.2] |
|
2 | def self.up |
|
2 | def self.up |
|
3 | - create_table :grader_processes do |t| |
|
3 | + create_table :grader_processes, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t| |
|
4 | t.column :ip, :string, :limit => 20 |
|
4 | t.column :ip, :string, :limit => 20 |
|
5 | t.column :pid, :integer |
|
5 | t.column :pid, :integer |
|
6 | t.column :mode, :string |
|
6 | t.column :mode, :string |
|
7 | t.column :active, :boolean |
|
7 | t.column :active, :boolean |
|
8 | t.timestamps |
|
8 | t.timestamps |
|
9 | end |
|
9 | end |
|
10 | add_index :grader_processes, ["ip","pid"] |
|
10 | add_index :grader_processes, ["ip","pid"] |
|
11 | end |
|
11 | end |
|
12 |
|
12 | ||
|
13 | def self.down |
|
13 | def self.down |
|
14 | drop_table :grader_processes |
|
14 | drop_table :grader_processes |
|
15 | end |
|
15 | end |
|
16 | end |
|
16 | end |
@@ -1,17 +1,17 | |||||
|
1 | - class AddStatusToTasks < ActiveRecord::Migration |
|
1 | + class AddStatusToTasks < ActiveRecord::Migration[4.2] |
|
2 | def self.up |
|
2 | def self.up |
|
3 | add_column :tasks, :status, :integer |
|
3 | add_column :tasks, :status, :integer |
|
4 | add_column :tasks, :updated_at, :datetime |
|
4 | add_column :tasks, :updated_at, :datetime |
|
5 |
|
5 | ||
|
6 | Task.reset_column_information |
|
6 | Task.reset_column_information |
|
7 | Task.all.each do |task| |
|
7 | Task.all.each do |task| |
|
8 | task.status_complete |
|
8 | task.status_complete |
|
9 | task.save |
|
9 | task.save |
|
10 | end |
|
10 | end |
|
11 | end |
|
11 | end |
|
12 |
|
12 | ||
|
13 | def self.down |
|
13 | def self.down |
|
14 | remove_column :tasks, :updated_at |
|
14 | remove_column :tasks, :updated_at |
|
15 | remove_column :tasks, :status |
|
15 | remove_column :tasks, :status |
|
16 | end |
|
16 | end |
|
17 | end |
|
17 | end |
@@ -1,9 +1,9 | |||||
|
1 | - class AddTaskToGraderProcess < ActiveRecord::Migration |
|
1 | + class AddTaskToGraderProcess < ActiveRecord::Migration[4.2] |
|
2 | def self.up |
|
2 | def self.up |
|
3 | add_column :grader_processes, :task_id, :integer |
|
3 | add_column :grader_processes, :task_id, :integer |
|
4 | end |
|
4 | end |
|
5 |
|
5 | ||
|
6 | def self.down |
|
6 | def self.down |
|
7 | remove_column :grader_processes, :task_id |
|
7 | remove_column :grader_processes, :task_id |
|
8 | end |
|
8 | end |
|
9 | end |
|
9 | end |
@@ -1,9 +1,9 | |||||
|
1 | - class RenameGraderProcessColumnIpToHost < ActiveRecord::Migration |
|
1 | + class RenameGraderProcessColumnIpToHost < ActiveRecord::Migration[4.2] |
|
2 | def self.up |
|
2 | def self.up |
|
3 | rename_column :grader_processes, :ip, :host |
|
3 | rename_column :grader_processes, :ip, :host |
|
4 | end |
|
4 | end |
|
5 |
|
5 | ||
|
6 | def self.down |
|
6 | def self.down |
|
7 | rename_column :grader_processes, :host, :ip |
|
7 | rename_column :grader_processes, :host, :ip |
|
8 | end |
|
8 | end |
|
9 | end |
|
9 | end |
@@ -1,32 +1,32 | |||||
|
1 | - class AddNumberToSubmissions < ActiveRecord::Migration |
|
1 | + class AddNumberToSubmissions < ActiveRecord::Migration[4.2] |
|
2 | def self.up |
|
2 | def self.up |
|
3 | add_column :submissions, :number, :integer |
|
3 | add_column :submissions, :number, :integer |
|
4 |
|
4 | ||
|
5 | # add number field for all records |
|
5 | # add number field for all records |
|
6 | Submission.reset_column_information |
|
6 | Submission.reset_column_information |
|
7 |
|
7 | ||
|
8 | last_user_id = nil |
|
8 | last_user_id = nil |
|
9 | last_problem_id = nil |
|
9 | last_problem_id = nil |
|
10 | current_number = 0 |
|
10 | current_number = 0 |
|
11 |
|
11 | ||
|
12 | Submission.order('user_id, problem_id, submitted_at').each do |submission| |
|
12 | Submission.order('user_id, problem_id, submitted_at').each do |submission| |
|
13 | if submission.user_id==last_user_id and submission.problem_id==last_problem_id |
|
13 | if submission.user_id==last_user_id and submission.problem_id==last_problem_id |
|
14 | current_number += 1 |
|
14 | current_number += 1 |
|
15 | else |
|
15 | else |
|
16 | current_number = 1 |
|
16 | current_number = 1 |
|
17 | end |
|
17 | end |
|
18 | submission.number = current_number |
|
18 | submission.number = current_number |
|
19 | submission.save |
|
19 | submission.save |
|
20 |
|
20 | ||
|
21 | last_user_id = submission.user_id |
|
21 | last_user_id = submission.user_id |
|
22 | last_problem_id = submission.problem_id |
|
22 | last_problem_id = submission.problem_id |
|
23 | end |
|
23 | end |
|
24 |
|
24 | ||
|
25 | add_index :submissions, [:user_id, :problem_id, :number], :unique => true |
|
25 | add_index :submissions, [:user_id, :problem_id, :number], :unique => true |
|
26 | end |
|
26 | end |
|
27 |
|
27 | ||
|
28 | def self.down |
|
28 | def self.down |
|
29 | remove_index :submissions, :column => [:user_id, :problem_id, :number] |
|
29 | remove_index :submissions, :column => [:user_id, :problem_id, :number] |
|
30 | remove_column :submissions, :number |
|
30 | remove_column :submissions, :number |
|
31 | end |
|
31 | end |
|
32 | end |
|
32 | end |
@@ -1,30 +1,29 | |||||
|
1 | - class CreateTestRequests < ActiveRecord::Migration |
|
1 | + class CreateTestRequests < ActiveRecord::Migration[4.2] |
|
2 | def self.up |
|
2 | def self.up |
|
3 | - create_table :test_requests do |t| |
|
3 | + create_table :test_requests, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t| |
|
4 | t.column :user_id, :integer |
|
4 | t.column :user_id, :integer |
|
5 | t.column :problem_id, :integer |
|
5 | t.column :problem_id, :integer |
|
6 | t.column :submission_id, :integer |
|
6 | t.column :submission_id, :integer |
|
7 | t.column :input_file_name, :string |
|
7 | t.column :input_file_name, :string |
|
8 | t.column :output_file_name, :string |
|
8 | t.column :output_file_name, :string |
|
9 | t.column :running_stat, :string |
|
9 | t.column :running_stat, :string |
|
10 |
|
10 | ||
|
11 | # these are similar to tasks |
|
11 | # these are similar to tasks |
|
12 | t.column :status, :integer |
|
12 | t.column :status, :integer |
|
13 | - t.column :updated_at, :datetime |
|
||
|
14 |
|
13 | ||
|
15 | # these are intentionally similar to submissions |
|
14 | # these are intentionally similar to submissions |
|
16 | t.column :submitted_at, :datetime |
|
15 | t.column :submitted_at, :datetime |
|
17 | t.column :compiled_at, :datetime |
|
16 | t.column :compiled_at, :datetime |
|
18 | t.column :compiler_message, :string |
|
17 | t.column :compiler_message, :string |
|
19 | t.column :graded_at, :datetime |
|
18 | t.column :graded_at, :datetime |
|
20 | t.column :grader_comment, :string |
|
19 | t.column :grader_comment, :string |
|
21 | t.timestamps |
|
20 | t.timestamps |
|
22 | end |
|
21 | end |
|
23 | add_index :test_requests, [:user_id, :problem_id] |
|
22 | add_index :test_requests, [:user_id, :problem_id] |
|
24 | end |
|
23 | end |
|
25 |
|
24 | ||
|
26 | def self.down |
|
25 | def self.down |
|
27 | remove_index :test_requests, :column => [:user_id, :problem_id] |
|
26 | remove_index :test_requests, :column => [:user_id, :problem_id] |
|
28 | drop_table :test_requests |
|
27 | drop_table :test_requests |
|
29 | end |
|
28 | end |
|
30 | end |
|
29 | end |
@@ -1,9 +1,9 | |||||
|
1 | - class ChangeCompilerMessageTypeTestRequest < ActiveRecord::Migration |
|
1 | + class ChangeCompilerMessageTypeTestRequest < ActiveRecord::Migration[4.2] |
|
2 | def self.up |
|
2 | def self.up |
|
3 | change_column :test_requests, :compiler_message, :text |
|
3 | change_column :test_requests, :compiler_message, :text |
|
4 | end |
|
4 | end |
|
5 |
|
5 | ||
|
6 | def self.down |
|
6 | def self.down |
|
7 | change_column :test_requests, :compiler_message, :string |
|
7 | change_column :test_requests, :compiler_message, :string |
|
8 | end |
|
8 | end |
|
9 | end |
|
9 | end |
@@ -1,14 +1,14 | |||||
|
1 | - class CreateConfigurations < ActiveRecord::Migration |
|
1 | + class CreateConfigurations < ActiveRecord::Migration[4.2] |
|
2 | def self.up |
|
2 | def self.up |
|
3 | - create_table :configurations do |t| |
|
3 | + create_table :configurations, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t| |
|
4 | t.column :key, :string |
|
4 | t.column :key, :string |
|
5 | t.column :value_type, :string |
|
5 | t.column :value_type, :string |
|
6 | t.column :value, :string |
|
6 | t.column :value, :string |
|
7 | t.timestamps |
|
7 | t.timestamps |
|
8 | end |
|
8 | end |
|
9 | end |
|
9 | end |
|
10 |
|
10 | ||
|
11 | def self.down |
|
11 | def self.down |
|
12 | drop_table :configurations |
|
12 | drop_table :configurations |
|
13 | end |
|
13 | end |
|
14 | end |
|
14 | end |
@@ -1,13 +1,13 | |||||
|
1 | - class AddRunstatColumnsToTestRequest < ActiveRecord::Migration |
|
1 | + class AddRunstatColumnsToTestRequest < ActiveRecord::Migration[4.2] |
|
2 | def self.up |
|
2 | def self.up |
|
3 | add_column :test_requests, :running_time, :float |
|
3 | add_column :test_requests, :running_time, :float |
|
4 | add_column :test_requests, :exit_status, :string |
|
4 | add_column :test_requests, :exit_status, :string |
|
5 | add_column :test_requests, :memory_usage, :integer |
|
5 | add_column :test_requests, :memory_usage, :integer |
|
6 | end |
|
6 | end |
|
7 |
|
7 | ||
|
8 | def self.down |
|
8 | def self.down |
|
9 | remove_column :test_requests, :running_time |
|
9 | remove_column :test_requests, :running_time |
|
10 | remove_column :test_requests, :exit_status |
|
10 | remove_column :test_requests, :exit_status |
|
11 | remove_column :test_requests, :memory_usage |
|
11 | remove_column :test_requests, :memory_usage |
|
12 | end |
|
12 | end |
|
13 | end |
|
13 | end |
@@ -1,15 +1,15 | |||||
|
1 | - class CreateSites < ActiveRecord::Migration |
|
1 | + class CreateSites < ActiveRecord::Migration[4.2] |
|
2 | def self.up |
|
2 | def self.up |
|
3 | - create_table :sites do |t| |
|
3 | + create_table :sites, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t| |
|
4 | t.string :name |
|
4 | t.string :name |
|
5 | t.boolean :started |
|
5 | t.boolean :started |
|
6 | t.datetime :start_time |
|
6 | t.datetime :start_time |
|
7 |
|
7 | ||
|
8 | t.timestamps |
|
8 | t.timestamps |
|
9 | end |
|
9 | end |
|
10 | end |
|
10 | end |
|
11 |
|
11 | ||
|
12 | def self.down |
|
12 | def self.down |
|
13 | drop_table :sites |
|
13 | drop_table :sites |
|
14 | end |
|
14 | end |
|
15 | end |
|
15 | end |
@@ -1,29 +1,29 | |||||
|
1 | - class AddSiteToUserAndAddDefaultSite < ActiveRecord::Migration |
|
1 | + class AddSiteToUserAndAddDefaultSite < ActiveRecord::Migration[4.2] |
|
2 | def self.up |
|
2 | def self.up |
|
3 | default_site = Site.new({:name => 'default', |
|
3 | default_site = Site.new({:name => 'default', |
|
4 | :started => false}) |
|
4 | :started => false}) |
|
5 | default_site.save! |
|
5 | default_site.save! |
|
6 |
|
6 | ||
|
7 | add_column :users, :site_id, :integer |
|
7 | add_column :users, :site_id, :integer |
|
8 | User.reset_column_information |
|
8 | User.reset_column_information |
|
9 |
|
9 | ||
|
10 | User.all.each do |user| |
|
10 | User.all.each do |user| |
|
11 |
|
11 | ||
|
12 | class << user |
|
12 | class << user |
|
13 | def valid? |
|
13 | def valid? |
|
14 | true |
|
14 | true |
|
15 | end |
|
15 | end |
|
16 | end |
|
16 | end |
|
17 |
|
17 | ||
|
18 | user.site_id = default_site.id |
|
18 | user.site_id = default_site.id |
|
19 | user.save |
|
19 | user.save |
|
20 | end |
|
20 | end |
|
21 | end |
|
21 | end |
|
22 |
|
22 | ||
|
23 | def self.down |
|
23 | def self.down |
|
24 | remove_column :users, :site_id |
|
24 | remove_column :users, :site_id |
|
25 |
|
25 | ||
|
26 | default_site = Site.find_by_name('default') |
|
26 | default_site = Site.find_by_name('default') |
|
27 | default_site.destroy if default_site |
|
27 | default_site.destroy if default_site |
|
28 | end |
|
28 | end |
|
29 | end |
|
29 | end |
@@ -1,9 +1,9 | |||||
|
1 | - class AddBodyToProblems < ActiveRecord::Migration |
|
1 | + class AddBodyToProblems < ActiveRecord::Migration[4.2] |
|
2 | def self.up |
|
2 | def self.up |
|
3 | add_column :problems, :body, :text |
|
3 | add_column :problems, :body, :text |
|
4 | end |
|
4 | end |
|
5 |
|
5 | ||
|
6 | def self.down |
|
6 | def self.down |
|
7 | remove_column :problems, :body |
|
7 | remove_column :problems, :body |
|
8 | end |
|
8 | end |
|
9 | end |
|
9 | end |
@@ -1,13 +1,13 | |||||
|
1 | - class CreateDescriptions < ActiveRecord::Migration |
|
1 | + class CreateDescriptions < ActiveRecord::Migration[4.2] |
|
2 | def self.up |
|
2 | def self.up |
|
3 | - create_table :descriptions do |t| |
|
3 | + create_table :descriptions, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t| |
|
4 | t.column :body, :text |
|
4 | t.column :body, :text |
|
5 | t.column :markdowned, :boolean |
|
5 | t.column :markdowned, :boolean |
|
6 | t.timestamps |
|
6 | t.timestamps |
|
7 | end |
|
7 | end |
|
8 | end |
|
8 | end |
|
9 |
|
9 | ||
|
10 | def self.down |
|
10 | def self.down |
|
11 | drop_table :descriptions |
|
11 | drop_table :descriptions |
|
12 | end |
|
12 | end |
|
13 | end |
|
13 | end |
@@ -1,33 +1,33 | |||||
|
1 | - class RefactorProblemBodyToDescription < ActiveRecord::Migration |
|
1 | + class RefactorProblemBodyToDescription < ActiveRecord::Migration[4.2] |
|
2 | def self.up |
|
2 | def self.up |
|
3 | add_column :problems, :description_id, :integer |
|
3 | add_column :problems, :description_id, :integer |
|
4 | Problem.reset_column_information |
|
4 | Problem.reset_column_information |
|
5 |
|
5 | ||
|
6 | Problem.all.each do |problem| |
|
6 | Problem.all.each do |problem| |
|
7 | if problem.body!=nil |
|
7 | if problem.body!=nil |
|
8 | description = Description.new |
|
8 | description = Description.new |
|
9 | description.body = problem.body |
|
9 | description.body = problem.body |
|
10 | description.markdowned = false |
|
10 | description.markdowned = false |
|
11 | description.save |
|
11 | description.save |
|
12 | problem.description_id = description.id |
|
12 | problem.description_id = description.id |
|
13 | problem.save |
|
13 | problem.save |
|
14 | end |
|
14 | end |
|
15 | end |
|
15 | end |
|
16 |
|
16 | ||
|
17 | remove_column :problems, :body |
|
17 | remove_column :problems, :body |
|
18 | end |
|
18 | end |
|
19 |
|
19 | ||
|
20 | def self.down |
|
20 | def self.down |
|
21 | add_column :problems, :body, :text |
|
21 | add_column :problems, :body, :text |
|
22 | Problem.reset_column_information |
|
22 | Problem.reset_column_information |
|
23 |
|
23 | ||
|
24 | Problem.all.each do |problem| |
|
24 | Problem.all.each do |problem| |
|
25 | if problem.description_id != nil |
|
25 | if problem.description_id != nil |
|
26 | problem.body = Description.find(problem.description_id).body |
|
26 | problem.body = Description.find(problem.description_id).body |
|
27 | problem.save |
|
27 | problem.save |
|
28 | end |
|
28 | end |
|
29 | end |
|
29 | end |
|
30 |
|
30 | ||
|
31 | remove_column :problems, :description_id |
|
31 | remove_column :problems, :description_id |
|
32 | end |
|
32 | end |
|
33 | end |
|
33 | end |
@@ -1,15 +1,15 | |||||
|
1 | - class AddTestAllowedToProblems < ActiveRecord::Migration |
|
1 | + class AddTestAllowedToProblems < ActiveRecord::Migration[4.2] |
|
2 | def self.up |
|
2 | def self.up |
|
3 | add_column :problems, :test_allowed, :boolean |
|
3 | add_column :problems, :test_allowed, :boolean |
|
4 | Problem.reset_column_information |
|
4 | Problem.reset_column_information |
|
5 |
|
5 | ||
|
6 | Problem.all.each do |problem| |
|
6 | Problem.all.each do |problem| |
|
7 | problem.test_allowed = true |
|
7 | problem.test_allowed = true |
|
8 | problem.save |
|
8 | problem.save |
|
9 | end |
|
9 | end |
|
10 | end |
|
10 | end |
|
11 |
|
11 | ||
|
12 | def self.down |
|
12 | def self.down |
|
13 | remove_column :problems, :test_allowed |
|
13 | remove_column :problems, :test_allowed |
|
14 | end |
|
14 | end |
|
15 | end |
|
15 | end |
@@ -1,15 +1,15 | |||||
|
1 | - class CreateAnnouncements < ActiveRecord::Migration |
|
1 | + class CreateAnnouncements < ActiveRecord::Migration[4.2] |
|
2 | def self.up |
|
2 | def self.up |
|
3 | - create_table :announcements do |t| |
|
3 | + create_table :announcements, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t| |
|
4 | t.string :author |
|
4 | t.string :author |
|
5 | t.text :body |
|
5 | t.text :body |
|
6 | t.boolean :published |
|
6 | t.boolean :published |
|
7 |
|
7 | ||
|
8 | t.timestamps |
|
8 | t.timestamps |
|
9 | end |
|
9 | end |
|
10 | end |
|
10 | end |
|
11 |
|
11 | ||
|
12 | def self.down |
|
12 | def self.down |
|
13 | drop_table :announcements |
|
13 | drop_table :announcements |
|
14 | end |
|
14 | end |
|
15 | end |
|
15 | end |
@@ -1,11 +1,11 | |||||
|
1 | - class AddSupportsForOutputOnlyProblems < ActiveRecord::Migration |
|
1 | + class AddSupportsForOutputOnlyProblems < ActiveRecord::Migration[4.2] |
|
2 | def self.up |
|
2 | def self.up |
|
3 | add_column :submissions, :source_filename, :string |
|
3 | add_column :submissions, :source_filename, :string |
|
4 | add_column :problems, :output_only, :boolean |
|
4 | add_column :problems, :output_only, :boolean |
|
5 | end |
|
5 | end |
|
6 |
|
6 | ||
|
7 | def self.down |
|
7 | def self.down |
|
8 | remove_column :submissions, :source_filename |
|
8 | remove_column :submissions, :source_filename |
|
9 | remove_column :problems, :output_only |
|
9 | remove_column :problems, :output_only |
|
10 | end |
|
10 | end |
|
11 | end |
|
11 | end |
@@ -1,17 +1,17 | |||||
|
1 | - class CreateMessages < ActiveRecord::Migration |
|
1 | + class CreateMessages < ActiveRecord::Migration[4.2] |
|
2 | def self.up |
|
2 | def self.up |
|
3 | - create_table :messages do |t| |
|
3 | + create_table :messages, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t| |
|
4 | t.column "sender_id", :integer |
|
4 | t.column "sender_id", :integer |
|
5 | t.column "receiver_id", :integer |
|
5 | t.column "receiver_id", :integer |
|
6 | t.column "replying_message_id", :integer |
|
6 | t.column "replying_message_id", :integer |
|
7 | t.column "body", :text |
|
7 | t.column "body", :text |
|
8 | t.column "replied", :boolean # this is for efficiency |
|
8 | t.column "replied", :boolean # this is for efficiency |
|
9 |
|
9 | ||
|
10 | t.timestamps |
|
10 | t.timestamps |
|
11 | end |
|
11 | end |
|
12 | end |
|
12 | end |
|
13 |
|
13 | ||
|
14 | def self.down |
|
14 | def self.down |
|
15 | drop_table :messages |
|
15 | drop_table :messages |
|
16 | end |
|
16 | end |
|
17 | end |
|
17 | end |
@@ -1,9 +1,9 | |||||
|
1 | - class AddTaskTypeToGraderProcesses < ActiveRecord::Migration |
|
1 | + class AddTaskTypeToGraderProcesses < ActiveRecord::Migration[4.2] |
|
2 | def self.up |
|
2 | def self.up |
|
3 | add_column 'grader_processes', 'task_type', :string |
|
3 | add_column 'grader_processes', 'task_type', :string |
|
4 | end |
|
4 | end |
|
5 |
|
5 | ||
|
6 | def self.down |
|
6 | def self.down |
|
7 | remove_column 'grader_processes', 'task_type' |
|
7 | remove_column 'grader_processes', 'task_type' |
|
8 | end |
|
8 | end |
|
9 | end |
|
9 | end |
@@ -1,12 +1,12 | |||||
|
1 | - class CreateCountries < ActiveRecord::Migration |
|
1 | + class CreateCountries < ActiveRecord::Migration[4.2] |
|
2 | def self.up |
|
2 | def self.up |
|
3 | - create_table :countries do |t| |
|
3 | + create_table :countries, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t| |
|
4 | t.column :name, :string |
|
4 | t.column :name, :string |
|
5 | t.timestamps |
|
5 | t.timestamps |
|
6 | end |
|
6 | end |
|
7 | end |
|
7 | end |
|
8 |
|
8 | ||
|
9 | def self.down |
|
9 | def self.down |
|
10 | drop_table :countries |
|
10 | drop_table :countries |
|
11 | end |
|
11 | end |
|
12 | end |
|
12 | end |
@@ -1,15 +1,15 | |||||
|
1 | - class AddCountryToSitesAndUsers < ActiveRecord::Migration |
|
1 | + class AddCountryToSitesAndUsers < ActiveRecord::Migration[4.2] |
|
2 | def self.up |
|
2 | def self.up |
|
3 | add_column 'sites', 'country_id', :integer |
|
3 | add_column 'sites', 'country_id', :integer |
|
4 | add_column 'sites', 'password', :string |
|
4 | add_column 'sites', 'password', :string |
|
5 |
|
5 | ||
|
6 | add_column 'users', 'country_id', :integer |
|
6 | add_column 'users', 'country_id', :integer |
|
7 | end |
|
7 | end |
|
8 |
|
8 | ||
|
9 | def self.down |
|
9 | def self.down |
|
10 | remove_column 'users', 'country_id' |
|
10 | remove_column 'users', 'country_id' |
|
11 |
|
11 | ||
|
12 | remove_column 'sites', 'country_id' |
|
12 | remove_column 'sites', 'country_id' |
|
13 | remove_column 'sites', 'password' |
|
13 | remove_column 'sites', 'password' |
|
14 | end |
|
14 | end |
|
15 | end |
|
15 | end |
@@ -1,9 +1,9 | |||||
|
1 | - class AddFrontpageFlagToAnnouncement < ActiveRecord::Migration |
|
1 | + class AddFrontpageFlagToAnnouncement < ActiveRecord::Migration[4.2] |
|
2 | def self.up |
|
2 | def self.up |
|
3 | add_column :announcements, "frontpage", :boolean, :default => 0 |
|
3 | add_column :announcements, "frontpage", :boolean, :default => 0 |
|
4 | end |
|
4 | end |
|
5 |
|
5 | ||
|
6 | def self.down |
|
6 | def self.down |
|
7 | remove_column :announcements, "frontpage" |
|
7 | remove_column :announcements, "frontpage" |
|
8 | end |
|
8 | end |
|
9 | end |
|
9 | end |
@@ -1,25 +1,25 | |||||
|
1 | - class AddActivatedToUsers < ActiveRecord::Migration |
|
1 | + class AddActivatedToUsers < ActiveRecord::Migration[4.2] |
|
2 | def self.up |
|
2 | def self.up |
|
3 | add_column :users, :activated, :boolean, :default => 0 |
|
3 | add_column :users, :activated, :boolean, :default => 0 |
|
4 |
|
4 | ||
|
5 | User.reset_column_information |
|
5 | User.reset_column_information |
|
6 |
|
6 | ||
|
7 | User.all.each do |user| |
|
7 | User.all.each do |user| |
|
8 |
|
8 | ||
|
9 | # disable validation |
|
9 | # disable validation |
|
10 | class <<user |
|
10 | class <<user |
|
11 | def valid? |
|
11 | def valid? |
|
12 | return true |
|
12 | return true |
|
13 | end |
|
13 | end |
|
14 | end |
|
14 | end |
|
15 |
|
15 | ||
|
16 | user.activated = true |
|
16 | user.activated = true |
|
17 | user.save |
|
17 | user.save |
|
18 | end |
|
18 | end |
|
19 | end |
|
19 | end |
|
20 |
|
20 | ||
|
21 |
|
21 | ||
|
22 | def self.down |
|
22 | def self.down |
|
23 | remove_column :users, :activated |
|
23 | remove_column :users, :activated |
|
24 | end |
|
24 | end |
|
25 | end |
|
25 | end |
@@ -1,9 +1,9 | |||||
|
1 | - class AddTimestampsToUsers < ActiveRecord::Migration |
|
1 | + class AddTimestampsToUsers < ActiveRecord::Migration[4.2] |
|
2 | def self.up |
|
2 | def self.up |
|
3 | add_timestamps :users |
|
3 | add_timestamps :users |
|
4 | end |
|
4 | end |
|
5 |
|
5 | ||
|
6 | def self.down |
|
6 | def self.down |
|
7 | remove_timestamps :users |
|
7 | remove_timestamps :users |
|
8 | end |
|
8 | end |
|
9 | end |
|
9 | end |
@@ -1,9 +1,9 | |||||
|
1 | - class ChangeUserLoginStringLimit < ActiveRecord::Migration |
|
1 | + class ChangeUserLoginStringLimit < ActiveRecord::Migration[4.2] |
|
2 | def self.up |
|
2 | def self.up |
|
3 | execute "ALTER TABLE `users` CHANGE `login` `login` VARCHAR( 50 )" |
|
3 | execute "ALTER TABLE `users` CHANGE `login` `login` VARCHAR( 50 )" |
|
4 | end |
|
4 | end |
|
5 |
|
5 | ||
|
6 | def self.down |
|
6 | def self.down |
|
7 | # don't have to revert |
|
7 | # don't have to revert |
|
8 | end |
|
8 | end |
|
9 | end |
|
9 | end |
@@ -1,9 +1,9 | |||||
|
1 | - class AddContestFlagToAnnouncements < ActiveRecord::Migration |
|
1 | + class AddContestFlagToAnnouncements < ActiveRecord::Migration[4.2] |
|
2 | def self.up |
|
2 | def self.up |
|
3 | add_column :announcements, :contest_only, :boolean, :default => false |
|
3 | add_column :announcements, :contest_only, :boolean, :default => false |
|
4 | end |
|
4 | end |
|
5 |
|
5 | ||
|
6 | def self.down |
|
6 | def self.down |
|
7 | remove_column :announcements, :contest_only |
|
7 | remove_column :announcements, :contest_only |
|
8 | end |
|
8 | end |
|
9 | end |
|
9 | end |
@@ -1,23 +1,23 | |||||
|
1 | - class AddCommonExtToLanguages < ActiveRecord::Migration |
|
1 | + class AddCommonExtToLanguages < ActiveRecord::Migration[4.2] |
|
2 | def self.up |
|
2 | def self.up |
|
3 | # language.common_ext is a comma-separated list of common file |
|
3 | # language.common_ext is a comma-separated list of common file |
|
4 | # extensions. |
|
4 | # extensions. |
|
5 | add_column :languages, :common_ext, :string |
|
5 | add_column :languages, :common_ext, :string |
|
6 |
|
6 | ||
|
7 | # updating table information |
|
7 | # updating table information |
|
8 | Language.reset_column_information |
|
8 | Language.reset_column_information |
|
9 | common_ext = { |
|
9 | common_ext = { |
|
10 | 'c' => 'c', |
|
10 | 'c' => 'c', |
|
11 | 'cpp' => 'cpp,cc', |
|
11 | 'cpp' => 'cpp,cc', |
|
12 | 'pas' => 'pas' |
|
12 | 'pas' => 'pas' |
|
13 | } |
|
13 | } |
|
14 | Language.all.each do |lang| |
|
14 | Language.all.each do |lang| |
|
15 | lang.common_ext = common_ext[lang.name] |
|
15 | lang.common_ext = common_ext[lang.name] |
|
16 | lang.save |
|
16 | lang.save |
|
17 | end |
|
17 | end |
|
18 | end |
|
18 | end |
|
19 |
|
19 | ||
|
20 | def self.down |
|
20 | def self.down |
|
21 | remove_column :languages, :common_ext |
|
21 | remove_column :languages, :common_ext |
|
22 | end |
|
22 | end |
|
23 | end |
|
23 | end |
@@ -1,9 +1,9 | |||||
|
1 | - class AddTerminatedToGraderProcesses < ActiveRecord::Migration |
|
1 | + class AddTerminatedToGraderProcesses < ActiveRecord::Migration[4.2] |
|
2 | def self.up |
|
2 | def self.up |
|
3 | add_column :grader_processes, :terminated, :boolean |
|
3 | add_column :grader_processes, :terminated, :boolean |
|
4 | end |
|
4 | end |
|
5 |
|
5 | ||
|
6 | def self.down |
|
6 | def self.down |
|
7 | remove_column :grader_processes, :terminated |
|
7 | remove_column :grader_processes, :terminated |
|
8 | end |
|
8 | end |
|
9 | end |
|
9 | end |
@@ -1,9 +1,9 | |||||
|
1 | - class AddTitleToAnnouncements < ActiveRecord::Migration |
|
1 | + class AddTitleToAnnouncements < ActiveRecord::Migration[4.2] |
|
2 | def self.up |
|
2 | def self.up |
|
3 | add_column :announcements, :title, :string |
|
3 | add_column :announcements, :title, :string |
|
4 | end |
|
4 | end |
|
5 |
|
5 | ||
|
6 | def self.down |
|
6 | def self.down |
|
7 | remove_column :announcements, :title |
|
7 | remove_column :announcements, :title |
|
8 | end |
|
8 | end |
|
9 | end |
|
9 | end |
@@ -1,15 +1,15 | |||||
|
1 | - class CreateTestPairs < ActiveRecord::Migration |
|
1 | + class CreateTestPairs < ActiveRecord::Migration[4.2] |
|
2 | def self.up |
|
2 | def self.up |
|
3 | - create_table :test_pairs do |t| |
|
3 | + create_table :test_pairs, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t| |
|
4 | t.integer :problem_id |
|
4 | t.integer :problem_id |
|
5 | t.text :input |
|
5 | t.text :input |
|
6 | t.text :solution |
|
6 | t.text :solution |
|
7 |
|
7 | ||
|
8 | t.timestamps |
|
8 | t.timestamps |
|
9 | end |
|
9 | end |
|
10 | end |
|
10 | end |
|
11 |
|
11 | ||
|
12 | def self.down |
|
12 | def self.down |
|
13 | drop_table :test_pairs |
|
13 | drop_table :test_pairs |
|
14 | end |
|
14 | end |
|
15 | end |
|
15 | end |
@@ -1,9 +1,9 | |||||
|
1 | - class AddDescriptionToConfig < ActiveRecord::Migration |
|
1 | + class AddDescriptionToConfig < ActiveRecord::Migration[4.2] |
|
2 | def self.up |
|
2 | def self.up |
|
3 | add_column :configurations, :description, :text |
|
3 | add_column :configurations, :description, :text |
|
4 | end |
|
4 | end |
|
5 |
|
5 | ||
|
6 | def self.down |
|
6 | def self.down |
|
7 | remove_column :configurations, :description |
|
7 | remove_column :configurations, :description |
|
8 | end |
|
8 | end |
|
9 | end |
|
9 | end |
@@ -1,14 +1,14 | |||||
|
1 | - class CreateUserContestStats < ActiveRecord::Migration |
|
1 | + class CreateUserContestStats < ActiveRecord::Migration[4.2] |
|
2 | def self.up |
|
2 | def self.up |
|
3 | - create_table :user_contest_stats do |t| |
|
3 | + create_table :user_contest_stats, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t| |
|
4 | t.integer :user_id |
|
4 | t.integer :user_id |
|
5 | t.timestamp :started_at |
|
5 | t.timestamp :started_at |
|
6 |
|
6 | ||
|
7 | t.timestamps |
|
7 | t.timestamps |
|
8 | end |
|
8 | end |
|
9 | end |
|
9 | end |
|
10 |
|
10 | ||
|
11 | def self.down |
|
11 | def self.down |
|
12 | drop_table :user_contest_stats |
|
12 | drop_table :user_contest_stats |
|
13 | end |
|
13 | end |
|
14 | end |
|
14 | end |
@@ -1,11 +1,11 | |||||
|
1 | - class ChangeInputSolutionFieldLimitInTestPair < ActiveRecord::Migration |
|
1 | + class ChangeInputSolutionFieldLimitInTestPair < ActiveRecord::Migration[4.2] |
|
2 | def self.up |
|
2 | def self.up |
|
3 | change_column :test_pairs, :input, :text, :limit => 1.megabytes |
|
3 | change_column :test_pairs, :input, :text, :limit => 1.megabytes |
|
4 | change_column :test_pairs, :solution, :text, :limit => 1.megabytes |
|
4 | change_column :test_pairs, :solution, :text, :limit => 1.megabytes |
|
5 | end |
|
5 | end |
|
6 |
|
6 | ||
|
7 | def self.down |
|
7 | def self.down |
|
8 | change_column :test_pairs, :input, :text |
|
8 | change_column :test_pairs, :input, :text |
|
9 | change_column :test_pairs, :solution, :text |
|
9 | change_column :test_pairs, :solution, :text |
|
10 | end |
|
10 | end |
|
11 | end |
|
11 | end |
@@ -1,14 +1,14 | |||||
|
1 | - class CreateContests < ActiveRecord::Migration |
|
1 | + class CreateContests < ActiveRecord::Migration[4.2] |
|
2 | def self.up |
|
2 | def self.up |
|
3 | - create_table :contests do |t| |
|
3 | + create_table :contests, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t| |
|
4 | t.string :title |
|
4 | t.string :title |
|
5 | t.boolean :enabled |
|
5 | t.boolean :enabled |
|
6 |
|
6 | ||
|
7 | t.timestamps |
|
7 | t.timestamps |
|
8 | end |
|
8 | end |
|
9 | end |
|
9 | end |
|
10 |
|
10 | ||
|
11 | def self.down |
|
11 | def self.down |
|
12 | drop_table :contests |
|
12 | drop_table :contests |
|
13 | end |
|
13 | end |
|
14 | end |
|
14 | end |
@@ -1,12 +1,12 | |||||
|
1 | - class CreateContestsUsersJoinTable < ActiveRecord::Migration |
|
1 | + class CreateContestsUsersJoinTable < ActiveRecord::Migration[4.2] |
|
2 | def self.up |
|
2 | def self.up |
|
3 | - create_table :contests_users, :id => false do |t| |
|
3 | + create_table :contests_users, :id => false, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t| |
|
4 | t.integer :contest_id |
|
4 | t.integer :contest_id |
|
5 | t.integer :user_id |
|
5 | t.integer :user_id |
|
6 | end |
|
6 | end |
|
7 | end |
|
7 | end |
|
8 |
|
8 | ||
|
9 | def self.down |
|
9 | def self.down |
|
10 | drop_table :contests_users |
|
10 | drop_table :contests_users |
|
11 | end |
|
11 | end |
|
12 | end |
|
12 | end |
@@ -1,12 +1,12 | |||||
|
1 | - class CreateContestsProblemsJoinTable < ActiveRecord::Migration |
|
1 | + class CreateContestsProblemsJoinTable < ActiveRecord::Migration[4.2] |
|
2 | def self.up |
|
2 | def self.up |
|
3 | - create_table :contests_problems, :id => false do |t| |
|
3 | + create_table :contests_problems, :id => false, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t| |
|
4 | t.integer :contest_id |
|
4 | t.integer :contest_id |
|
5 | t.integer :problem_id |
|
5 | t.integer :problem_id |
|
6 | end |
|
6 | end |
|
7 | end |
|
7 | end |
|
8 |
|
8 | ||
|
9 | def self.down |
|
9 | def self.down |
|
10 | drop_table :contests_problems |
|
10 | drop_table :contests_problems |
|
11 | end |
|
11 | end |
|
12 | end |
|
12 | end |
@@ -1,9 +1,9 | |||||
|
1 | - class AddDescriptionFilenameToProblems < ActiveRecord::Migration |
|
1 | + class AddDescriptionFilenameToProblems < ActiveRecord::Migration[4.2] |
|
2 | def self.up |
|
2 | def self.up |
|
3 | add_column :problems, :description_filename, :string |
|
3 | add_column :problems, :description_filename, :string |
|
4 | end |
|
4 | end |
|
5 |
|
5 | ||
|
6 | def self.down |
|
6 | def self.down |
|
7 | remove_column :problems, :description_filename |
|
7 | remove_column :problems, :description_filename |
|
8 | end |
|
8 | end |
|
9 | end |
|
9 | end |
@@ -1,9 +1,9 | |||||
|
1 | - class AddNameToContests < ActiveRecord::Migration |
|
1 | + class AddNameToContests < ActiveRecord::Migration[4.2] |
|
2 | def self.up |
|
2 | def self.up |
|
3 | add_column :contests, :name, :string |
|
3 | add_column :contests, :name, :string |
|
4 | end |
|
4 | end |
|
5 |
|
5 | ||
|
6 | def self.down |
|
6 | def self.down |
|
7 | remove_column :contests, :name |
|
7 | remove_column :contests, :name |
|
8 | end |
|
8 | end |
|
9 | end |
|
9 | end |
@@ -1,9 +1,9 | |||||
|
1 | - class AddForcedLogoutToUserContestStat < ActiveRecord::Migration |
|
1 | + class AddForcedLogoutToUserContestStat < ActiveRecord::Migration[4.2] |
|
2 | def self.up |
|
2 | def self.up |
|
3 | add_column :user_contest_stats, :forced_logout, :boolean |
|
3 | add_column :user_contest_stats, :forced_logout, :boolean |
|
4 | end |
|
4 | end |
|
5 |
|
5 | ||
|
6 | def self.down |
|
6 | def self.down |
|
7 | remove_column :user_contest_stats, :forced_logout, :boolean |
|
7 | remove_column :user_contest_stats, :forced_logout, :boolean |
|
8 | end |
|
8 | end |
|
9 | end |
|
9 | end |
@@ -1,9 +1,9 | |||||
|
1 | - class AddNotesToAnnouncements < ActiveRecord::Migration |
|
1 | + class AddNotesToAnnouncements < ActiveRecord::Migration[4.2] |
|
2 | def self.up |
|
2 | def self.up |
|
3 | add_column :announcements, :notes, :string |
|
3 | add_column :announcements, :notes, :string |
|
4 | end |
|
4 | end |
|
5 |
|
5 | ||
|
6 | def self.down |
|
6 | def self.down |
|
7 | remove_column :announcements, :notes |
|
7 | remove_column :announcements, :notes |
|
8 | end |
|
8 | end |
|
9 | end |
|
9 | end |
@@ -1,5 +1,5 | |||||
|
1 | - class RenameConfigurationsToGraderConfigurations < ActiveRecord::Migration |
|
1 | + class RenameConfigurationsToGraderConfigurations < ActiveRecord::Migration[4.2] |
|
2 | def change |
|
2 | def change |
|
3 | rename_table 'configurations', 'grader_configurations' |
|
3 | rename_table 'configurations', 'grader_configurations' |
|
4 | end |
|
4 | end |
|
5 | end |
|
5 | end |
@@ -1,7 +1,7 | |||||
|
1 | - class AddMoreDetailToSubmission < ActiveRecord::Migration |
|
1 | + class AddMoreDetailToSubmission < ActiveRecord::Migration[4.2] |
|
2 | def change |
|
2 | def change |
|
3 | add_column :submissions, :max_runtime, :float |
|
3 | add_column :submissions, :max_runtime, :float |
|
4 | add_column :submissions, :peak_memory, :integer |
|
4 | add_column :submissions, :peak_memory, :integer |
|
5 | add_column :submissions, :effective_code_length, :integer |
|
5 | add_column :submissions, :effective_code_length, :integer |
|
6 | end |
|
6 | end |
|
7 | end |
|
7 | end |
@@ -1,10 +1,10 | |||||
|
1 | - class CreateLogins < ActiveRecord::Migration |
|
1 | + class CreateLogins < ActiveRecord::Migration[4.2] |
|
2 | def change |
|
2 | def change |
|
3 | - create_table :logins do |t| |
|
3 | + create_table :logins, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t| |
|
4 | t.string :user_id |
|
4 | t.string :user_id |
|
5 | t.string :ip_address |
|
5 | t.string :ip_address |
|
6 |
|
6 | ||
|
7 | t.timestamps |
|
7 | t.timestamps |
|
8 | end |
|
8 | end |
|
9 | end |
|
9 | end |
|
10 | end |
|
10 | end |
@@ -1,5 +1,5 | |||||
|
1 | - class AddSectionToUsers < ActiveRecord::Migration |
|
1 | + class AddSectionToUsers < ActiveRecord::Migration[4.2] |
|
2 | def change |
|
2 | def change |
|
3 | add_column :users, :section, :string |
|
3 | add_column :users, :section, :string |
|
4 | end |
|
4 | end |
|
5 | end |
|
5 | end |
@@ -1,5 +1,5 | |||||
|
1 | - class AddIpToSubmissions < ActiveRecord::Migration |
|
1 | + class AddIpToSubmissions < ActiveRecord::Migration[4.2] |
|
2 | def change |
|
2 | def change |
|
3 | add_column :submissions, :ip_address, :string |
|
3 | add_column :submissions, :ip_address, :string |
|
4 | end |
|
4 | end |
|
5 | end |
|
5 | end |
@@ -1,6 +1,6 | |||||
|
1 | - class AddMoreToUsers < ActiveRecord::Migration |
|
1 | + class AddMoreToUsers < ActiveRecord::Migration[4.2] |
|
2 | def change |
|
2 | def change |
|
3 | add_column :users, :enabled, :boolean, default: 1 |
|
3 | add_column :users, :enabled, :boolean, default: 1 |
|
4 | add_column :users, :remark, :string |
|
4 | add_column :users, :remark, :string |
|
5 | end |
|
5 | end |
|
6 | end |
|
6 | end |
@@ -1,9 +1,9 | |||||
|
1 | - class ChangeUseridOnLogin < ActiveRecord::Migration |
|
1 | + class ChangeUseridOnLogin < ActiveRecord::Migration[4.2] |
|
2 | def up |
|
2 | def up |
|
3 | change_column :logins, :user_id, :integer |
|
3 | change_column :logins, :user_id, :integer |
|
4 | end |
|
4 | end |
|
5 |
|
5 | ||
|
6 | def down |
|
6 | def down |
|
7 | change_column :logins, :user_id, :string |
|
7 | change_column :logins, :user_id, :string |
|
8 | end |
|
8 | end |
|
9 | end |
|
9 | end |
@@ -1,10 +1,10 | |||||
|
1 | - class CreateSubmissionViewLogs < ActiveRecord::Migration |
|
1 | + class CreateSubmissionViewLogs < ActiveRecord::Migration[4.2] |
|
2 | def change |
|
2 | def change |
|
3 | - create_table :submission_view_logs do |t| |
|
3 | + create_table :submission_view_logs, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t| |
|
4 | t.integer :user_id |
|
4 | t.integer :user_id |
|
5 | t.integer :submission_id |
|
5 | t.integer :submission_id |
|
6 |
|
6 | ||
|
7 | t.timestamps |
|
7 | t.timestamps |
|
8 | end |
|
8 | end |
|
9 | end |
|
9 | end |
|
10 | end |
|
10 | end |
@@ -1,5 +1,5 | |||||
|
1 | - class AddLastIpToUser < ActiveRecord::Migration |
|
1 | + class AddLastIpToUser < ActiveRecord::Migration[4.2] |
|
2 | def change |
|
2 | def change |
|
3 | add_column :users, :last_ip, :string |
|
3 | add_column :users, :last_ip, :string |
|
4 | end |
|
4 | end |
|
5 | end |
|
5 | end |
@@ -1,10 +1,10 | |||||
|
1 | - class CreateHeartBeats < ActiveRecord::Migration |
|
1 | + class CreateHeartBeats < ActiveRecord::Migration[4.2] |
|
2 | def change |
|
2 | def change |
|
3 | - create_table :heart_beats do |t| |
|
3 | + create_table :heart_beats, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t| |
|
4 | t.column 'user_id',:integer |
|
4 | t.column 'user_id',:integer |
|
5 | t.column 'ip_address',:string |
|
5 | t.column 'ip_address',:string |
|
6 |
|
6 | ||
|
7 | t.timestamps |
|
7 | t.timestamps |
|
8 | end |
|
8 | end |
|
9 | end |
|
9 | end |
|
10 | end |
|
10 | end |
@@ -1,5 +1,5 | |||||
|
1 | - class AddStatusToHeartBeat < ActiveRecord::Migration |
|
1 | + class AddStatusToHeartBeat < ActiveRecord::Migration[4.2] |
|
2 | def change |
|
2 | def change |
|
3 | add_column :heart_beats, :status, :string |
|
3 | add_column :heart_beats, :status, :string |
|
4 | end |
|
4 | end |
|
5 | end |
|
5 | end |
@@ -1,9 +1,9 | |||||
|
1 | - class AddMoreConfig < ActiveRecord::Migration |
|
1 | + class AddMoreConfig < ActiveRecord::Migration[4.2] |
|
2 | def up |
|
2 | def up |
|
3 | GraderConfiguration.create key: 'right.bypass_agreement', value_type: 'boolean', value:'true', description:'When false, a check box to accept license agreement appear at login and the user must click accept' |
|
3 | GraderConfiguration.create key: 'right.bypass_agreement', value_type: 'boolean', value:'true', description:'When false, a check box to accept license agreement appear at login and the user must click accept' |
|
4 | end |
|
4 | end |
|
5 |
|
5 | ||
|
6 | def down |
|
6 | def down |
|
7 |
|
7 | ||
|
8 | end |
|
8 | end |
|
9 | end |
|
9 | end |
@@ -1,10 +1,10 | |||||
|
1 | - class UpdateHeartBeat < ActiveRecord::Migration |
|
1 | + class UpdateHeartBeat < ActiveRecord::Migration[4.2] |
|
2 | def up |
|
2 | def up |
|
3 | GraderConfiguration.create key: 'right.heartbeat_response', value_type: 'string', value:'OK', description:'Heart beat response text' |
|
3 | GraderConfiguration.create key: 'right.heartbeat_response', value_type: 'string', value:'OK', description:'Heart beat response text' |
|
4 | add_index :heart_beats, :updated_at |
|
4 | add_index :heart_beats, :updated_at |
|
5 | end |
|
5 | end |
|
6 |
|
6 | ||
|
7 | def down |
|
7 | def down |
|
8 | remove_index :heart_beats, :updated_at |
|
8 | remove_index :heart_beats, :updated_at |
|
9 | end |
|
9 | end |
|
10 | end |
|
10 | end |
@@ -1,9 +1,9 | |||||
|
1 | - class ModifyGraderProcess < ActiveRecord::Migration |
|
1 | + class ModifyGraderProcess < ActiveRecord::Migration[4.2] |
|
2 | def up |
|
2 | def up |
|
3 | change_column :grader_processes, :host, :string |
|
3 | change_column :grader_processes, :host, :string |
|
4 | end |
|
4 | end |
|
5 |
|
5 | ||
|
6 | def down |
|
6 | def down |
|
7 | change_column :grader_processes, :host, :string, limit: 20 |
|
7 | change_column :grader_processes, :host, :string, limit: 20 |
|
8 | end |
|
8 | end |
|
9 | end |
|
9 | end |
@@ -1,15 +1,15 | |||||
|
1 | - class CreateTestcases < ActiveRecord::Migration |
|
1 | + class CreateTestcases < ActiveRecord::Migration[4.2] |
|
2 | def change |
|
2 | def change |
|
3 | - create_table :testcases do |t| |
|
3 | + create_table :testcases, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t| |
|
4 | t.references :problem |
|
4 | t.references :problem |
|
5 | t.integer :num |
|
5 | t.integer :num |
|
6 | t.integer :group |
|
6 | t.integer :group |
|
7 | t.integer :score |
|
7 | t.integer :score |
|
8 | t.text :input |
|
8 | t.text :input |
|
9 | t.text :sol |
|
9 | t.text :sol |
|
10 |
|
10 | ||
|
11 | t.timestamps |
|
11 | t.timestamps |
|
12 | end |
|
12 | end |
|
13 | add_index :testcases, :problem_id |
|
13 | add_index :testcases, :problem_id |
|
14 | end |
|
14 | end |
|
15 | end |
|
15 | end |
@@ -1,16 +1,16 | |||||
|
1 | - class AddConfigViewTest < ActiveRecord::Migration |
|
1 | + class AddConfigViewTest < ActiveRecord::Migration[4.2] |
|
2 | def up |
|
2 | def up |
|
3 | GraderConfiguration.create key: 'right.view_testcase', value_type: 'boolean', value:'true', description:'When true, any user can view/download test data' |
|
3 | GraderConfiguration.create key: 'right.view_testcase', value_type: 'boolean', value:'true', description:'When true, any user can view/download test data' |
|
4 | #uglily and dirtily and shamelessly check other config and inifialize |
|
4 | #uglily and dirtily and shamelessly check other config and inifialize |
|
5 | GraderConfiguration.where(key: 'right.user_hall_of_fame').first_or_create(value_type: 'boolean', value: 'false', |
|
5 | GraderConfiguration.where(key: 'right.user_hall_of_fame').first_or_create(value_type: 'boolean', value: 'false', |
|
6 | description: 'If true, any user can access hall of fame page.') |
|
6 | description: 'If true, any user can access hall of fame page.') |
|
7 | GraderConfiguration.where(key: 'right.multiple_ip_login').first_or_create(value_type: 'boolean', value: 'false', |
|
7 | GraderConfiguration.where(key: 'right.multiple_ip_login').first_or_create(value_type: 'boolean', value: 'false', |
|
8 | description: 'When change from true to false, a user can login from the first IP they logged into afterward.') |
|
8 | description: 'When change from true to false, a user can login from the first IP they logged into afterward.') |
|
9 | GraderConfiguration.where(key: 'right.user_view_submission').first_or_create(value_type: 'boolean', value: 'false', |
|
9 | GraderConfiguration.where(key: 'right.user_view_submission').first_or_create(value_type: 'boolean', value: 'false', |
|
10 | description: 'If true, any user can view submissions of every one.') |
|
10 | description: 'If true, any user can view submissions of every one.') |
|
11 | end |
|
11 | end |
|
12 |
|
12 | ||
|
13 | def down |
|
13 | def down |
|
14 | GraderConfiguration.where(key: 'right.view_testcase').destroy_all; |
|
14 | GraderConfiguration.where(key: 'right.view_testcase').destroy_all; |
|
15 | end |
|
15 | end |
|
16 | end |
|
16 | end |
@@ -1,6 +1,6 | |||||
|
1 | - class ChangeTestcaseSize < ActiveRecord::Migration |
|
1 | + class ChangeTestcaseSize < ActiveRecord::Migration[4.2] |
|
2 | def change |
|
2 | def change |
|
3 | change_column :testcases, :input, :text, :limit => 4294967295 |
|
3 | change_column :testcases, :input, :text, :limit => 4294967295 |
|
4 | change_column :testcases, :sol, :text, :limit => 4294967295 |
|
4 | change_column :testcases, :sol, :text, :limit => 4294967295 |
|
5 | end |
|
5 | end |
|
6 | end |
|
6 | end |
@@ -1,5 +1,5 | |||||
|
1 | - class AddViewTestcaseToProblem < ActiveRecord::Migration |
|
1 | + class AddViewTestcaseToProblem < ActiveRecord::Migration[4.2] |
|
2 | def change |
|
2 | def change |
|
3 | add_column :problems, :view_testcase, :bool |
|
3 | add_column :problems, :view_testcase, :bool |
|
4 | end |
|
4 | end |
|
5 | end |
|
5 | end |
@@ -1,5 +1,5 | |||||
|
1 | - class AddIndexToTask < ActiveRecord::Migration |
|
1 | + class AddIndexToTask < ActiveRecord::Migration[4.2] |
|
2 | def change |
|
2 | def change |
|
3 | add_index :tasks, :submission_id |
|
3 | add_index :tasks, :submission_id |
|
4 | end |
|
4 | end |
|
5 | end |
|
5 | end |
@@ -1,9 +1,9 | |||||
|
1 | - class AddHeartBeatFull < ActiveRecord::Migration |
|
1 | + class AddHeartBeatFull < ActiveRecord::Migration[4.2] |
|
2 | def up |
|
2 | def up |
|
3 | GraderConfiguration.create key: 'right.heartbeat_response_full', value_type: 'string', value:'RESTART', description:'Heart beat response text when user got full score (set this value to the empty string to disable this feature)' |
|
3 | GraderConfiguration.create key: 'right.heartbeat_response_full', value_type: 'string', value:'RESTART', description:'Heart beat response text when user got full score (set this value to the empty string to disable this feature)' |
|
4 | end |
|
4 | end |
|
5 |
|
5 | ||
|
6 | def down |
|
6 | def down |
|
7 |
|
7 | ||
|
8 | end |
|
8 | end |
|
9 | end |
|
9 | end |
@@ -1,30 +1,30 | |||||
|
1 | - class CreateGroups < ActiveRecord::Migration |
|
1 | + class CreateGroups < ActiveRecord::Migration[4.2] |
|
2 |
|
2 | ||
|
3 | def change |
|
3 | def change |
|
4 | - create_table :groups do |t| |
|
4 | + create_table :groups, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t| |
|
5 | t.string :name |
|
5 | t.string :name |
|
6 | t.string :description |
|
6 | t.string :description |
|
7 | end |
|
7 | end |
|
8 |
|
8 | ||
|
9 | - create_join_table :groups, :users do |t| |
|
9 | + create_join_table :groups, :users, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t| |
|
10 | # t.index [:group_id, :user_id] |
|
10 | # t.index [:group_id, :user_id] |
|
11 | t.index [:user_id, :group_id] |
|
11 | t.index [:user_id, :group_id] |
|
12 | end |
|
12 | end |
|
13 |
|
13 | ||
|
14 | - create_join_table :problems, :groups do |t| |
|
14 | + create_join_table :problems, :groups, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t| |
|
15 | # t.index [:problem_id, :group_id] |
|
15 | # t.index [:problem_id, :group_id] |
|
16 | t.index [:group_id, :problem_id] |
|
16 | t.index [:group_id, :problem_id] |
|
17 | end |
|
17 | end |
|
18 |
|
18 | ||
|
19 | reversible do |change| |
|
19 | reversible do |change| |
|
20 | change.up do |
|
20 | change.up do |
|
21 | GraderConfiguration.where(key: 'system.use_problem_group').first_or_create(value_type: 'boolean', value: 'false', |
|
21 | GraderConfiguration.where(key: 'system.use_problem_group').first_or_create(value_type: 'boolean', value: 'false', |
|
22 | description: 'If true, available problem to the user will be only ones associated with the group of the user'); |
|
22 | description: 'If true, available problem to the user will be only ones associated with the group of the user'); |
|
23 | end |
|
23 | end |
|
24 |
|
24 | ||
|
25 | change.down do |
|
25 | change.down do |
|
26 | GraderConfiguration.where(key: 'system.use_problem_group').destroy_all |
|
26 | GraderConfiguration.where(key: 'system.use_problem_group').destroy_all |
|
27 | end |
|
27 | end |
|
28 | end |
|
28 | end |
|
29 | end |
|
29 | end |
|
30 | end |
|
30 | end |
@@ -1,11 +1,11 | |||||
|
1 | - class CreateTags < ActiveRecord::Migration |
|
1 | + class CreateTags < ActiveRecord::Migration[4.2] |
|
2 | def change |
|
2 | def change |
|
3 | - create_table :tags do |t| |
|
3 | + create_table :tags, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t| |
|
4 | t.string :name, null: false |
|
4 | t.string :name, null: false |
|
5 | t.text :description |
|
5 | t.text :description |
|
6 | t.boolean :public |
|
6 | t.boolean :public |
|
7 |
|
7 | ||
|
8 | t.timestamps null: false |
|
8 | t.timestamps null: false |
|
9 | end |
|
9 | end |
|
10 | end |
|
10 | end |
|
11 | end |
|
11 | end |
@@ -1,10 +1,10 | |||||
|
1 | - class CreateProblemTags < ActiveRecord::Migration |
|
1 | + class CreateProblemTags < ActiveRecord::Migration[4.2] |
|
2 | def change |
|
2 | def change |
|
3 | - create_table :problems_tags do |t| |
|
3 | + create_table :problems_tags, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t| |
|
4 | t.references :problem, index: true, foreign_key: true |
|
4 | t.references :problem, index: true, foreign_key: true |
|
5 | t.references :tag, index: true, foreign_key: true |
|
5 | t.references :tag, index: true, foreign_key: true |
|
6 |
|
6 | ||
|
7 | t.index [:problem_id,:tag_id], unique: true |
|
7 | t.index [:problem_id,:tag_id], unique: true |
|
8 | end |
|
8 | end |
|
9 | end |
|
9 | end |
|
10 | end |
|
10 | end |
You need to be logged in to leave comments.
Login now