From 11fcea3259c5aadf73d15572b18659018d449be4 Mon Sep 17 00:00:00 2001 From: Ari Timonen Date: Tue, 24 Sep 2019 22:55:34 +0300 Subject: [PATCH] Add docker dev version Add env and docker files for development Fix some random things related to rails upgrade --- .env.dev | 26 + .gitignore | 4 + Dockerfile.dev | 25 + Gemfile | 5 +- Gemfile.lock | 167 ++--- app/controllers/teams_controller.rb | 4 +- app/models/team.rb | 2 +- app/models/user.rb | 15 +- app/views/teams/_list.html.erb | 2 +- app/views/widgets/_logged.html.erb | 4 +- config/database.yml | 2 +- config/puma.rb | 20 +- ...190917222520_add_teamers_count_to_teams.rb | 5 + db/schema.rb | 587 +++++++++--------- docker-compose.dev.yml | 34 + script/entry.sh | 8 + 16 files changed, 508 insertions(+), 402 deletions(-) create mode 100644 .env.dev create mode 100644 Dockerfile.dev create mode 100644 db/migrate/20190917222520_add_teamers_count_to_teams.rb create mode 100644 docker-compose.dev.yml create mode 100755 script/entry.sh diff --git a/.env.dev b/.env.dev new file mode 100644 index 0000000..74aaf42 --- /dev/null +++ b/.env.dev @@ -0,0 +1,26 @@ +RACK_ENV=development +RAILS_ENV=development +APP_SECRET=fe837ea72667ec3d8ecb94cfba1a1bba + +DEPLOY_PATH=/var/www + +PUMA_WORKERS=1 +PUMA_MIN_THREADS=1 +PUMA_MAX_THREADS=16 +PUMA_PORT=4000 +PUMA_TIMEOUT=30 + +MYSQL_HOST=db +MYSQL_DATABASE=ensl +MYSQL_USERNAME=ensl +MYSQL_PASSWORD=ensl +MYSQL_ROOT_PASSWORD=ensl +MYSQL_CONNECTION_POOL=8 + +NEW_RELIC_APP_NAME=ENSL +NEW_RELIC_LICENSE_KEY= + +EXCEPTIONAL_API_KEY= + +GOOGLE_API_KEY= +GOOGLE_CALENDAR_ID= diff --git a/.gitignore b/.gitignore index 007efbb..f32c2f5 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,10 @@ *.rbc *.sassc +# MySQL +db_data/ +db_data*/ + # OS X .DS_Store diff --git a/Dockerfile.dev b/Dockerfile.dev new file mode 100644 index 0000000..a852894 --- /dev/null +++ b/Dockerfile.dev @@ -0,0 +1,25 @@ +FROM ruby:2.2.10 + +ENV RAILS_ENV development + +# Add 'web' user which will run the application +RUN adduser web --home /home/web --shell /bin/bash --disabled-password --gecos "" + +RUN apt-get update && apt-get -y upgrade \ + && apt-get -y install mysql-client libmysqlclient-dev memcached nodejs \ + && service memcached start + +# Separate Gemfile ADD so that `bundle install` can be cached more effectively + +ADD Gemfile Gemfile.lock /var/www/ + +RUN mkdir -p /var/bundle && chown -R web:web /var/bundle && chown -R web:web /var/www +RUN su -c "bundle config github.https true; cd /var/www && bundle install --path /var/bundle --jobs 4" -s /bin/bash -l web + +WORKDIR /var/www +USER web + +RUN bundle config github.https true; cd /var/www && bundle install --path /var/bundle --jobs 4 + +USER root +CMD ["/var/www/script/entry.sh"] diff --git a/Gemfile b/Gemfile index c0cc8b9..5217e71 100644 --- a/Gemfile +++ b/Gemfile @@ -19,11 +19,14 @@ gem 'bluecloth', '~> 2.2.0' gem 'newrelic_rpm', '~> 3.7.2.195' gem 'will_paginate', '~> 3.0.5' gem 'dynamic_form', '~> 1.1.4' -gem 'i18n_country_select', '~> 1.1.5' +gem 'i18n_country_select' +gem 'country_select' gem 'active_link_to', '~> 1.0.2' gem 'rmagick', '~> 2.13.4', require: false gem 'test-unit', '~> 3.1.3' gem 'steam-condenser', github: 'koraktor/steam-condenser-ruby' +gem 'public_suffix', '~> 3.1.1' +gem 'active_record_union' # Please install nodejs locally. gem 'therubyracer', '~> 0.12.1' if RUBY_PLATFORM == 'x86_64-linux' diff --git a/Gemfile.lock b/Gemfile.lock index 87e7aea..a031e86 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,6 +1,6 @@ GIT - remote: git://github.com/koraktor/steam-condenser-ruby.git - revision: 6bc46e5638f984765f198ad5ae4dbe38ef9341f9 + remote: https://github.com/koraktor/steam-condenser-ruby.git + revision: 2cb441f0518a0b8d20a017dfcc42783ae878311a specs: steam-condenser (1.3.11) multi_json (~> 1.6) @@ -22,8 +22,11 @@ GEM activesupport (= 4.1.16) builder (~> 3.1) erubis (~> 2.7.0) - active_link_to (1.0.2) + active_link_to (1.0.5) actionpack + addressable + active_record_union (1.3.0) + activerecord (>= 4.0) activemodel (4.1.16) activesupport (= 4.1.16) builder (~> 3.1) @@ -37,15 +40,17 @@ GEM minitest (~> 5.1) thread_safe (~> 0.1) tzinfo (~> 1.1) - annotate (2.6.3) - activerecord (>= 2.3.0) - rake (>= 0.8.7) + addressable (2.7.0) + public_suffix (>= 2.0.2, < 5.0) + annotate (2.6.10) + activerecord (>= 3.2, <= 4.3) + rake (~> 10.4) arel (5.0.1.20140414130214) bbcoder (1.0.1) better_errors (1.1.0) coderay (>= 1.0.0) erubis (>= 2.6.6) - binding_of_caller (0.7.2) + binding_of_caller (0.7.3) debug_inspector (>= 0.0.1) bluecloth (2.2.0) bourbon (3.1.8) @@ -59,13 +64,13 @@ GEM i18n rake (>= 10.0.0) sshkit (~> 1.3) - capistrano-bundler (1.1.2) - capistrano (~> 3.0) + capistrano-bundler (1.1.4) + capistrano (~> 3.1) sshkit (~> 1.2) - capistrano-rails (1.1.1) + capistrano-rails (1.4.0) capistrano (~> 3.1) capistrano-bundler (~> 1.1) - capistrano-rbenv (2.0.2) + capistrano-rbenv (2.0.4) capistrano (~> 3.1) sshkit (~> 1.3) capybara (2.4.4) @@ -79,26 +84,33 @@ GEM activesupport (>= 3.2.0) json (>= 1.7) mime-types (>= 1.16) - childprocess (0.5.6) + childprocess (0.9.0) ffi (~> 1.0, >= 1.0.11) cliver (0.3.2) codeclimate-test-reporter (0.3.0) simplecov (>= 0.7.1, < 1.0.0) - coderay (1.1.0) + coderay (1.1.2) coffee-rails (4.0.1) coffee-script (>= 2.2.0) railties (>= 4.0.0, < 5.0) coffee-script (2.4.1) coffee-script-source execjs - coffee-script-source (1.9.1.1) - columnize (0.8.9) + coffee-script-source (1.12.2) + columnize (0.9.0) concurrent-ruby (1.1.5) - dalli (2.7.1) + countries (3.0.0) + i18n_data (~> 0.8.0) + sixarm_ruby_unaccent (~> 1.1) + unicode_utils (~> 1.4) + country_select (4.0.0) + countries (~> 3.0) + sort_alphabetical (~> 1.0) + dalli (2.7.10) database_cleaner (1.2.0) - debug_inspector (0.0.2) + debug_inspector (0.0.3) debugger-linecache (1.2.0) - diff-lcs (1.2.5) + diff-lcs (1.3) dotenv (0.10.0) dotenv-rails (0.10.0) dotenv (= 0.10.0) @@ -106,74 +118,75 @@ GEM erubis (2.7.0) exceptional (2.0.33) rack - execjs (2.6.0) + execjs (2.7.0) factory_girl (4.4.0) activesupport (>= 3.0.0) factory_girl_rails (4.4.1) factory_girl (~> 4.4.0) railties (>= 3.0.0) - faraday (0.9.0) + faraday (0.9.2) multipart-post (>= 1.2, < 3) - ffi (1.9.10) + ffi (1.11.1) font-awesome-sass (4.1.0) sass (~> 3.2) - haml (4.0.5) + haml (4.0.7) tilt i18n (0.9.5) concurrent-ruby (~> 1.0) - i18n-country-translations (1.2.2) - i18n (~> 0.5) - railties (>= 3.0) - i18n_country_select (1.1.5) + i18n-country-translations (1.3.0) + i18n (~> 0.9.3) + railties (~> 4.0) + i18n_country_select (1.1.7) i18n (~> 0.5) i18n-country-translations (~> 1.0, >= 1.0.3) unicode_utils (~> 1.0, >= 1.0.0) + i18n_data (0.8.0) jquery-rails (2.0.3) railties (>= 3.1.0, < 5.0) thor (~> 0.14) - json (1.8.3) + json (1.8.6) libv8 (3.16.14.19) mail (2.7.1) mini_mime (>= 0.1.1) - method_source (0.8.2) - mime-types (3.2.2) + method_source (0.9.2) + mime-types (3.3) mime-types-data (~> 3.2015) - mime-types-data (3.2018.0812) - mini_mime (1.0.1) - mini_portile (0.6.2) + mime-types-data (3.2019.0904) + mini_mime (1.0.2) + mini_portile2 (2.1.0) minitest (5.11.3) multi_json (1.13.1) - multi_xml (0.5.5) - multipart-post (2.0.0) + multi_xml (0.6.0) + multipart-post (2.1.1) mysql2 (0.3.21) neat (1.6.0) bourbon (>= 3.1) sass (>= 3.3) - net-scp (1.2.1) - net-ssh (>= 2.6.5) - net-ssh (2.9.0) + net-scp (2.0.0) + net-ssh (>= 2.6.5, < 6.0.0) + net-ssh (5.2.0) newrelic_rpm (3.7.2.195) - nokogiri (1.6.6.2) - mini_portile (~> 0.6.0) + nokogiri (1.6.8.1) + mini_portile2 (~> 2.1.0) oj (2.5.5) poltergeist (1.6.0) capybara (~> 2.1) cliver (~> 0.3.1) multi_json (~> 1.0) websocket-driver (>= 0.2.0) - power_assert (0.2.4) - protected_attributes (1.1.3) + power_assert (1.1.5) + protected_attributes (1.1.4) activemodel (>= 4.0.1, < 5.0) - pry (0.9.12.6) - coderay (~> 1.0) - method_source (~> 0.8) - slop (~> 3.4) - pry-byebug (1.3.2) + pry (0.12.2) + coderay (~> 1.1.0) + method_source (~> 0.9.0) + pry-byebug (1.3.3) byebug (~> 2.7) - pry (~> 0.9.12) - puma (2.11.1) + pry (~> 0.10) + public_suffix (3.1.1) + puma (2.11.3) rack (>= 1.1, < 2.0) - quiet_assets (1.0.2) + quiet_assets (1.0.3) railties (>= 3.1, < 5.0) rack (1.5.5) rack-test (0.6.3) @@ -188,14 +201,17 @@ GEM bundler (>= 1.3.0, < 2.0) railties (= 4.1.16) sprockets-rails (~> 2.0) - rails_autolink (1.1.5) + rails_autolink (1.1.6) rails (> 3.1) railties (4.1.16) actionpack (= 4.1.16) activesupport (= 4.1.16) rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) - rake (12.3.2) + rake (10.5.0) + rb-fsevent (0.10.3) + rb-inotify (0.10.0) + ffi (~> 1.0) ref (2.0.0) rmagick (2.13.4) rspec-core (3.3.2) @@ -215,16 +231,20 @@ GEM rspec-mocks (~> 3.3.0) rspec-support (~> 3.3.0) rspec-support (3.3.0) - rubyzip (1.1.7) - sanitize (2.1.0) + rubyzip (1.2.4) + sanitize (2.1.1) nokogiri (>= 1.4.4) - sass (3.4.16) - sass-rails (5.0.3) - railties (>= 4.0.0, < 5.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) + tilt (>= 1.1, < 3) selenium-webdriver (2.47.1) childprocess (~> 0.5) multi_json (~> 1.0) @@ -234,7 +254,9 @@ GEM multi_json (~> 1.0) simplecov-html (~> 0.7.1) simplecov-html (0.7.1) - slop (3.5.0) + sixarm_ruby_unaccent (1.2.0) + sort_alphabetical (1.1.0) + unicode_utils (>= 1.2.2) sprockets (3.7.2) concurrent-ruby (~> 1.0) rack (> 1, < 3) @@ -242,36 +264,32 @@ GEM actionpack (>= 3.0) activesupport (>= 3.0) sprockets (>= 2.8, < 4.0) - sshkit (1.4.0) + sshkit (1.20.0) net-scp (>= 1.1.2) net-ssh (>= 2.8.0) - term-ansicolor - term-ansicolor (1.3.0) - tins (~> 1.0) - test-unit (3.1.3) + test-unit (3.1.9) power_assert therubyracer (0.12.3) libv8 (~> 3.16.14.15) ref thor (0.20.3) thread_safe (0.3.6) - tilt (1.4.1) - timecop (0.7.1) - tins (1.1.0) - tinymce-rails (3.5.9) + tilt (2.0.9) + timecop (0.7.4) + tinymce-rails (3.5.11.1) railties (>= 3.1.1) tzinfo (1.2.5) thread_safe (~> 0.1) - uglifier (2.5.0) + uglifier (2.5.3) execjs (>= 0.3.0) json (>= 1.8.0) unicode_utils (1.4.0) - websocket (1.2.2) - websocket-driver (0.5.4) + websocket (1.2.8) + websocket-driver (0.7.1) websocket-extensions (>= 0.1.0) - websocket-extensions (0.1.2) + websocket-extensions (0.1.4) will_paginate (3.0.12) - xpath (2.0.0) + xpath (2.1.0) nokogiri (~> 1.3) PLATFORMS @@ -279,6 +297,7 @@ PLATFORMS DEPENDENCIES active_link_to (~> 1.0.2) + active_record_union annotate (~> 2.6.2) bbcoder (~> 1.0.1) better_errors (~> 1.1.0) @@ -293,6 +312,7 @@ DEPENDENCIES carrierwave (~> 0.10.0) codeclimate-test-reporter (~> 0.3.0) coffee-rails (~> 4.0.0) + country_select dalli (~> 2.7.0) database_cleaner (~> 1.2.0) dotenv-rails (~> 0.10.0) @@ -302,7 +322,7 @@ DEPENDENCIES faraday (~> 0.9.0) font-awesome-sass (~> 4.1.0.0) haml (~> 4.0.5) - i18n_country_select (~> 1.1.5) + i18n_country_select jquery-rails (~> 2.0.2) mysql2 (~> 0.3.18) neat (~> 1.6.0) @@ -312,6 +332,7 @@ DEPENDENCIES poltergeist (~> 1.6.0) protected_attributes (~> 1.1.3) pry-byebug (~> 1.3.2) + public_suffix (~> 3.1.1) puma (~> 2.11.1) quiet_assets (~> 1.0.2) rails (~> 4.1.16) diff --git a/app/controllers/teams_controller.rb b/app/controllers/teams_controller.rb index 868797e..0a97845 100644 --- a/app/controllers/teams_controller.rb +++ b/app/controllers/teams_controller.rb @@ -2,7 +2,7 @@ class TeamsController < ApplicationController before_filter :get_team, only: [:show, :edit, :update, :destroy, :recover] def index - @teams = Team.non_empty_teams.search(params[:search]).paginate(per_page: 80, page: params[:page]).ordered + @teams = Team.search(params[:search]).paginate(per_page: 80, page: params[:page]).ordered end def show @@ -15,7 +15,7 @@ class TeamsController < ApplicationController raise AccessError unless @team.can_create? cuser end - def replace_teamer + def replace_teamer redirect_to_back end diff --git a/app/models/team.rb b/app/models/team.rb index c7b1e71..51b81ca 100644 --- a/app/models/team.rb +++ b/app/models/team.rb @@ -48,7 +48,7 @@ class Team < ActiveRecord::Base belongs_to :founder, :class_name => "User" has_many :active_teamers, -> { where("rank >= ?", Teamer::RANK_MEMBER) } - has_many :teamers, :dependent => :destroy + has_many :teamers, :dependent => :destroy, :counter_cache => true has_many :leaders, -> { where("rank = ?", Teamer::RANK_LEADER) }, :class_name => "Teamer" has_many :contesters, :dependent => :destroy has_many :contests, -> { where("contesters.active", true) }, :through => :contesters diff --git a/app/models/user.rb b/app/models/user.rb index 04a5e84..63f51e0 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -138,13 +138,8 @@ class User < ActiveRecord::Base end def country_s - I18nCountrySelect::Countries::COUNTRY_CODES.each do |code| - if code == country - return I18n.t(code, :scope => :countries, :default => 'missing') - end - end - - country + country_object = ISO3166::Country[country] + country_object.translations[I18n.locale.to_s] || country_object.name end def realname @@ -211,15 +206,15 @@ class User < ActiveRecord::Base end def new_messages - received_personal_messages.unread_by(self) + received_team_messages.unread_by(self) + received_personal_messages.unread_by(self).union(received_team_messages.unread_by(self)) end def received_messages - received_personal_messages + received_team_messages + received_personal_messages.union(received_team_messages) end def sent_messages - sent_personal_messages + sent_team_messages + sent_personal_messages.union(sent_team_messages) end def upcoming_matches diff --git a/app/views/teams/_list.html.erb b/app/views/teams/_list.html.erb index 837fd43..b560f56 100644 --- a/app/views/teams/_list.html.erb +++ b/app/views/teams/_list.html.erb @@ -14,7 +14,7 @@ <%= flag team.country %> <%= namelink team %> <%= h team.irc if team.irc %> - <%= h team.teamers_num %> + <%= h team.teamers.count %> <% if cuser and cuser.admin? %> <%= link_to edit_team_path(team) do %> diff --git a/app/views/widgets/_logged.html.erb b/app/views/widgets/_logged.html.erb index 3a49932..764cabf 100644 --- a/app/views/widgets/_logged.html.erb +++ b/app/views/widgets/_logged.html.erb @@ -22,8 +22,8 @@ <%= link_to messages_path do %> Messages <%= icon 'envelope' %> <% end %> - <% if c = cuser.new_messages.count > 0 %> - (<%= cuser.new_messages.count %>) + <% if c = cuser.new_messages.num > 0 %> + (<%= cuser.new_messages.num %>) <% end %>
  • diff --git a/config/database.yml b/config/database.yml index b91e757..bb0011b 100644 --- a/config/database.yml +++ b/config/database.yml @@ -1,7 +1,7 @@ base: &db adapter: mysql2 encoding: utf8 - host: localhost + host: <%= ENV['MYSQL_HOST'] %> database: <%= ENV['MYSQL_DATABASE'] %> username: <%= ENV['MYSQL_USERNAME'] %> password: <%= ENV['MYSQL_PASSWORD'] %> diff --git a/config/puma.rb b/config/puma.rb index d5b690d..faace22 100644 --- a/config/puma.rb +++ b/config/puma.rb @@ -1,25 +1,25 @@ require "dotenv" -Dotenv.load +Dotenv.load('.env.dev') base_path = (ENV['DEPLOY_PATH'] || Dir.pwd) -current_path = "#{base_path}/current" -shared_path = "#{base_path}/shared" -stderr_path = "#{shared_path}/log/puma.stderr.log" -stdout_path = "#{shared_path}/log/puma.stdout.log" +#current_path = "#{base_path}/current" +#shared_path = "#{base_path}/shared" +stderr_path = "#{base_path}/log/puma.stderr.log" +stdout_path = "#{base_path}/log/puma.stdout.log" tag 'ENSL' preload_app! -daemonize true -directory current_path -pidfile "#{shared_path}/tmp/pids/puma.pid" -state_path "#{shared_path}/tmp/pids/puma.state" +daemonize false +directory base_path +pidfile "#{base_path}/tmp/pids/puma.pid" +state_path "#{base_path}/tmp/pids/puma.state" stdout_redirect stdout_path, stderr_path environment ENV['RACK_ENV'] || 'production' rackup DefaultRackup -bind "unix://#{shared_path}/tmp/sockets/puma.sock" +bind "unix://#{base_path}/tmp/sockets/puma.sock" port Integer(ENV['PUMA_PORT'] || 4000) worker_timeout Integer(ENV['PUMA_TIMEOUT'] || 30) diff --git a/db/migrate/20190917222520_add_teamers_count_to_teams.rb b/db/migrate/20190917222520_add_teamers_count_to_teams.rb new file mode 100644 index 0000000..89ff49d --- /dev/null +++ b/db/migrate/20190917222520_add_teamers_count_to_teams.rb @@ -0,0 +1,5 @@ +class AddTeamersCountToTeams < ActiveRecord::Migration + def change + add_column :teams, :teamers_count, :integer + end +end \ No newline at end of file diff --git a/db/schema.rb b/db/schema.rb index 7f203e9..05edaba 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -9,56 +9,42 @@ # from scratch. The latter is a flawed and unsustainable approach (the more migrations # you'll amass, the slower it'll run and the greater likelihood for issues). # -# It's strongly recommended to check this file into your version control system. +# It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(:version => 20150820223313) do +ActiveRecord::Schema.define(version: 20190917222520) do - create_table "admin_requests", :force => true do |t| - t.string "addr" - t.string "pwd" - t.integer "server_id" - t.string "player" - t.integer "user_id" - t.string "msg" - t.datetime "created_at" - t.datetime "updated_at" - end - - add_index "admin_requests", ["server_id"], :name => "index_admin_requests_on_server_id" - add_index "admin_requests", ["user_id"], :name => "index_admin_requests_on_user_id" - - create_table "article_versions", :force => true do |t| + create_table "article_versions", force: true do |t| t.integer "article_id" t.integer "version" t.string "title" - t.text "text", :limit => 16777215 + t.text "text", limit: 16777215 t.datetime "created_at" t.datetime "updated_at" - t.text "text_parsed", :limit => 16777215 - t.integer "text_coding", :default => 0, :null => false + t.text "text_parsed", limit: 16777215 + t.integer "text_coding", default: 0, null: false end - add_index "article_versions", ["article_id"], :name => "index_article_versions_on_article_id" + add_index "article_versions", ["article_id"], name: "index_article_versions_on_article_id", using: :btree - create_table "articles", :force => true do |t| + create_table "articles", force: true do |t| t.string "title" - t.integer "status", :null => false + t.integer "status", null: false t.integer "category_id" - t.text "text", :limit => 16777215 + t.text "text", limit: 16777215 t.integer "user_id" t.datetime "created_at" t.datetime "updated_at" t.integer "version" - t.text "text_parsed", :limit => 16777215 - t.integer "text_coding", :default => 0, :null => false + t.text "text_parsed", limit: 16777215 + t.integer "text_coding", default: 0, null: false end - add_index "articles", ["category_id"], :name => "index_articles_on_category_id" - add_index "articles", ["created_at", "status"], :name => "index_articles_on_created_at_and_status" - add_index "articles", ["created_at"], :name => "index_articles_on_created_at" - add_index "articles", ["user_id"], :name => "index_articles_on_user_id" + add_index "articles", ["category_id"], name: "index_articles_on_category_id", using: :btree + add_index "articles", ["created_at", "status"], name: "index_articles_on_created_at_and_status", using: :btree + add_index "articles", ["created_at"], name: "index_articles_on_created_at", using: :btree + add_index "articles", ["user_id"], name: "index_articles_on_user_id", using: :btree - create_table "bans", :force => true do |t| + create_table "bans", force: true do |t| t.string "steamid" t.integer "user_id" t.string "addr" @@ -69,12 +55,14 @@ ActiveRecord::Schema.define(:version => 20150820223313) do t.datetime "updated_at" t.integer "ban_type" t.string "ip" + t.integer "creator_id" end - add_index "bans", ["server_id"], :name => "index_bans_on_server_id" - add_index "bans", ["user_id"], :name => "index_bans_on_user_id" + add_index "bans", ["creator_id"], name: "index_bans_on_creator_id", using: :btree + add_index "bans", ["server_id"], name: "index_bans_on_server_id", using: :btree + add_index "bans", ["user_id"], name: "index_bans_on_user_id", using: :btree - create_table "bracketers", :force => true do |t| + create_table "bracketers", force: true do |t| t.integer "bracket_id" t.integer "column" t.integer "row" @@ -84,10 +72,10 @@ ActiveRecord::Schema.define(:version => 20150820223313) do t.datetime "updated_at" end - add_index "bracketers", ["match_id"], :name => "index_bracketers_on_match_id" - add_index "bracketers", ["team_id"], :name => "index_bracketers_on_team_id" + add_index "bracketers", ["match_id"], name: "index_bracketers_on_match_id", using: :btree + add_index "bracketers", ["team_id"], name: "index_bracketers_on_team_id", using: :btree - create_table "brackets", :force => true do |t| + create_table "brackets", force: true do |t| t.integer "contest_id" t.integer "slots" t.datetime "created_at" @@ -95,9 +83,9 @@ ActiveRecord::Schema.define(:version => 20150820223313) do t.string "name" end - add_index "brackets", ["contest_id"], :name => "index_brackets_on_contest_id" + add_index "brackets", ["contest_id"], name: "index_brackets_on_contest_id", using: :btree - create_table "categories", :force => true do |t| + create_table "categories", force: true do |t| t.string "name" t.integer "sort" t.datetime "created_at" @@ -105,10 +93,10 @@ ActiveRecord::Schema.define(:version => 20150820223313) do t.integer "domain" end - add_index "categories", ["domain"], :name => "index_categories_on_domain" - add_index "categories", ["sort"], :name => "index_categories_on_sort" + add_index "categories", ["domain"], name: "index_categories_on_domain", using: :btree + add_index "categories", ["sort"], name: "index_categories_on_sort", using: :btree - create_table "challenges", :force => true do |t| + create_table "challenges", force: true do |t| t.integer "contester1_id" t.integer "contester2_id" t.datetime "match_time" @@ -122,17 +110,17 @@ ActiveRecord::Schema.define(:version => 20150820223313) do t.datetime "updated_at" t.string "map1_id" t.string "map2_id" - t.integer "status", :default => 0, :null => false + t.integer "status", default: 0, null: false end - add_index "challenges", ["contester1_id"], :name => "index_challenges_on_contester1_id" - add_index "challenges", ["contester2_id"], :name => "index_challenges_on_contester2_id" - add_index "challenges", ["map1_id"], :name => "index_challenges_on_map1_id" - add_index "challenges", ["map2_id"], :name => "index_challenges_on_map2_id" - add_index "challenges", ["server_id"], :name => "index_challenges_on_server_id" - add_index "challenges", ["user_id"], :name => "index_challenges_on_user_id" + add_index "challenges", ["contester1_id"], name: "index_challenges_on_contester1_id", using: :btree + add_index "challenges", ["contester2_id"], name: "index_challenges_on_contester2_id", using: :btree + add_index "challenges", ["map1_id"], name: "index_challenges_on_map1_id", using: :btree + add_index "challenges", ["map2_id"], name: "index_challenges_on_map2_id", using: :btree + add_index "challenges", ["server_id"], name: "index_challenges_on_server_id", using: :btree + add_index "challenges", ["user_id"], name: "index_challenges_on_user_id", using: :btree - create_table "comments", :force => true do |t| + create_table "comments", force: true do |t| t.text "text" t.integer "user_id" t.string "commentable_type" @@ -142,29 +130,29 @@ ActiveRecord::Schema.define(:version => 20150820223313) do t.text "text_parsed" end - add_index "comments", ["commentable_type", "commentable_id"], :name => "index_comments_on_commentable_type_and_commentable_id" - add_index "comments", ["commentable_type", "id"], :name => "index_comments_on_commentable_type_and_id" - add_index "comments", ["commentable_type"], :name => "index_comments_on_commentable_type" - add_index "comments", ["user_id"], :name => "index_comments_on_user_id" + add_index "comments", ["commentable_type", "commentable_id"], name: "index_comments_on_commentable_type_and_commentable_id", using: :btree + add_index "comments", ["commentable_type", "id"], name: "index_comments_on_commentable_type_and_id", using: :btree + add_index "comments", ["commentable_type"], name: "index_comments_on_commentable_type", using: :btree + add_index "comments", ["user_id"], name: "index_comments_on_user_id", using: :btree - create_table "contesters", :force => true do |t| + create_table "contesters", force: true do |t| t.integer "team_id" t.datetime "created_at" t.datetime "updated_at" - t.integer "score", :default => 0, :null => false - t.integer "win", :default => 0, :null => false - t.integer "loss", :default => 0, :null => false - t.integer "draw", :default => 0, :null => false + t.integer "score", default: 0, null: false + t.integer "win", default: 0, null: false + t.integer "loss", default: 0, null: false + t.integer "draw", default: 0, null: false t.integer "contest_id" - t.integer "trend", :null => false - t.integer "extra", :null => false - t.boolean "active", :default => true, :null => false + t.integer "trend", null: false + t.integer "extra", null: false + t.boolean "active", default: true, null: false end - add_index "contesters", ["contest_id"], :name => "index_contesters_on_contest_id" - add_index "contesters", ["team_id"], :name => "index_contesters_on_team_id" + add_index "contesters", ["contest_id"], name: "index_contesters_on_contest_id", using: :btree + add_index "contesters", ["team_id"], name: "index_contesters_on_team_id", using: :btree - create_table "contests", :force => true do |t| + create_table "contests", force: true do |t| t.string "name" t.datetime "start" t.datetime "end" @@ -172,36 +160,46 @@ ActiveRecord::Schema.define(:version => 20150820223313) do t.datetime "created_at" t.datetime "updated_at" t.time "default_time" - t.integer "contest_type", :default => 0, :null => false + t.integer "contest_type", default: 0, null: false t.integer "winner_id" t.integer "demos_id" t.string "short_name" t.integer "weight" t.integer "modulus_base" - t.float "modulus_even" - t.float "modulus_3to1" - t.float "modulus_4to0" + t.float "modulus_even", limit: 24 + t.float "modulus_3to1", limit: 24 + t.float "modulus_4to0", limit: 24 t.integer "rules_id" end - add_index "contests", ["demos_id"], :name => "index_contests_on_demos_id" - add_index "contests", ["rules_id"], :name => "index_contests_on_rules_id" - add_index "contests", ["status"], :name => "index_contests_on_status" - add_index "contests", ["winner_id"], :name => "index_contests_on_winner_id" + add_index "contests", ["demos_id"], name: "index_contests_on_demos_id", using: :btree + add_index "contests", ["rules_id"], name: "index_contests_on_rules_id", using: :btree + add_index "contests", ["status"], name: "index_contests_on_status", using: :btree + add_index "contests", ["winner_id"], name: "index_contests_on_winner_id", using: :btree - create_table "contests_maps", :id => false, :force => true do |t| + create_table "contests_maps", id: false, force: true do |t| t.integer "contest_id" t.integer "map_id" end - add_index "contests_maps", ["contest_id", "map_id"], :name => "index_contests_maps_on_contest_id_and_map_id" - add_index "contests_maps", ["map_id", "contest_id"], :name => "index_contests_maps_on_map_id_and_contest_id" + add_index "contests_maps", ["contest_id", "map_id"], name: "index_contests_maps_on_contest_id_and_map_id", using: :btree + add_index "contests_maps", ["map_id", "contest_id"], name: "index_contests_maps_on_map_id_and_contest_id", using: :btree - create_table "data_files", :force => true do |t| + create_table "custom_urls", force: true do |t| + t.string "name" + t.integer "article_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + add_index "custom_urls", ["article_id"], name: "index_custom_urls_on_article_id", using: :btree + add_index "custom_urls", ["name"], name: "index_custom_urls_on_name", using: :btree + + create_table "data_files", force: true do |t| t.string "name" t.string "description" t.string "path" - t.integer "size", :null => false + t.integer "size", null: false t.string "md5" t.datetime "created_at" t.datetime "updated_at" @@ -210,48 +208,23 @@ ActiveRecord::Schema.define(:version => 20150820223313) do t.integer "article_id" end - add_index "data_files", ["article_id"], :name => "index_data_files_on_article_id" - add_index "data_files", ["directory_id"], :name => "index_data_files_on_directory_id" - add_index "data_files", ["related_id"], :name => "index_data_files_on_related_id" + add_index "data_files", ["article_id"], name: "index_data_files_on_article_id", using: :btree + add_index "data_files", ["directory_id"], name: "index_data_files_on_directory_id", using: :btree + add_index "data_files", ["related_id"], name: "index_data_files_on_related_id", using: :btree - create_table "deleteds", :force => true do |t| - t.integer "deletable_id" - t.string "deletable_type" - t.integer "user_id" - t.text "reason" - t.datetime "created_at" - t.datetime "updated_at" - t.integer "related_id" - end - - create_table "directories", :force => true do |t| + create_table "directories", force: true do |t| t.string "name" t.string "description" t.string "path" t.datetime "created_at" t.datetime "updated_at" t.integer "parent_id" - t.boolean "hidden", :default => false, :null => false + t.boolean "hidden", default: false, null: false end - add_index "directories", ["parent_id"], :name => "index_directories_on_parent_id" + add_index "directories", ["parent_id"], name: "index_directories_on_parent_id", using: :btree - create_table "firms", :force => true do |t| - t.string "name" - t.string "y_code" - t.string "email" - t.string "website" - t.string "phone" - t.string "address" - t.integer "zipcode" - t.string "town" - t.integer "owner" - t.string "opentime" - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "forumers", :force => true do |t| + create_table "forumers", force: true do |t| t.integer "forum_id" t.integer "group_id" t.integer "access" @@ -259,10 +232,10 @@ ActiveRecord::Schema.define(:version => 20150820223313) do t.datetime "updated_at" end - add_index "forumers", ["forum_id"], :name => "index_forumers_on_forum_id" - add_index "forumers", ["group_id"], :name => "index_forumers_on_group_id" + add_index "forumers", ["forum_id"], name: "index_forumers_on_forum_id", using: :btree + add_index "forumers", ["group_id"], name: "index_forumers_on_group_id", using: :btree - create_table "forums", :force => true do |t| + create_table "forums", force: true do |t| t.string "title" t.string "description" t.integer "category_id" @@ -271,18 +244,18 @@ ActiveRecord::Schema.define(:version => 20150820223313) do t.integer "position" end - add_index "forums", ["category_id"], :name => "index_forums_on_category_id" + add_index "forums", ["category_id"], name: "index_forums_on_category_id", using: :btree - create_table "gather_maps", :force => true do |t| + create_table "gather_maps", force: true do |t| t.integer "gather_id" t.integer "map_id" t.integer "votes" end - add_index "gather_maps", ["gather_id"], :name => "index_gather_maps_on_gather_id" - add_index "gather_maps", ["map_id"], :name => "index_gather_maps_on_map_id" + add_index "gather_maps", ["gather_id"], name: "index_gather_maps_on_gather_id", using: :btree + add_index "gather_maps", ["map_id"], name: "index_gather_maps_on_map_id", using: :btree - create_table "gather_servers", :force => true do |t| + create_table "gather_servers", force: true do |t| t.integer "gather_id" t.integer "server_id" t.integer "votes" @@ -290,21 +263,21 @@ ActiveRecord::Schema.define(:version => 20150820223313) do t.datetime "updated_at" end - create_table "gatherers", :force => true do |t| + create_table "gatherers", force: true do |t| t.integer "user_id" t.integer "gather_id" t.integer "team" t.datetime "created_at" t.datetime "updated_at" - t.integer "votes", :default => 0, :null => false - t.integer "status", :default => 0, :null => false + t.integer "votes", default: 0, null: false + t.integer "status", default: 0, null: false end - add_index "gatherers", ["gather_id"], :name => "index_gatherers_on_gather_id" - add_index "gatherers", ["updated_at", "gather_id"], :name => "index_gatherers_on_updated_at_and_gather_id" - add_index "gatherers", ["user_id"], :name => "index_gatherers_on_user_id" + add_index "gatherers", ["gather_id"], name: "index_gatherers_on_gather_id", using: :btree + add_index "gatherers", ["updated_at", "gather_id"], name: "index_gatherers_on_updated_at_and_gather_id", using: :btree + add_index "gatherers", ["user_id"], name: "index_gatherers_on_user_id", using: :btree - create_table "gathers", :force => true do |t| + create_table "gathers", force: true do |t| t.integer "status" t.integer "captain1_id" t.integer "captain2_id" @@ -316,22 +289,22 @@ ActiveRecord::Schema.define(:version => 20150820223313) do t.integer "turn" t.datetime "lastpick1" t.datetime "lastpick2" - t.integer "votes", :default => 0, :null => false + t.integer "votes", default: 0, null: false t.integer "category_id" end - add_index "gathers", ["captain1_id"], :name => "index_gathers_on_captain1_id" - add_index "gathers", ["captain2_id"], :name => "index_gathers_on_captain2_id" - add_index "gathers", ["map1_id"], :name => "index_gathers_on_map1_id" - add_index "gathers", ["map2_id"], :name => "index_gathers_on_map2_id" - add_index "gathers", ["server_id"], :name => "index_gathers_on_server_id" + add_index "gathers", ["captain1_id"], name: "index_gathers_on_captain1_id", using: :btree + add_index "gathers", ["captain2_id"], name: "index_gathers_on_captain2_id", using: :btree + add_index "gathers", ["map1_id"], name: "index_gathers_on_map1_id", using: :btree + add_index "gathers", ["map2_id"], name: "index_gathers_on_map2_id", using: :btree + add_index "gathers", ["server_id"], name: "index_gathers_on_server_id", using: :btree - create_table "gathers_users", :id => false, :force => true do |t| - t.integer "gather_id", :null => false - t.integer "user_id", :null => false + create_table "gathers_users", id: false, force: true do |t| + t.integer "gather_id", null: false + t.integer "user_id", null: false end - create_table "groupers", :force => true do |t| + create_table "groupers", force: true do |t| t.integer "group_id" t.integer "user_id" t.string "task" @@ -339,24 +312,24 @@ ActiveRecord::Schema.define(:version => 20150820223313) do t.datetime "updated_at" end - add_index "groupers", ["group_id"], :name => "index_groupers_on_group_id" - add_index "groupers", ["user_id"], :name => "index_groupers_on_user_id" + add_index "groupers", ["group_id"], name: "index_groupers_on_group_id", using: :btree + add_index "groupers", ["user_id"], name: "index_groupers_on_user_id", using: :btree - create_table "groups", :force => true do |t| + create_table "groups", force: true do |t| t.string "name" t.datetime "created_at" t.datetime "updated_at" t.integer "founder_id" end - add_index "groups", ["founder_id"], :name => "index_groups_on_founder_id" + add_index "groups", ["founder_id"], name: "index_groups_on_founder_id", using: :btree - create_table "groups_users", :id => false, :force => true do |t| - t.integer "group_id", :null => false - t.integer "user_id", :null => false + create_table "groups_users", id: false, force: true do |t| + t.integer "group_id", null: false + t.integer "user_id", null: false end - create_table "issues", :force => true do |t| + create_table "issues", force: true do |t| t.string "title" t.integer "status" t.integer "assigned_id" @@ -369,20 +342,20 @@ ActiveRecord::Schema.define(:version => 20150820223313) do t.text "text_parsed" end - add_index "issues", ["assigned_id"], :name => "index_issues_on_assigned_id" - add_index "issues", ["author_id"], :name => "index_issues_on_author_id" - add_index "issues", ["category_id"], :name => "index_issues_on_category_id" + add_index "issues", ["assigned_id"], name: "index_issues_on_assigned_id", using: :btree + add_index "issues", ["author_id"], name: "index_issues_on_author_id", using: :btree + add_index "issues", ["category_id"], name: "index_issues_on_category_id", using: :btree - create_table "locks", :force => true do |t| + create_table "locks", force: true do |t| t.integer "lockable_id" t.string "lockable_type" t.datetime "created_at" t.datetime "updated_at" end - add_index "locks", ["lockable_id", "lockable_type"], :name => "index_locks_on_lockable_id_and_lockable_type" + add_index "locks", ["lockable_id", "lockable_type"], name: "index_locks_on_lockable_id_and_lockable_type", using: :btree - create_table "log_events", :force => true do |t| + create_table "log_events", force: true do |t| t.string "name" t.string "description" t.integer "team" @@ -390,7 +363,7 @@ ActiveRecord::Schema.define(:version => 20150820223313) do t.datetime "updated_at" end - create_table "log_files", :force => true do |t| + create_table "log_files", force: true do |t| t.string "name" t.string "md5" t.integer "size" @@ -398,9 +371,9 @@ ActiveRecord::Schema.define(:version => 20150820223313) do t.datetime "updated_at" end - add_index "log_files", ["server_id"], :name => "index_log_files_on_server_id" + add_index "log_files", ["server_id"], name: "index_log_files_on_server_id", using: :btree - create_table "logs", :force => true do |t| + create_table "logs", force: true do |t| t.integer "server_id" t.text "text" t.integer "domain" @@ -414,36 +387,45 @@ ActiveRecord::Schema.define(:version => 20150820223313) do t.integer "log_file_id" end - add_index "logs", ["actor_id"], :name => "index_logs_on_actor_id" - add_index "logs", ["log_file_id"], :name => "index_logs_on_log_file_id" - add_index "logs", ["round_id"], :name => "index_logs_on_round_id" - add_index "logs", ["server_id"], :name => "index_logs_on_server_id" - add_index "logs", ["target_id"], :name => "index_logs_on_target_id" + add_index "logs", ["actor_id"], name: "index_logs_on_actor_id", using: :btree + add_index "logs", ["log_file_id"], name: "index_logs_on_log_file_id", using: :btree + add_index "logs", ["round_id"], name: "index_logs_on_round_id", using: :btree + add_index "logs", ["server_id"], name: "index_logs_on_server_id", using: :btree + add_index "logs", ["target_id"], name: "index_logs_on_target_id", using: :btree - create_table "maps", :force => true do |t| + create_table "maps", force: true do |t| t.string "name" t.string "download" t.datetime "created_at" t.datetime "updated_at" - t.boolean "deleted", :default => false, :null => false + t.boolean "deleted", default: false, null: false t.string "picture" t.integer "category_id" end - create_table "matchers", :force => true do |t| - t.integer "match_id", :null => false - t.integer "user_id", :null => false - t.integer "contester_id", :null => false - t.datetime "created_at" - t.datetime "updated_at" - t.boolean "merc", :null => false + create_table "match_proposals", force: true do |t| + t.integer "match_id" + t.integer "team_id" + t.datetime "proposed_time" + t.integer "status" end - add_index "matchers", ["contester_id"], :name => "index_matchers_on_contester_id" - add_index "matchers", ["match_id"], :name => "index_matchers_on_match_id" - add_index "matchers", ["user_id"], :name => "index_matchers_on_user_id" + add_index "match_proposals", ["status"], name: "index_match_proposals_on_status", using: :btree - create_table "matches", :force => true do |t| + create_table "matchers", force: true do |t| + t.integer "match_id", null: false + t.integer "user_id", null: false + t.integer "contester_id", null: false + t.datetime "created_at" + t.datetime "updated_at" + t.boolean "merc", null: false + end + + add_index "matchers", ["contester_id"], name: "index_matchers_on_contester_id", using: :btree + add_index "matchers", ["match_id"], name: "index_matchers_on_match_id", using: :btree + add_index "matchers", ["user_id"], name: "index_matchers_on_user_id", using: :btree + + create_table "matches", force: true do |t| t.integer "contester1_id" t.integer "contester2_id" t.integer "score1" @@ -469,22 +451,22 @@ ActiveRecord::Schema.define(:version => 20150820223313) do t.string "caster_id" end - add_index "matches", ["challenge_id"], :name => "index_matches_on_challenge_id" - add_index "matches", ["contest_id"], :name => "index_matches_on_contest_id" - add_index "matches", ["contester1_id"], :name => "index_matches_on_contester1_id" - add_index "matches", ["contester2_id"], :name => "index_matches_on_contester2_id" - add_index "matches", ["demo_id"], :name => "index_matches_on_demo_id" - add_index "matches", ["hltv_id"], :name => "index_matches_on_hltv_id" - add_index "matches", ["map1_id"], :name => "index_matches_on_map1_id" - add_index "matches", ["map2_id"], :name => "index_matches_on_map2_id" - add_index "matches", ["match_time"], :name => "index_matches_on_match_time" - add_index "matches", ["motm_id"], :name => "index_matches_on_motm_id" - add_index "matches", ["referee_id"], :name => "index_matches_on_referee_id" - add_index "matches", ["score1", "score2"], :name => "index_matches_on_score1_and_score2" - add_index "matches", ["server_id"], :name => "index_matches_on_server_id" - add_index "matches", ["week_id"], :name => "index_matches_on_week_id" + add_index "matches", ["challenge_id"], name: "index_matches_on_challenge_id", using: :btree + add_index "matches", ["contest_id"], name: "index_matches_on_contest_id", using: :btree + add_index "matches", ["contester1_id"], name: "index_matches_on_contester1_id", using: :btree + add_index "matches", ["contester2_id"], name: "index_matches_on_contester2_id", using: :btree + add_index "matches", ["demo_id"], name: "index_matches_on_demo_id", using: :btree + add_index "matches", ["hltv_id"], name: "index_matches_on_hltv_id", using: :btree + add_index "matches", ["map1_id"], name: "index_matches_on_map1_id", using: :btree + add_index "matches", ["map2_id"], name: "index_matches_on_map2_id", using: :btree + add_index "matches", ["match_time"], name: "index_matches_on_match_time", using: :btree + add_index "matches", ["motm_id"], name: "index_matches_on_motm_id", using: :btree + add_index "matches", ["referee_id"], name: "index_matches_on_referee_id", using: :btree + add_index "matches", ["score1", "score2"], name: "index_matches_on_score1_and_score2", using: :btree + add_index "matches", ["server_id"], name: "index_matches_on_server_id", using: :btree + add_index "matches", ["week_id"], name: "index_matches_on_week_id", using: :btree - create_table "messages", :force => true do |t| + create_table "messages", force: true do |t| t.string "sender_type" t.integer "sender_id" t.string "recipient_type" @@ -496,10 +478,10 @@ ActiveRecord::Schema.define(:version => 20150820223313) do t.text "text_parsed" end - add_index "messages", ["recipient_id", "recipient_type"], :name => "index_messages_on_recipient_id_and_recipient_type" - add_index "messages", ["sender_id", "sender_type"], :name => "index_messages_on_sender_id_and_sender_type" + add_index "messages", ["recipient_id", "recipient_type"], name: "index_messages_on_recipient_id_and_recipient_type", using: :btree + add_index "messages", ["sender_id", "sender_type"], name: "index_messages_on_sender_id_and_sender_type", using: :btree - create_table "movies", :force => true do |t| + create_table "movies", force: true do |t| t.string "name" t.string "content" t.string "format" @@ -515,30 +497,23 @@ ActiveRecord::Schema.define(:version => 20150820223313) do t.integer "category_id" end - add_index "movies", ["file_id"], :name => "index_movies_on_file_id" - add_index "movies", ["match_id"], :name => "index_movies_on_match_id" - add_index "movies", ["preview_id"], :name => "index_movies_on_preview_id" - add_index "movies", ["status"], :name => "index_movies_on_status" - add_index "movies", ["user_id"], :name => "index_movies_on_user_id" + add_index "movies", ["file_id"], name: "index_movies_on_file_id", using: :btree + add_index "movies", ["match_id"], name: "index_movies_on_match_id", using: :btree + add_index "movies", ["preview_id"], name: "index_movies_on_preview_id", using: :btree + add_index "movies", ["status"], name: "index_movies_on_status", using: :btree + add_index "movies", ["user_id"], name: "index_movies_on_user_id", using: :btree - create_table "nodes", :force => true do |t| - t.string "name" - t.integer "foreign_key" - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "options", :force => true do |t| + create_table "options", force: true do |t| t.string "option" t.integer "poll_id" t.datetime "created_at" t.datetime "updated_at" - t.integer "votes", :default => 0, :null => false + t.integer "votes", default: 0, null: false end - add_index "options", ["poll_id"], :name => "index_options_on_poll_id" + add_index "options", ["poll_id"], name: "index_options_on_poll_id", using: :btree - create_table "pcws", :force => true do |t| + create_table "pcws", force: true do |t| t.integer "team_id" t.integer "user_id" t.datetime "match_time" @@ -546,22 +521,22 @@ ActiveRecord::Schema.define(:version => 20150820223313) do t.datetime "updated_at" end - add_index "pcws", ["match_time"], :name => "index_pcws_on_match_time" - add_index "pcws", ["team_id"], :name => "index_pcws_on_team_id" - add_index "pcws", ["user_id"], :name => "index_pcws_on_user_id" + add_index "pcws", ["match_time"], name: "index_pcws_on_match_time", using: :btree + add_index "pcws", ["team_id"], name: "index_pcws_on_team_id", using: :btree + add_index "pcws", ["user_id"], name: "index_pcws_on_user_id", using: :btree - create_table "polls", :force => true do |t| + create_table "polls", force: true do |t| t.string "question" t.datetime "end_date" t.integer "user_id" t.datetime "created_at" t.datetime "updated_at" - t.integer "votes", :default => 0, :null => false + t.integer "votes", default: 0, null: false end - add_index "polls", ["user_id"], :name => "index_polls_on_user_id" + add_index "polls", ["user_id"], name: "index_polls_on_user_id", using: :btree - create_table "posts", :force => true do |t| + create_table "posts", force: true do |t| t.text "text" t.integer "topic_id" t.integer "user_id" @@ -570,10 +545,10 @@ ActiveRecord::Schema.define(:version => 20150820223313) do t.text "text_parsed" end - add_index "posts", ["topic_id"], :name => "index_posts_on_topic_id" - add_index "posts", ["user_id"], :name => "index_posts_on_user_id" + add_index "posts", ["topic_id"], name: "index_posts_on_topic_id", using: :btree + add_index "posts", ["user_id"], name: "index_posts_on_user_id", using: :btree - create_table "predictions", :force => true do |t| + create_table "predictions", force: true do |t| t.integer "match_id" t.integer "user_id" t.integer "score1" @@ -583,10 +558,10 @@ ActiveRecord::Schema.define(:version => 20150820223313) do t.integer "result" end - add_index "predictions", ["match_id"], :name => "index_predictions_on_match_id" - add_index "predictions", ["user_id"], :name => "index_predictions_on_user_id" + add_index "predictions", ["match_id"], name: "index_predictions_on_match_id", using: :btree + add_index "predictions", ["user_id"], name: "index_predictions_on_user_id", using: :btree - create_table "profiles", :force => true do |t| + create_table "profiles", force: true do |t| t.integer "user_id" t.string "msn" t.string "icq" @@ -631,34 +606,34 @@ ActiveRecord::Schema.define(:version => 20150820223313) do t.boolean "notify_gather" t.boolean "notify_own_match" t.boolean "notify_any_match" - t.boolean "notify_pms", :default => true, :null => false - t.boolean "notify_challenge", :default => true, :null => false + t.boolean "notify_pms", default: true, null: false + t.boolean "notify_challenge", default: true, null: false t.string "steam_profile" t.string "achievements_parsed" - t.string "signature_parsed" + t.text "signature_parsed" t.string "stream" t.string "layout" end - add_index "profiles", ["user_id"], :name => "index_profiles_on_user_id" + add_index "profiles", ["user_id"], name: "index_profiles_on_user_id", using: :btree - create_table "rates", :force => true do |t| + create_table "rates", force: true do |t| t.integer "score" end - create_table "ratings", :force => true do |t| + create_table "ratings", force: true do |t| t.integer "user_id" t.integer "rate_id" t.integer "rateable_id" - t.string "rateable_type", :limit => 32 + t.string "rateable_type", limit: 32 t.datetime "created_at" t.datetime "updated_at" end - add_index "ratings", ["rate_id"], :name => "index_ratings_on_rate_id" - add_index "ratings", ["rateable_id", "rateable_type"], :name => "index_ratings_on_rateable_id_and_rateable_type" + add_index "ratings", ["rate_id"], name: "index_ratings_on_rate_id", using: :btree + add_index "ratings", ["rateable_id", "rateable_type"], name: "index_ratings_on_rateable_id_and_rateable_type", using: :btree - create_table "readings", :force => true do |t| + create_table "readings", force: true do |t| t.string "readable_type" t.integer "readable_id" t.integer "user_id" @@ -666,11 +641,11 @@ ActiveRecord::Schema.define(:version => 20150820223313) do t.datetime "updated_at" end - add_index "readings", ["readable_type", "readable_id"], :name => "index_readings_on_readable_type_and_readable_id" - add_index "readings", ["user_id", "readable_id", "readable_type"], :name => "index_readings_on_user_id_and_readable_id_and_readable_type" - add_index "readings", ["user_id"], :name => "index_readings_on_user_id" + add_index "readings", ["readable_type", "readable_id"], name: "index_readings_on_readable_type_and_readable_id", using: :btree + add_index "readings", ["user_id", "readable_id", "readable_type"], name: "index_readings_on_user_id_and_readable_id_and_readable_type", using: :btree + add_index "readings", ["user_id"], name: "index_readings_on_user_id", using: :btree - create_table "rounders", :force => true do |t| + create_table "rounders", force: true do |t| t.integer "round_id" t.integer "user_id" t.integer "team" @@ -682,11 +657,11 @@ ActiveRecord::Schema.define(:version => 20150820223313) do t.integer "team_id" end - add_index "rounders", ["round_id"], :name => "index_rounders_on_round_id" - add_index "rounders", ["team_id"], :name => "index_rounders_on_team_id" - add_index "rounders", ["user_id"], :name => "index_rounders_on_user_id" + add_index "rounders", ["round_id"], name: "index_rounders_on_round_id", using: :btree + add_index "rounders", ["team_id"], name: "index_rounders_on_team_id", using: :btree + add_index "rounders", ["user_id"], name: "index_rounders_on_user_id", using: :btree - create_table "rounds", :force => true do |t| + create_table "rounds", force: true do |t| t.integer "server_id" t.datetime "start" t.datetime "end" @@ -699,14 +674,14 @@ ActiveRecord::Schema.define(:version => 20150820223313) do t.integer "map_id" end - add_index "rounds", ["commander_id"], :name => "index_rounds_on_commander_id" - add_index "rounds", ["map_id"], :name => "index_rounds_on_map_id" - add_index "rounds", ["match_id"], :name => "index_rounds_on_match_id" - add_index "rounds", ["server_id"], :name => "index_rounds_on_server_id" - add_index "rounds", ["team1_id"], :name => "index_rounds_on_team1_id" - add_index "rounds", ["team2_id"], :name => "index_rounds_on_team2_id" + add_index "rounds", ["commander_id"], name: "index_rounds_on_commander_id", using: :btree + add_index "rounds", ["map_id"], name: "index_rounds_on_map_id", using: :btree + add_index "rounds", ["match_id"], name: "index_rounds_on_match_id", using: :btree + add_index "rounds", ["server_id"], name: "index_rounds_on_server_id", using: :btree + add_index "rounds", ["team1_id"], name: "index_rounds_on_team1_id", using: :btree + add_index "rounds", ["team2_id"], name: "index_rounds_on_team2_id", using: :btree - create_table "server_versions", :force => true do |t| + create_table "server_versions", force: true do |t| t.integer "server_id" t.integer "version" t.datetime "created_at" @@ -717,9 +692,9 @@ ActiveRecord::Schema.define(:version => 20150820223313) do t.string "ping" end - add_index "server_versions", ["server_id"], :name => "index_server_versions_on_server_id" + add_index "server_versions", ["server_id"], name: "index_server_versions_on_server_id", using: :btree - create_table "servers", :force => true do |t| + create_table "servers", force: true do |t| t.string "name" t.string "description" t.string "dns" @@ -736,32 +711,32 @@ ActiveRecord::Schema.define(:version => 20150820223313) do t.integer "max_players" t.string "ping" t.integer "version" - t.integer "domain", :default => 0, :null => false + t.integer "domain", default: 0, null: false t.string "reservation" t.string "recording" t.datetime "idle" t.integer "default_id" - t.boolean "active", :default => true, :null => false + t.boolean "active", default: true, null: false t.string "recordable_type" t.integer "recordable_id" t.integer "category_id" end - add_index "servers", ["default_id"], :name => "index_servers_on_default_id" - add_index "servers", ["players", "domain"], :name => "index_servers_on_players_and_domain" - add_index "servers", ["user_id"], :name => "index_servers_on_user_id" + add_index "servers", ["default_id"], name: "index_servers_on_default_id", using: :btree + add_index "servers", ["players", "domain"], name: "index_servers_on_players_and_domain", using: :btree + add_index "servers", ["user_id"], name: "index_servers_on_user_id", using: :btree - create_table "sessions", :force => true do |t| - t.string "session_id", :null => false - t.text "data", :limit => 2147483647 + create_table "sessions", force: true do |t| + t.string "session_id", null: false + t.text "data", limit: 2147483647 t.datetime "created_at" t.datetime "updated_at" end - add_index "sessions", ["session_id"], :name => "index_sessions_on_session_id" - add_index "sessions", ["updated_at"], :name => "index_sessions_on_updated_at" + add_index "sessions", ["session_id"], name: "index_sessions_on_session_id", using: :btree + add_index "sessions", ["updated_at"], name: "index_sessions_on_updated_at", using: :btree - create_table "shoutmsgs", :force => true do |t| + create_table "shoutmsg_archive", force: true do |t| t.integer "user_id" t.string "text" t.datetime "created_at" @@ -770,10 +745,22 @@ ActiveRecord::Schema.define(:version => 20150820223313) do t.integer "shoutable_id" end - add_index "shoutmsgs", ["shoutable_type", "shoutable_id"], :name => "index_shoutmsgs_on_shoutable_type_and_shoutable_id" - add_index "shoutmsgs", ["user_id"], :name => "index_shoutmsgs_on_user_id" + add_index "shoutmsg_archive", ["shoutable_type", "shoutable_id"], name: "index_shoutmsgs_on_shoutable_type_and_shoutable_id", using: :btree + add_index "shoutmsg_archive", ["user_id"], name: "index_shoutmsgs_on_user_id", using: :btree - create_table "sites", :force => true do |t| + create_table "shoutmsgs", force: true do |t| + t.integer "user_id" + t.string "text" + t.datetime "created_at" + t.datetime "updated_at" + t.string "shoutable_type" + t.integer "shoutable_id" + end + + add_index "shoutmsgs", ["shoutable_type", "shoutable_id"], name: "index_shoutmsgs_on_shoutable_type_and_shoutable_id", using: :btree + add_index "shoutmsgs", ["user_id"], name: "index_shoutmsgs_on_user_id", using: :btree + + create_table "sites", force: true do |t| t.string "name" t.string "url" t.integer "category_id" @@ -782,22 +769,22 @@ ActiveRecord::Schema.define(:version => 20150820223313) do t.string "favicon" end - add_index "sites", ["category_id"], :name => "index_sites_on_category_id" - add_index "sites", ["created_at"], :name => "index_sites_on_created_at" + add_index "sites", ["category_id"], name: "index_sites_on_category_id", using: :btree + add_index "sites", ["created_at"], name: "index_sites_on_created_at", using: :btree - create_table "teamers", :force => true do |t| - t.integer "team_id", :null => false - t.integer "user_id", :null => false + create_table "teamers", force: true do |t| + t.integer "team_id", null: false + t.integer "user_id", null: false t.string "comment" - t.integer "rank", :null => false + t.integer "rank", null: false t.datetime "created_at" t.datetime "updated_at" end - add_index "teamers", ["team_id"], :name => "index_teamers_on_team_id" - add_index "teamers", ["user_id"], :name => "index_teamers_on_user_id" + add_index "teamers", ["team_id"], name: "index_teamers_on_team_id", using: :btree + add_index "teamers", ["user_id"], name: "index_teamers_on_user_id", using: :btree - create_table "teams", :force => true do |t| + create_table "teams", force: true do |t| t.string "name" t.string "irc" t.string "web" @@ -808,25 +795,26 @@ ActiveRecord::Schema.define(:version => 20150820223313) do t.datetime "updated_at" t.string "logo" t.integer "founder_id" - t.boolean "active", :default => true, :null => false + t.boolean "active", default: true, null: false t.string "recruiting" + t.integer "teamers_count" end - add_index "teams", ["founder_id"], :name => "index_teams_on_founder_id" + add_index "teams", ["founder_id"], name: "index_teams_on_founder_id", using: :btree - create_table "topics", :force => true do |t| + create_table "topics", force: true do |t| t.string "title" t.integer "user_id" t.integer "forum_id" t.datetime "created_at" t.datetime "updated_at" - t.integer "state", :default => 0, :null => false + t.integer "state", default: 0, null: false end - add_index "topics", ["forum_id"], :name => "index_topics_on_forum_id" - add_index "topics", ["user_id"], :name => "index_topics_on_user_id" + add_index "topics", ["forum_id"], name: "index_topics_on_forum_id", using: :btree + add_index "topics", ["user_id"], name: "index_topics_on_user_id", using: :btree - create_table "user_versions", :force => true do |t| + create_table "user_versions", force: true do |t| t.integer "user_id" t.integer "version" t.string "steamid" @@ -835,10 +823,10 @@ ActiveRecord::Schema.define(:version => 20150820223313) do t.datetime "updated_at" end - add_index "user_versions", ["steamid"], :name => "index_user_versions_on_steamid" - add_index "user_versions", ["user_id"], :name => "index_user_versions_on_user_id" + add_index "user_versions", ["steamid"], name: "index_user_versions_on_steamid", using: :btree + add_index "user_versions", ["user_id"], name: "index_user_versions_on_user_id", using: :btree - create_table "users", :force => true do |t| + create_table "users", force: true do |t| t.string "username" t.string "password" t.string "firstname" @@ -854,27 +842,24 @@ ActiveRecord::Schema.define(:version => 20150820223313) do t.date "birthdate" t.string "time_zone" t.integer "version" - t.boolean "public_email", :default => false, :null => false - t.string "salt" + t.boolean "public_email", default: false, null: false end - add_index "users", ["email"], :name => "index_users_on_email" - add_index "users", ["password"], :name => "index_users_on_password" - add_index "users", ["team_id"], :name => "index_users_on_team_id" - add_index "users", ["username"], :name => "index_users_on_username" + add_index "users", ["lastvisit"], name: "index_users_on_lastvisit", using: :btree + add_index "users", ["team_id"], name: "index_users_on_team_id", using: :btree - create_table "versions", :force => true do |t| - t.string "item_type", :null => false - t.integer "item_id", :null => false - t.string "event", :null => false + create_table "versions", force: true do |t| + t.string "item_type", null: false + t.integer "item_id", null: false + t.string "event", null: false t.string "whodunnit" t.text "object" t.datetime "created_at" end - add_index "versions", ["item_type", "item_id"], :name => "index_versions_on_item_type_and_item_id" + add_index "versions", ["item_type", "item_id"], name: "index_versions_on_item_type_and_item_id", using: :btree - create_table "view_counts", :force => true do |t| + create_table "view_counts", force: true do |t| t.integer "viewable_id" t.string "viewable_type" t.string "ip_address" @@ -882,29 +867,29 @@ ActiveRecord::Schema.define(:version => 20150820223313) do t.date "created_at" end - add_index "view_counts", ["viewable_type", "viewable_id"], :name => "index_view_counts_on_viewable_type_and_viewable_id" + add_index "view_counts", ["viewable_type", "viewable_id"], name: "index_view_counts_on_viewable_type_and_viewable_id", using: :btree - create_table "votes", :force => true do |t| + create_table "votes", force: true do |t| t.integer "user_id" t.integer "votable_id" t.integer "poll_id" t.string "votable_type" end - add_index "votes", ["user_id"], :name => "index_votes_on_user_id" - add_index "votes", ["votable_id", "votable_type"], :name => "index_votes_on_votable_id_and_votable_type" + add_index "votes", ["user_id"], name: "index_votes_on_user_id", using: :btree + add_index "votes", ["votable_id", "votable_type"], name: "index_votes_on_votable_id_and_votable_type", using: :btree - create_table "watchers", :force => true do |t| + create_table "watchers", force: true do |t| t.integer "user_id" t.integer "movie_id" - t.boolean "banned", :default => false, :null => false + t.boolean "banned", default: false, null: false t.datetime "updated_at" end - add_index "watchers", ["movie_id"], :name => "index_watchers_on_movie_id" - add_index "watchers", ["user_id"], :name => "index_watchers_on_user_id" + add_index "watchers", ["movie_id"], name: "index_watchers_on_movie_id", using: :btree + add_index "watchers", ["user_id"], name: "index_watchers_on_user_id", using: :btree - create_table "weeks", :force => true do |t| + create_table "weeks", force: true do |t| t.string "name" t.date "start_date" t.integer "contest_id" @@ -914,8 +899,8 @@ ActiveRecord::Schema.define(:version => 20150820223313) do t.datetime "updated_at" end - add_index "weeks", ["contest_id"], :name => "index_weeks_on_contest_id" - add_index "weeks", ["map1_id"], :name => "index_weeks_on_map1_id" - add_index "weeks", ["map2_id"], :name => "index_weeks_on_map2_id" + add_index "weeks", ["contest_id"], name: "index_weeks_on_contest_id", using: :btree + add_index "weeks", ["map1_id"], name: "index_weeks_on_map1_id", using: :btree + add_index "weeks", ["map2_id"], name: "index_weeks_on_map2_id", using: :btree end diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml new file mode 100644 index 0000000..14b280d --- /dev/null +++ b/docker-compose.dev.yml @@ -0,0 +1,34 @@ +version: "3" + +services: + web: + build: + context: ./ + dockerfile: Dockerfile.dev + args: + buildno: 1 + volumes: + - ".:/var/www/" + ports: + - "4000:4000" + links: + - db + - memcached + # - redis + db: + command: mysqld_safe --skip-grant-tables + image: mariadb:latest + volumes: + - "./db_data:/var/lib/mysql" + - "./ext/mysql.conf.d:/etc/mysql/conf.d" + environment: + - MYSQL_DATABASE + - MYSQL_USER + - MYSQL_USERNAME + - MYSQL_PASSWORD + - MYSQL_ROOT_PASSWORD + - MYSQL_ROOT_HOST + memcached: + image: memcached:latest + #redis: + # image: redis diff --git a/script/entry.sh b/script/entry.sh new file mode 100755 index 0000000..beff662 --- /dev/null +++ b/script/entry.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +cd /var/www +chown -R web:web /var/www + +su -c "bundle config github.https true; cd /var/www && bundle install --path /var/bundle --jobs 4" -s /bin/bash -l web +su -c "cd /var/www && source .env.dev && bundle exec puma -C config/puma.rb" -s /bin/bash -l web +bash