diff --git a/.ruby-version b/.ruby-version index 1f7da99d..be94e6f5 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.7.7 +3.2.2 diff --git a/Capfile b/Capfile index 51364d69..d0c09b6f 100644 --- a/Capfile +++ b/Capfile @@ -32,8 +32,6 @@ require 'capistrano/scm/git-with-submodules' install_plugin Capistrano::SCM::Git::WithSubmodules require 'capistrano3/unicorn' -# require 'capistrano/sidekiq/monit' #to require monit tasks (V0.2.0+) -require 'capistrano/sidekiq' require 'rollbar/capistrano3' require 'capistrano/sitemap_generator' diff --git a/Gemfile b/Gemfile index 9d98b4b9..4867069d 100644 --- a/Gemfile +++ b/Gemfile @@ -1,8 +1,8 @@ source 'https://rubygems.org' git_source(:github) { |repo| "https://github.com/#{repo}.git" } -ruby '2.7.7' +ruby '3.2.2' -gem 'rails', '~> 6.0' +gem 'rails', '~> 7.1' gem 'tyr', path: 'tyr' gem 'activerecord-postgis-adapter' @@ -26,7 +26,7 @@ group :development do # slack gem 'slackistrano', require: false - gem 'brakeman', '~> 4' + gem 'brakeman', '~> 6.0', '>= 6.0.1' gem 'http_logger' gem 'listen' gem 'rubocop' @@ -38,7 +38,7 @@ end group :development, :test do gem 'byebug' - gem 'factory_bot_rails' + gem 'factory_bot_rails', '~> 6.2.0' gem 'rspec' gem 'rspec-rails' end diff --git a/Gemfile.lock b/Gemfile.lock index 5bbf86b6..f3efe330 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -2,7 +2,7 @@ PATH remote: tyr specs: tyr (1.2.0) - activerecord-postgis-adapter (~> 6.0, >= 6.0.3) + activerecord-postgis-adapter (~> 9.0, >= 9.0.1) acts_as_list asset_sync attr_json @@ -54,13 +54,12 @@ PATH pundit (> 0) rack-cors rack-utf8_sanitizer (> 0) - rails (~> 6.0, >= 6.0.6.1) + rails (~> 7.1, >= 7.1.2) ransack (>= 2.4) recaptcha (> 0) redis rollbar sassc-rails - settingslogic (>= 2) sidekiq (< 8) sidekiq-limit_fetch (>= 4) sidekiq-scheduler (>= 4) @@ -80,64 +79,83 @@ PATH GEM remote: https://rubygems.org/ specs: - actioncable (6.0.6.1) - actionpack (= 6.0.6.1) + actioncable (7.1.2) + actionpack (= 7.1.2) + activesupport (= 7.1.2) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (6.0.6.1) - actionpack (= 6.0.6.1) - activejob (= 6.0.6.1) - activerecord (= 6.0.6.1) - activestorage (= 6.0.6.1) - activesupport (= 6.0.6.1) + zeitwerk (~> 2.6) + actionmailbox (7.1.2) + actionpack (= 7.1.2) + activejob (= 7.1.2) + activerecord (= 7.1.2) + activestorage (= 7.1.2) + activesupport (= 7.1.2) mail (>= 2.7.1) - actionmailer (6.0.6.1) - actionpack (= 6.0.6.1) - actionview (= 6.0.6.1) - activejob (= 6.0.6.1) + net-imap + net-pop + net-smtp + actionmailer (7.1.2) + actionpack (= 7.1.2) + actionview (= 7.1.2) + activejob (= 7.1.2) + activesupport (= 7.1.2) mail (~> 2.5, >= 2.5.4) - rails-dom-testing (~> 2.0) - actionpack (6.0.6.1) - actionview (= 6.0.6.1) - activesupport (= 6.0.6.1) - rack (~> 2.0, >= 2.0.8) + net-imap + net-pop + net-smtp + rails-dom-testing (~> 2.2) + actionpack (7.1.2) + actionview (= 7.1.2) + activesupport (= 7.1.2) + nokogiri (>= 1.8.5) + racc + rack (>= 2.2.4) + rack-session (>= 1.0.1) rack-test (>= 0.6.3) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (6.0.6.1) - actionpack (= 6.0.6.1) - activerecord (= 6.0.6.1) - activestorage (= 6.0.6.1) - activesupport (= 6.0.6.1) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6) + actiontext (7.1.2) + actionpack (= 7.1.2) + activerecord (= 7.1.2) + activestorage (= 7.1.2) + activesupport (= 7.1.2) + globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (6.0.6.1) - activesupport (= 6.0.6.1) + actionview (7.1.2) + activesupport (= 7.1.2) builder (~> 3.1) - erubi (~> 1.4) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.1, >= 1.2.0) - activejob (6.0.6.1) - activesupport (= 6.0.6.1) + erubi (~> 1.11) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6) + activejob (7.1.2) + activesupport (= 7.1.2) globalid (>= 0.3.6) - activemodel (6.0.6.1) - activesupport (= 6.0.6.1) - activerecord (6.0.6.1) - activemodel (= 6.0.6.1) - activesupport (= 6.0.6.1) - activerecord-postgis-adapter (6.0.3) - activerecord (~> 6.0.0) - rgeo-activerecord (~> 6.0) - activestorage (6.0.6.1) - actionpack (= 6.0.6.1) - activejob (= 6.0.6.1) - activerecord (= 6.0.6.1) + activemodel (7.1.2) + activesupport (= 7.1.2) + activerecord (7.1.2) + activemodel (= 7.1.2) + activesupport (= 7.1.2) + timeout (>= 0.4.0) + activerecord-postgis-adapter (9.0.1) + activerecord (~> 7.1.0) + rgeo-activerecord (~> 7.0.0) + activestorage (7.1.2) + actionpack (= 7.1.2) + activejob (= 7.1.2) + activerecord (= 7.1.2) + activesupport (= 7.1.2) marcel (~> 1.0) - activesupport (6.0.6.1) + activesupport (7.1.2) + base64 + bigdecimal concurrent-ruby (~> 1.0, >= 1.0.2) - i18n (>= 0.7, < 2) - minitest (~> 5.1) - tzinfo (~> 1.1) - zeitwerk (~> 2.2, >= 2.2.2) + connection_pool (>= 2.2.5) + drb + i18n (>= 1.6, < 2) + minitest (>= 5.1) + mutex_m + tzinfo (~> 2.0) acts_as_list (1.1.0) activerecord (>= 4.2) addressable (2.8.5) @@ -156,13 +174,13 @@ GEM attr_json (2.2.0) activerecord (>= 6.0.0, < 7.2) aws-eventstream (1.2.0) - aws-partitions (1.850.0) + aws-partitions (1.855.0) aws-record (2.13.0) aws-sdk-dynamodb (~> 1, >= 1.85.0) - aws-sdk-cloudfront (1.83.0) + aws-sdk-cloudfront (1.84.0) aws-sdk-core (~> 3, >= 3.184.0) aws-sigv4 (~> 1.1) - aws-sdk-core (3.186.0) + aws-sdk-core (3.187.1) aws-eventstream (~> 1, >= 1.0.2) aws-partitions (~> 1, >= 1.651.0) aws-sigv4 (~> 1.5) @@ -181,7 +199,7 @@ GEM aws-sessionstore-dynamodb (~> 2) concurrent-ruby (~> 1) railties (>= 5.2.0) - aws-sdk-s3 (1.136.0) + aws-sdk-s3 (1.138.0) aws-sdk-core (~> 3, >= 3.181.0) aws-sdk-kms (~> 1) aws-sigv4 (~> 1.6) @@ -203,8 +221,9 @@ GEM aws-sigv4 (1.6.1) aws-eventstream (~> 1, >= 1.0.2) base64 (0.2.0) - bcrypt (3.1.19) - brakeman (4.10.1) + bcrypt (3.1.20) + bigdecimal (3.1.4) + brakeman (6.0.1) breadcrumbs_on_rails (4.1.0) railties (>= 5.0) builder (3.2.4) @@ -283,7 +302,9 @@ GEM dotenv-rails (2.8.1) dotenv (= 2.8.1) railties (>= 3.2) - dry-core (1.0.0) + drb (2.2.0) + ruby2_keywords + dry-core (1.0.1) concurrent-ruby (~> 1.0) zeitwerk (~> 2.6) dry-inflector (1.0.0) @@ -312,7 +333,7 @@ GEM factory_bot_rails (6.2.0) factory_bot (~> 6.2.0) railties (>= 5.0.0) - faraday (2.7.11) + faraday (2.7.12) base64 faraday-net_http (>= 2.0, < 3.1) ruby2_keywords (>= 0.0.4) @@ -343,8 +364,8 @@ GEM et-orbi (~> 1, >= 1.2.7) raabro (~> 1.4) geocoder (1.8.2) - globalid (1.1.0) - activesupport (>= 5.0) + globalid (1.2.1) + activesupport (>= 6.1) google-authenticator-rails (3.3.1) actionpack activerecord @@ -367,6 +388,10 @@ GEM image_processing (1.12.2) mini_magick (>= 4.9.5, < 5) ruby-vips (>= 2.0.17, < 3) + io-console (0.6.0) + irb (1.9.1) + rdoc + reline (>= 0.3.8) jbuilder (2.11.5) actionview (>= 5.0.0) activesupport (>= 5.0.0) @@ -413,7 +438,6 @@ GEM marcel (1.0.2) meta-tags (2.19.0) actionpack (>= 3.2.0, < 7.2) - method_source (1.0.0) mime-types (3.5.1) mime-types-data (~> 3.2015) mime-types-data (3.2023.1003) @@ -426,10 +450,11 @@ GEM multipart-post (2.3.0) mustermann (3.0.0) ruby2_keywords (~> 0.0.1) + mutex_m (0.2.0) nested_form (0.3.2) net-http (0.4.0) uri - net-imap (0.4.5) + net-imap (0.4.6) date net-protocol net-pop (0.1.2) @@ -441,8 +466,8 @@ GEM net-smtp (0.4.0) net-protocol net-ssh (7.2.0) - nio4r (2.5.9) - nokogiri (1.15.4) + nio4r (2.6.1) + nokogiri (1.15.5) mini_portile2 (~> 2.8.2) racc (~> 1.4) oauth2 (2.0.9) @@ -476,8 +501,8 @@ GEM actionpack (>= 4.2) omniauth (~> 2.0) orm_adapter (0.5.0) - paper_trail (14.0.0) - activerecord (>= 6.0) + paper_trail (15.1.0) + activerecord (>= 6.1) request_store (~> 1.4) parallel (1.23.0) paranoia (2.6.3) @@ -487,7 +512,9 @@ GEM racc pg (1.5.4) phonelib (0.8.5) - public_suffix (5.0.3) + psych (5.1.1.1) + stringio + public_suffix (5.0.4) pundit (2.3.1) activesupport (>= 3.0.0) raabro (1.4.0) @@ -499,25 +526,29 @@ GEM rack (~> 2.2, >= 2.2.4) rack-proxy (0.7.7) rack + rack-session (1.0.1) + rack (< 3) rack-test (2.1.0) rack (>= 1.3) rack-utf8_sanitizer (1.9.1) rack (>= 1.0, < 4.0) - rails (6.0.6.1) - actioncable (= 6.0.6.1) - actionmailbox (= 6.0.6.1) - actionmailer (= 6.0.6.1) - actionpack (= 6.0.6.1) - actiontext (= 6.0.6.1) - actionview (= 6.0.6.1) - activejob (= 6.0.6.1) - activemodel (= 6.0.6.1) - activerecord (= 6.0.6.1) - activestorage (= 6.0.6.1) - activesupport (= 6.0.6.1) - bundler (>= 1.3.0) - railties (= 6.0.6.1) - sprockets-rails (>= 2.0.0) + rackup (1.0.0) + rack (< 3) + webrick + rails (7.1.2) + actioncable (= 7.1.2) + actionmailbox (= 7.1.2) + actionmailer (= 7.1.2) + actionpack (= 7.1.2) + actiontext (= 7.1.2) + actionview (= 7.1.2) + activejob (= 7.1.2) + activemodel (= 7.1.2) + activerecord (= 7.1.2) + activestorage (= 7.1.2) + activesupport (= 7.1.2) + bundler (>= 1.15.0) + railties (= 7.1.2) rails-dom-testing (2.2.0) activesupport (>= 5.0.0) minitest @@ -529,36 +560,42 @@ GEM json (>= 1.7, < 3) rails rubyzip (~> 2) - railties (6.0.6.1) - actionpack (= 6.0.6.1) - activesupport (= 6.0.6.1) - method_source - rake (>= 0.8.7) - thor (>= 0.20.3, < 2.0) + railties (7.1.2) + actionpack (= 7.1.2) + activesupport (= 7.1.2) + irb + rackup (>= 1.0.0) + rake (>= 12.2) + thor (~> 1.0, >= 1.2.2) + zeitwerk (~> 2.6) rainbow (3.1.1) raindrops (0.20.1) rake (13.1.0) - ransack (3.1.0) - activerecord (>= 6.0.4) - activesupport (>= 6.0.4) + ransack (4.1.1) + activerecord (>= 6.1.5) + activesupport (>= 6.1.5) i18n rb-fsevent (0.11.2) rb-inotify (0.10.1) ffi (~> 1.0) + rdoc (6.6.0) + psych (>= 4.0.0) recaptcha (5.16.0) redis (5.0.8) redis-client (>= 0.17.0) redis-client (0.18.0) connection_pool regexp_parser (2.8.2) + reline (0.4.0) + io-console (~> 0.5) request_store (1.5.1) rack (>= 1.4) responders (3.1.1) actionpack (>= 5.2) railties (>= 5.2) rexml (3.2.6) - rgeo (3.0.0) - rgeo-activerecord (6.2.2) + rgeo (3.0.1) + rgeo-activerecord (7.0.1) activerecord (>= 5.0) rgeo (>= 1.0.0) rollbar (3.4.1) @@ -579,14 +616,14 @@ GEM rspec-mocks (3.12.6) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.12.0) - rspec-rails (5.1.2) - actionpack (>= 5.2) - activesupport (>= 5.2) - railties (>= 5.2) - rspec-core (~> 3.10) - rspec-expectations (~> 3.10) - rspec-mocks (~> 3.10) - rspec-support (~> 3.10) + rspec-rails (6.1.0) + actionpack (>= 6.1) + activesupport (>= 6.1) + railties (>= 6.1) + rspec-core (~> 3.12) + rspec-expectations (~> 3.12) + rspec-mocks (~> 3.12) + rspec-support (~> 3.12) rspec-support (3.12.1) rubocop (1.57.2) json (~> 2.3) @@ -605,10 +642,11 @@ GEM rubocop (~> 1.41) rubocop-factory_bot (2.24.0) rubocop (~> 1.33) - rubocop-rails (2.22.1) + rubocop-rails (2.22.2) activesupport (>= 4.2.0) rack (>= 1.1) rubocop (>= 1.33.0, < 2.0) + rubocop-ast (>= 1.30.0, < 2.0) rubocop-rspec (2.25.0) rubocop (~> 1.40) rubocop-capybara (~> 2.17) @@ -630,7 +668,6 @@ GEM sprockets-rails tilt semantic_range (3.0.0) - settingslogic (2.0.9) sidekiq (7.2.0) concurrent-ruby (< 2) connection_pool (>= 2.3.0) @@ -672,10 +709,11 @@ GEM actionpack (>= 5.2) activesupport (>= 5.2) sprockets (>= 3.0.0) - sshkit (1.21.5) + sshkit (1.21.6) net-scp (>= 1.1.2) net-ssh (>= 2.8.0) ssrf_filter (1.1.2) + stringio (3.0.9) tappay (2.0.0) telegram-bot-ruby (1.0.0) dry-struct (~> 1.6) @@ -684,20 +722,19 @@ GEM zeitwerk (~> 2.6) temple (0.10.3) thor (1.3.0) - thread_safe (0.3.6) tilt (2.3.0) timecop (0.9.8) timeout (0.4.1) turnip (4.4.0) cuke_modeler (~> 3.15) rspec (>= 3.0, < 4.0) - tzinfo (1.2.11) - thread_safe (~> 0.1) + tzinfo (2.0.6) + concurrent-ruby (~> 1.0) uglifier (4.2.0) execjs (>= 0.3.0, < 3) unf (0.1.4) unf_ext - unf_ext (0.0.9) + unf_ext (0.0.9.1) unicode-display_width (2.5.0) unicorn (6.1.0) kgio (~> 2.6) @@ -715,6 +752,7 @@ GEM rack-proxy (>= 0.6.1) railties (>= 5.2) semantic_range (>= 2.3.0) + webrick (1.8.1) websocket-driver (0.7.6) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) @@ -729,7 +767,7 @@ PLATFORMS DEPENDENCIES activerecord-postgis-adapter annotate - brakeman (~> 4) + brakeman (~> 6.0, >= 6.0.1) byebug capistrano capistrano-bundler @@ -740,11 +778,11 @@ DEPENDENCIES capistrano-yarn capistrano3-unicorn database_cleaner - factory_bot_rails + factory_bot_rails (~> 6.2.0) http_logger listen pg - rails (~> 6.0) + rails (~> 7.1) rails_real_favicon rspec rspec-rails @@ -761,7 +799,7 @@ DEPENDENCIES webpacker (~> 5.4.4) RUBY VERSION - ruby 2.7.7p221 + ruby 3.2.2p53 BUNDLED WITH 2.4.21 diff --git a/Procfile.dev b/Procfile.dev index bd7b8cc5..5b03ac64 100644 --- a/Procfile.dev +++ b/Procfile.dev @@ -1,2 +1 @@ rails: bundle exec rails s -p 3000 -b 0.0.0.0 -webpacker: ./bin/webpack-dev-server diff --git a/app/contexts/fake_data_context.rb b/app/contexts/fake_data_context.rb index f091269d..252baecd 100644 --- a/app/contexts/fake_data_context.rb +++ b/app/contexts/fake_data_context.rb @@ -22,14 +22,14 @@ def create_users! def user_params(opts) { name: 'Haha', - password: password + password: }.merge(opts) end def create_admins! email = 'admin@5fpro.com' - @administrator = Administrator.find_by(email: email) || FactoryBot.create(:administrator, email: email, password: password) - @administrator.update(password: password, root: true) + @administrator = Administrator.find_by(email:) || FactoryBot.create(:administrator, email:, password:) + @administrator.update(password:, root: true) end end diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb index 83546b35..dd208247 100644 --- a/app/controllers/admin/users_controller.rb +++ b/app/controllers/admin/users_controller.rb @@ -10,7 +10,7 @@ class UsersController < ::Admin::BaseController before_action :add_instance_breadcrumb, only: [:show, :edit, :update] def index - @q = relation.ransack(params[search_key], search_key: search_key) + @q = relation.ransack(params[search_key], search_key:) @instances = @q.result.order(id: :desc).page(params[:page]).per(params[:per]) respond_with @instances, exporter: 'Admin::UserExporter', filename: "使用者資料-#{Time.current.to_i}" end diff --git a/app/controllers/api/base_controller.rb b/app/controllers/api/base_controller.rb index 6e11de20..1fee1644 100644 --- a/app/controllers/api/base_controller.rb +++ b/app/controllers/api/base_controller.rb @@ -3,7 +3,7 @@ class BaseController < Tyr::Api::BaseController skip_before_action :tyr_http_auth, raise: false def index - redirect_to 'https://api-doc.5fpro.com' + redirect_to 'https://api-doc.5fpro.com', allow_other_host: true end def error diff --git a/app/helpers/image_helper.rb b/app/helpers/image_helper.rb index 2f281dcc..60866c79 100644 --- a/app/helpers/image_helper.rb +++ b/app/helpers/image_helper.rb @@ -25,7 +25,7 @@ def cdn_image_tag(file_path, widths, options = {}) src: "https://#{cdn_host}#{dirname}/#{basename}-#{widths[0]}#{extname}", srcset: cdn_image_srcset("#{dirname}/#{basename}", widths, extname), webp_srcset: cdn_image_srcset(basename, widths, '.webp'), - options: options + options: } end diff --git a/app/mailers/application_mailer.rb b/app/mailers/application_mailer.rb index f16b0a43..9c195fdd 100644 --- a/app/mailers/application_mailer.rb +++ b/app/mailers/application_mailer.rb @@ -1,5 +1,5 @@ class ApplicationMailer < Tyr::ApplicationMailer def manual_send(to:, **options) - mail(to: to, **options) + mail(to:, **options) end end diff --git a/app/models/notification.rb b/app/models/notification.rb index 4c57c5fe..dc593923 100644 --- a/app/models/notification.rb +++ b/app/models/notification.rb @@ -7,8 +7,8 @@ # sender_id :string # receiver_type :string # receiver_id :string -# object_type :string -# object_id :string +# item_type :string +# item_id :string # notify_type :string # readed :boolean default(FALSE) # subject :string @@ -20,15 +20,15 @@ # # Indexes # -# index_notifications_on_body (body) USING gin -# index_notifications_on_created_on (created_on) -# index_notifications_on_data (data) USING gin -# index_notifications_on_notify_type (notify_type) -# index_notifications_on_object_type_and_object_id (object_type,object_id) -# index_notifications_on_readed_and_receiver_type_and_receiver_id (readed,receiver_type,receiver_id) -# index_notifications_on_receiver_type_and_receiver_id (receiver_type,receiver_id) -# index_notifications_on_sender_type_and_sender_id (sender_type,sender_id) -# index_notifications_on_subject (subject) USING gin +# idx_on_readed_receiver_type_receiver_id_1d93789c5c (readed,receiver_type,receiver_id) +# index_notifications_on_body (body) USING gin +# index_notifications_on_created_on (created_on) +# index_notifications_on_data (data) USING gin +# index_notifications_on_item_type_and_item_id (item_type,item_id) +# index_notifications_on_notify_type (notify_type) +# index_notifications_on_receiver_type_and_receiver_id (receiver_type,receiver_id) +# index_notifications_on_sender_type_and_sender_id (sender_type,sender_id) +# index_notifications_on_subject (subject) USING gin # class Notification < Tyr::Notification end diff --git a/app/views/layouts/application.html.slim b/app/views/layouts/application.html.slim index ddc1dca9..e2e04d57 100644 --- a/app/views/layouts/application.html.slim +++ b/app/views/layouts/application.html.slim @@ -6,7 +6,6 @@ html = stylesheet_pack_tag 'application', media: 'all', 'data-turbolinks-track': true /= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': true = javascript_include_tag 'application', defer: '', 'data-turbolinks-track': true - = javascript_pack_tag 'application', defer: '', 'data-turbolinks-track': true = csrf_meta_tags = csp_meta_tag body diff --git a/bin/rails b/bin/rails index 07396602..8ddffb33 100755 --- a/bin/rails +++ b/bin/rails @@ -1,4 +1,4 @@ #!/usr/bin/env ruby APP_PATH = File.expand_path('../config/application', __dir__) -require_relative '../config/boot' +require_relative "../config/boot" require 'rails/commands' diff --git a/bin/rake b/bin/rake index 17240489..d2c5375b 100755 --- a/bin/rake +++ b/bin/rake @@ -1,4 +1,4 @@ #!/usr/bin/env ruby -require_relative '../config/boot' +require_relative "../config/boot" require 'rake' Rake.application.run diff --git a/bin/yarn b/bin/yarn deleted file mode 100755 index 460dd565..00000000 --- a/bin/yarn +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env ruby -APP_ROOT = File.expand_path('..', __dir__) -Dir.chdir(APP_ROOT) do - begin - exec "yarnpkg", *ARGV - rescue Errno::ENOENT - $stderr.puts "Yarn executable was not detected in the system." - $stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install" - exit 1 - end -end diff --git a/config.ru b/config.ru index 9797be5a..ad1fbf29 100644 --- a/config.ru +++ b/config.ru @@ -1,4 +1,6 @@ # This file is used by Rack-based servers to start the application. -require ::File.expand_path('config/environment', __dir__) +require_relative 'config/environment' + run Rails.application +Rails.application.load_server diff --git a/config/application.rb b/config/application.rb index 115599f7..51a9de05 100644 --- a/config/application.rb +++ b/config/application.rb @@ -2,7 +2,6 @@ require 'rails' # require 'rails/all' -# Pick the frameworks you want: require 'active_record/railtie' require 'active_model/railtie' require 'action_controller/railtie' @@ -23,11 +22,19 @@ class Application < Rails::Application ::Tyr.init_requires! # Initialize configuration defaults for originally generated Rails version. - config.load_defaults 6.0 - - # Settings in config/environments/* take precedence over those specified here. - # Application configuration should go into files in config/initializers - # -- all .rb files in that directory are automatically loaded. + config.load_defaults 7.1 + + # Please, add to the `ignore` list any other `lib` subdirectories that do + # not contain `.rb` files, or that should not be reloaded or eager loaded. + # Common ones are `templates`, `generators`, or `middleware`, for example. + config.autoload_lib(ignore: %w[assets tasks]) + # Configuration for the application, engines, and railties goes here. + # + # These settings can be overridden in specific environments using the files + # in config/environments, which are processed later. + # + # config.time_zone = "Central Time (US & Canada)" + # config.eager_load_paths << Rails.root.join("extras") config.action_mailer.delivery_method = :aws_sdk diff --git a/config/application.yml.example b/config/application.yml.example index 4e9d5a20..fbcb98d5 100644 --- a/config/application.yml.example +++ b/config/application.yml.example @@ -15,7 +15,6 @@ defaults: &defaults keepalive: true username: password: - pool_size: 1 omniauth: providers: facebook: diff --git a/config/environments/development.rb b/config/environments/development.rb index 3eb7bd47..d7c7c05c 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -1,10 +1,13 @@ +require 'active_support/core_ext/integer/time' + Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # In the development environment your application's code is reloaded on - # every request. This slows down response time but is perfect for development + # In the development environment your application's code is reloaded any time + # it changes. This slows down response time but is perfect for development # since you don't have to restart the web server when you make code changes. - config.cache_classes = false + config.enable_reloading = true # Do not eager load code on boot. config.eager_load = false @@ -12,6 +15,9 @@ # Show full error reports. config.consider_all_requests_local = true # false for testing customize error pages + # Enable server timing + config.server_timing = true + # Enable/disable caching. By default caching is disabled. if Rails.root.join('tmp', 'caching-dev.txt').exist? config.action_controller.perform_caching = true @@ -35,13 +41,20 @@ # Print deprecation notices to the Rails logger. config.active_support.deprecation = :log + # Raise exceptions for disallowed deprecations. + config.active_support.disallowed_deprecation = :raise + + # Tell Active Support which deprecation messages to disallow. + config.active_support.disallowed_deprecation_warnings = [] + # Raise an error on page load if there are pending migrations. config.active_record.migration_error = :page_load - # Debug mode disables concatenation and preprocessing of assets. - # This option may cause significant delays in view rendering with a large - # number of complex assets. - config.assets.debug = true + # Highlight code that triggered database queries in logs. + config.active_record.verbose_query_logs = true + + # Highlight code that enqueued background job in logs. + config.active_job.verbose_enqueue_logs = true # Suppress logger output for asset requests. config.assets.quiet = true @@ -50,7 +63,15 @@ config.active_record.verbose_query_logs = true # Raises error for missing translations - # config.action_view.raise_on_missing_translations = true + # config.i18n.raise_on_missing_translations = true + + # Annotate rendered view with file names. + # config.action_view.annotate_rendered_view_with_filenames = true + + # Uncomment if you wish to allow Action Cable access from any origin. + # config.action_cable.disable_request_forgery_protection = true + # Raise error when a before_action's only/except options reference missing actions + config.action_controller.raise_on_missing_callback_actions = false # Use an evented file watcher to asynchronously detect changes in source code, # routes, locales, etc. This feature depends on the listen gem. diff --git a/config/environments/production.rb b/config/environments/production.rb index 8310c488..5a159128 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -1,8 +1,10 @@ +require 'active_support/core_ext/integer/time' + Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # Code is not reloaded between requests. - config.cache_classes = true + config.enable_reloading = false # Eager load code on boot. This eager loads most of Rails and # your application in memory, allowing both threaded web servers @@ -11,7 +13,7 @@ config.eager_load = true # Full error reports are disabled and caching is turned on. - config.consider_all_requests_local = false + config.consider_all_requests_local = false config.action_controller.perform_caching = true # Attempt to read encrypted secrets from `config/secrets.yml.enc`. @@ -19,9 +21,8 @@ # `config/secrets.yml.key`. config.read_encrypted_secrets = true - # Disable serving static files from the `/public` folder by default since - # Apache or NGINX already handles this. - config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present? + # Disable serving static files from `public/`, relying on NGINX/Apache to do so instead. + # config.public_file_server.enabled = false # Compress JavaScripts and CSS. # config.assets.js_compressor = :uglifier @@ -32,43 +33,65 @@ # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb + # Enable serving of images, stylesheets, and JavaScripts from an asset server. + # config.asset_host = "http://assets.example.com" + # Specifies the header that your server uses for sending files. - # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache - # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx + # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for Apache + # config.action_dispatch.x_sendfile_header = "X-Accel-Redirect" # for NGINX # Mount Action Cable outside main process or domain # config.action_cable.mount_path = nil - # config.action_cable.url = 'wss://example.com/cable' - # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ] + # config.action_cable.url = "wss://example.com/cable" + # config.action_cable.allowed_request_origins = [ "http://example.com", /http:\/\/example.*/ ] + + # Assume all access to the app is happening through a SSL-terminating reverse proxy. + # Can be used together with config.force_ssl for Strict-Transport-Security and secure cookies. + # config.assume_ssl = true # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. # config.force_ssl = true - # Use the lowest log level to ensure availability of diagnostic information - # when problems arise. - config.log_level = :info + # Log to STDOUT by default + config.logger = ActiveSupport::Logger.new($stdout) + .tap { |logger| logger.formatter = ::Logger::Formatter.new } + .then { |logger| ActiveSupport::TaggedLogging.new(logger) } # Prepend all log lines with the following tags. config.log_tags = [ :request_id ] - config.action_mailer.perform_caching = false + # Info include generic and useful information about system operation, but avoids logging too much + # information to avoid inadvertent exposure of personally identifiable information (PII). If you + # want to log everything, set the level to "debug". + config.log_level = ENV.fetch('RAILS_LOG_LEVEL', 'info') - # Send deprecation notices to registered listeners. - config.active_support.deprecation = :notify + # Use a different cache store in production. + # config.cache_store = :mem_cache_store - # Use default logging formatter so that PID and timestamp are not suppressed. - config.log_formatter = ::Logger::Formatter.new + # Use a real queuing backend for Active Job (and separate queues per environment) + # config.active_job.queue_adapter = :resque + # config.active_job.queue_name_prefix = "dummy_#{Rails.env}" + config.action_mailer.perform_caching = false + + # Ignore bad email addresses and do not raise email delivery errors. + # Set this to true and configure the email server for immediate delivery to raise delivery errors. + # config.action_mailer.raise_delivery_errors = false - # Use a different logger for distributed setups. - # require 'syslog/logger' - # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name') + # Enable locale fallbacks for I18n (makes lookups for any locale fall back to + # the I18n.default_locale when a translation cannot be found). + config.i18n.fallbacks = true - if ENV["RAILS_LOG_TO_STDOUT"].present? - logger = ActiveSupport::Logger.new(STDOUT) - logger.formatter = config.log_formatter - config.logger = ActiveSupport::TaggedLogging.new(logger) - end + # Don't log any deprecations. + config.active_support.report_deprecations = false # Do not dump schema after migrations. config.active_record.dump_schema_after_migration = false + + # Enable DNS rebinding protection and other `Host` header attacks. + # config.hosts = [ + # "example.com", # Allow requests from example.com + # /.*\.example\.com/ # Allow requests from subdomains like `www.example.com` + # ] + # Skip DNS rebinding protection for the default health check endpoint. + # config.host_authorization = { exclude: ->(request) { request.path == "/up" } } end diff --git a/config/environments/test.rb b/config/environments/test.rb index c97d0615..5f732e55 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -1,17 +1,16 @@ +require 'active_support/core_ext/integer/time' + Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. - # The test environment is used exclusively to run your application's - # test suite. You never need to work with it otherwise. Remember that - # your test database is "scratch space" for the test suite and is wiped - # and recreated between test runs. Don't rely on the data there! - config.cache_classes = false - config.action_view.cache_template_loading = true + # While tests run files are not watched, reloading is not necessary. + config.enable_reloading = false - # Do not eager load code on boot. This avoids loading your whole application - # just for the purpose of running a single test. If you are using a tool that - # preloads Rails for running tests, you may have to set it to true. - config.eager_load = false + # Eager loading loads your entire application. When running a single test locally, + # this is usually not necessary, and can slow down your test suite. However, it's + # recommended that you enable it in continuous integration systems to ensure eager + # loading is working properly before deploying your code. + config.eager_load = ENV['CI'].present? # Configure public file server for tests with Cache-Control for performance. config.public_file_server.enabled = true @@ -20,25 +19,37 @@ } # Show full error reports and disable caching. - config.consider_all_requests_local = false + config.consider_all_requests_local = true config.action_controller.perform_caching = false - config.cache_store = :null_store - # Raise exceptions instead of rendering exception templates. - config.action_dispatch.show_exceptions = false + # Render exception templates for rescuable exceptions and raise for other exceptions. + config.action_dispatch.show_exceptions = :rescuable # Disable request forgery protection in test environment. config.action_controller.allow_forgery_protection = false + + # Print deprecation notices to the stderr. + config.active_support.deprecation = :stderr + + # Raise exceptions for disallowed deprecations. + config.active_support.disallowed_deprecation = :raise + + # Tell Active Support which deprecation messages to disallow. + config.active_support.disallowed_deprecation_warnings = [] + + # Raises error for missing translations + # config.i18n.raise_on_missing_translations = true + + # Annotate rendered view with file names. + # config.action_view.annotate_rendered_view_with_filenames = true + + # Raise error when a before_action's only/except options reference missing actions + config.action_controller.raise_on_missing_callback_actions = false + config.action_mailer.perform_caching = false # Tell Action Mailer not to deliver emails to the real world. # The :test delivery method accumulates sent emails in the # ActionMailer::Base.deliveries array. config.action_mailer.delivery_method = :test - - # Print deprecation notices to the stderr. - config.active_support.deprecation = :stderr - - # Raises error for missing translations - config.action_view.raise_on_missing_translations = true end diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index dc94e57b..fe48fc34 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -3,10 +3,10 @@ # Version of your assets, change this if you want to expire all your assets. Rails.application.config.assets.version = '1.0' -# Add additional assets to the asset load path +# Add additional assets to the asset load path. # Rails.application.config.assets.paths << Emoji.images_path -Rails.application.config.assets.paths << Rails.root.join('node_modules') # Precompile additional assets. -# application.js, application.css, and all non-JS/CSS in app/assets folder are already added. -# Rails.application.config.assets.precompile += %w( admin.css admin.js ) +# application.js, application.css, and all non-JS/CSS in the app/assets +# folder are already added. +# Rails.application.config.assets.precompile += %w( admin.js admin.css ) diff --git a/config/initializers/backtrace_silencers.rb b/config/initializers/backtrace_silencers.rb deleted file mode 100644 index 59385cdf..00000000 --- a/config/initializers/backtrace_silencers.rb +++ /dev/null @@ -1,7 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. -# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } - -# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. -# Rails.backtrace_cleaner.remove_silencers! diff --git a/config/initializers/cookies_serializer.rb b/config/initializers/cookies_serializer.rb deleted file mode 100644 index 5a6a32d3..00000000 --- a/config/initializers/cookies_serializer.rb +++ /dev/null @@ -1,5 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# Specify a serializer for the signed and encrypted cookie jars. -# Valid options are :json, :marshal, and :hybrid. -Rails.application.config.action_dispatch.cookies_serializer = :json diff --git a/config/initializers/filter_parameter_logging.rb b/config/initializers/filter_parameter_logging.rb index 4a994e1e..c2d89e28 100644 --- a/config/initializers/filter_parameter_logging.rb +++ b/config/initializers/filter_parameter_logging.rb @@ -1,4 +1,8 @@ # Be sure to restart your server when you modify this file. -# Configure sensitive parameters which will be filtered from the log file. -Rails.application.config.filter_parameters += [:password] +# Configure parameters to be partially matched (e.g. passw matches password) and filtered from the log file. +# Use this to limit dissemination of sensitive information. +# See the ActiveSupport::ParameterFilter documentation for supported notations and behaviors. +Rails.application.config.filter_parameters += [ + :passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn +] diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb index ac033bf9..3860f659 100644 --- a/config/initializers/inflections.rb +++ b/config/initializers/inflections.rb @@ -4,13 +4,13 @@ # are locale specific, and you may define rules for as many different # locales as you wish. All of these examples are active by default: # ActiveSupport::Inflector.inflections(:en) do |inflect| -# inflect.plural /^(ox)$/i, '\1en' -# inflect.singular /^(ox)en/i, '\1' -# inflect.irregular 'person', 'people' +# inflect.plural /^(ox)$/i, "\\1en" +# inflect.singular /^(ox)en/i, "\\1" +# inflect.irregular "person", "people" # inflect.uncountable %w( fish sheep ) # end # These inflection rules are supported but not enabled by default: # ActiveSupport::Inflector.inflections(:en) do |inflect| -# inflect.acronym 'RESTful' +# inflect.acronym "RESTful" # end diff --git a/config/unicorn/production.rb b/config/unicorn/production.rb index ca7c54c9..421725ab 100644 --- a/config/unicorn/production.rb +++ b/config/unicorn/production.rb @@ -36,7 +36,7 @@ end old_pid = "#{server.config[:pid]}.oldbin" - if File.exists?(old_pid) && server.pid != old_pid + if File.exist?(old_pid) && server.pid != old_pid begin sig = (worker.nr + 1) >= server.worker_processes ? :QUIT : :TTOU Process.kill(sig, File.read(old_pid).to_i) @@ -50,5 +50,5 @@ if defined?(ActiveRecord::Base) ActiveRecord::Base.establish_connection end - Redis.current.client.reconnect + ::Tyr::Redis.reconnect end diff --git a/config/unicorn/staging.rb b/config/unicorn/staging.rb index e3951828..1cc7bdf7 100644 --- a/config/unicorn/staging.rb +++ b/config/unicorn/staging.rb @@ -36,7 +36,7 @@ end old_pid = "#{server.config[:pid]}.oldbin" - if File.exists?(old_pid) && server.pid != old_pid + if File.exist?(old_pid) && server.pid != old_pid begin sig = (worker.nr + 1) >= server.worker_processes ? :QUIT : :TTOU Process.kill(sig, File.read(old_pid).to_i) @@ -50,5 +50,5 @@ if defined?(ActiveRecord::Base) ActiveRecord::Base.establish_connection end - Redis.current.client.reconnect + ::Tyr::Redis.reconnect end diff --git a/db/migrate/20141117070551_enable_hstore.rb b/db/migrate/20141117070551_enable_hstore.rb index a47fdd64..8d07b5a3 100644 --- a/db/migrate/20141117070551_enable_hstore.rb +++ b/db/migrate/20141117070551_enable_hstore.rb @@ -1,4 +1,4 @@ -class EnableHstore < ActiveRecord::Migration[6.0] +class EnableHstore < ActiveRecord::Migration[7.1] def up execute 'CREATE EXTENSION hstore' end diff --git a/db/migrate/20141117070654_enabled_postgis.rb b/db/migrate/20141117070654_enabled_postgis.rb index c8f336f7..a2c9df6a 100644 --- a/db/migrate/20141117070654_enabled_postgis.rb +++ b/db/migrate/20141117070654_enabled_postgis.rb @@ -1,4 +1,4 @@ -class EnabledPostgis < ActiveRecord::Migration[6.0] +class EnabledPostgis < ActiveRecord::Migration[7.1] def change execute ' DROP EXTENSION IF EXISTS postgis CASCADE; diff --git a/db/migrate/20151025154533_acts_as_taggable_on_migration.rb b/db/migrate/20151025154533_acts_as_taggable_on_migration.rb index 0b3cecb4..8b05d31e 100644 --- a/db/migrate/20151025154533_acts_as_taggable_on_migration.rb +++ b/db/migrate/20151025154533_acts_as_taggable_on_migration.rb @@ -1,5 +1,5 @@ # This migration comes from acts_as_taggable_on_engine (originally 1) -class ActsAsTaggableOnMigration < ActiveRecord::Migration[6.0] +class ActsAsTaggableOnMigration < ActiveRecord::Migration[7.1] def up create_table :tags do |t| t.string :name diff --git a/db/migrate/20151025154534_add_missing_unique_indices.rb b/db/migrate/20151025154534_add_missing_unique_indices.rb index 606ba377..6e2c31e4 100644 --- a/db/migrate/20151025154534_add_missing_unique_indices.rb +++ b/db/migrate/20151025154534_add_missing_unique_indices.rb @@ -1,5 +1,5 @@ # This migration comes from acts_as_taggable_on_engine (originally 2) -class AddMissingUniqueIndices < ActiveRecord::Migration[6.0] +class AddMissingUniqueIndices < ActiveRecord::Migration[7.1] def up add_index :tags, :name, unique: true diff --git a/db/migrate/20151025154535_add_taggings_counter_cache_to_tags.rb b/db/migrate/20151025154535_add_taggings_counter_cache_to_tags.rb index 21f1d656..33c248de 100644 --- a/db/migrate/20151025154535_add_taggings_counter_cache_to_tags.rb +++ b/db/migrate/20151025154535_add_taggings_counter_cache_to_tags.rb @@ -1,5 +1,5 @@ # This migration comes from acts_as_taggable_on_engine (originally 3) -class AddTaggingsCounterCacheToTags < ActiveRecord::Migration[6.0] +class AddTaggingsCounterCacheToTags < ActiveRecord::Migration[7.1] def up add_column :tags, :taggings_count, :integer, default: 0 end diff --git a/db/migrate/20151025154536_add_missing_taggable_index.rb b/db/migrate/20151025154536_add_missing_taggable_index.rb index 3bde0dec..30724920 100644 --- a/db/migrate/20151025154536_add_missing_taggable_index.rb +++ b/db/migrate/20151025154536_add_missing_taggable_index.rb @@ -1,5 +1,5 @@ # This migration comes from acts_as_taggable_on_engine (originally 4) -class AddMissingTaggableIndex < ActiveRecord::Migration[6.0] +class AddMissingTaggableIndex < ActiveRecord::Migration[7.1] def up add_index :taggings, [:taggable_id, :taggable_type, :context] end diff --git a/db/migrate/20151106081428_create_versions.rb b/db/migrate/20151106081428_create_versions.rb index d5725f9d..877a57fa 100644 --- a/db/migrate/20151106081428_create_versions.rb +++ b/db/migrate/20151106081428_create_versions.rb @@ -1,4 +1,4 @@ -class CreateVersions < ActiveRecord::Migration[6.0] +class CreateVersions < ActiveRecord::Migration[7.1] # The largest text column available in all supported RDBMS is # 1024^3 - 1 bytes, roughly one gibibyte. We specify a size # so that MySQL will use `longtext` instead of `text`. Otherwise, diff --git a/db/migrate/20151216161107_create_authorizations.rb b/db/migrate/20151216161107_create_authorizations.rb index 18b0d646..15570399 100644 --- a/db/migrate/20151216161107_create_authorizations.rb +++ b/db/migrate/20151216161107_create_authorizations.rb @@ -1,4 +1,4 @@ -class CreateAuthorizations < ActiveRecord::Migration[6.0] +class CreateAuthorizations < ActiveRecord::Migration[7.1] def change create_table :authorizations do |t| t.integer :provider diff --git a/db/migrate/20170114020737_enable_extension_pg_trgm.rb b/db/migrate/20170114020737_enable_extension_pg_trgm.rb index 453b1a11..fbe7ead2 100644 --- a/db/migrate/20170114020737_enable_extension_pg_trgm.rb +++ b/db/migrate/20170114020737_enable_extension_pg_trgm.rb @@ -1,4 +1,4 @@ -class EnableExtensionPgTrgm < ActiveRecord::Migration[6.0] +class EnableExtensionPgTrgm < ActiveRecord::Migration[7.1] def up execute 'CREATE EXTENSION IF NOT EXISTS pg_trgm;' execute 'CREATE EXTENSION IF NOT EXISTS fuzzystrmatch;' diff --git a/db/migrate/20180101081005_create_administrators.rb b/db/migrate/20180101081005_create_administrators.rb index f2ac0ac2..341fa058 100644 --- a/db/migrate/20180101081005_create_administrators.rb +++ b/db/migrate/20180101081005_create_administrators.rb @@ -1,4 +1,4 @@ -class CreateAdministrators < ActiveRecord::Migration[6.0] +class CreateAdministrators < ActiveRecord::Migration[7.1] def change create_table :administrators do |t| t.string 'name' diff --git a/db/migrate/20180817000000_create_attachments.rb b/db/migrate/20180817000000_create_attachments.rb index 0d6152bb..dddb034e 100644 --- a/db/migrate/20180817000000_create_attachments.rb +++ b/db/migrate/20180817000000_create_attachments.rb @@ -1,4 +1,4 @@ -class CreateAttachments < ActiveRecord::Migration[6.0] +class CreateAttachments < ActiveRecord::Migration[7.1] def change create_table :attachments do |t| t.string :name diff --git a/db/migrate/20181211172111_create_activities.rb b/db/migrate/20181211172111_create_activities.rb index 4298741a..71ff7360 100644 --- a/db/migrate/20181211172111_create_activities.rb +++ b/db/migrate/20181211172111_create_activities.rb @@ -1,4 +1,4 @@ -class CreateActivities < ActiveRecord::Migration[6.0] +class CreateActivities < ActiveRecord::Migration[7.1] def change create_table :activities do |t| t.string :actor_type diff --git a/db/migrate/20190103234611_create_page_blocks.rb b/db/migrate/20190103234611_create_page_blocks.rb index ed34facb..afb5107a 100644 --- a/db/migrate/20190103234611_create_page_blocks.rb +++ b/db/migrate/20190103234611_create_page_blocks.rb @@ -1,4 +1,4 @@ -class CreatePageBlocks < ActiveRecord::Migration[6.0] +class CreatePageBlocks < ActiveRecord::Migration[7.1] def change create_table :page_blocks do |t| t.string :name diff --git a/db/migrate/20190111094312_create_event_logs.rb b/db/migrate/20190111094312_create_event_logs.rb index 247b3e3b..6497464d 100644 --- a/db/migrate/20190111094312_create_event_logs.rb +++ b/db/migrate/20190111094312_create_event_logs.rb @@ -1,4 +1,4 @@ -class CreateEventLogs < ActiveRecord::Migration[6.0] +class CreateEventLogs < ActiveRecord::Migration[7.1] def change create_table :event_logs do |t| t.string :event_type diff --git a/db/migrate/20190120085613_create_notifications.rb b/db/migrate/20190120085613_create_notifications.rb index d7ade6b8..e37f1ee1 100644 --- a/db/migrate/20190120085613_create_notifications.rb +++ b/db/migrate/20190120085613_create_notifications.rb @@ -1,12 +1,12 @@ -class CreateNotifications < ActiveRecord::Migration[6.0] +class CreateNotifications < ActiveRecord::Migration[7.1] def change create_table :notifications do |t| t.string :sender_type t.string :sender_id t.string :receiver_type t.string :receiver_id - t.string :object_type - t.string :object_id + t.string :item_type + t.string :item_id t.string :notify_type t.boolean :readed, default: false t.string :subject @@ -18,7 +18,7 @@ def change add_index :notifications, :notify_type add_index :notifications, [:sender_type, :sender_id] add_index :notifications, [:receiver_type, :receiver_id] - add_index :notifications, [:object_type, :object_id] + add_index :notifications, [:item_type, :item_id] add_index :notifications, [:readed, :receiver_type, :receiver_id] add_index :notifications, :created_on add_index :notifications, :data, using: :gin diff --git a/db/migrate/20190517085614_create_articles.rb b/db/migrate/20190517085614_create_articles.rb index 3193f344..1dd0b10c 100644 --- a/db/migrate/20190517085614_create_articles.rb +++ b/db/migrate/20190517085614_create_articles.rb @@ -1,4 +1,4 @@ -class CreateArticles < ActiveRecord::Migration[6.0] +class CreateArticles < ActiveRecord::Migration[7.1] def change create_table :articles do |t| t.string :layout, comment: '版位' diff --git a/db/migrate/20191103085615_create_pageviews.rb b/db/migrate/20191103085615_create_pageviews.rb index a4fc5322..cc0c2b76 100644 --- a/db/migrate/20191103085615_create_pageviews.rb +++ b/db/migrate/20191103085615_create_pageviews.rb @@ -1,4 +1,4 @@ -class CreatePageviews < ActiveRecord::Migration[6.0] +class CreatePageviews < ActiveRecord::Migration[7.1] def change create_table :pageviews do |t| t.string :scope, comment: '範圍' diff --git a/db/migrate/20200422110410_create_webpages.rb b/db/migrate/20200422110410_create_webpages.rb index adb1fd4c..8ca8d9db 100644 --- a/db/migrate/20200422110410_create_webpages.rb +++ b/db/migrate/20200422110410_create_webpages.rb @@ -1,4 +1,4 @@ -class CreateWebpages < ActiveRecord::Migration[6.0] +class CreateWebpages < ActiveRecord::Migration[7.1] def change create_table :webpages do |t| t.boolean :enabled, default: false diff --git a/db/migrate/20210105110411_create_article_category_mapping.rb b/db/migrate/20210105110411_create_article_category_mapping.rb index 06499d93..b2f1e1c3 100644 --- a/db/migrate/20210105110411_create_article_category_mapping.rb +++ b/db/migrate/20210105110411_create_article_category_mapping.rb @@ -1,4 +1,4 @@ -class CreateArticleCategoryMapping < ActiveRecord::Migration[6.0] +class CreateArticleCategoryMapping < ActiveRecord::Migration[7.1] def change create_table :article_category_mappings do |t| t.integer :article_category_id, comment: '文章分類' diff --git a/db/migrate/20210214110413_create_roles.rb b/db/migrate/20210214110413_create_roles.rb index cf0ffcbb..1a79fc22 100644 --- a/db/migrate/20210214110413_create_roles.rb +++ b/db/migrate/20210214110413_create_roles.rb @@ -1,4 +1,4 @@ -class CreateRoles < ActiveRecord::Migration[6.0] +class CreateRoles < ActiveRecord::Migration[7.1] def up create_table :roles do |t| t.string :scope, comment: '區隔' diff --git a/db/migrate/20210811110414_create_catalogs.rb b/db/migrate/20210811110414_create_catalogs.rb index 225917c7..61ed05f7 100644 --- a/db/migrate/20210811110414_create_catalogs.rb +++ b/db/migrate/20210811110414_create_catalogs.rb @@ -1,4 +1,4 @@ -class CreateCatalogs < ActiveRecord::Migration[6.0] +class CreateCatalogs < ActiveRecord::Migration[7.1] def up create_table :catalogs do |t| t.string :layout diff --git a/db/migrate/20220615110417_create_amoebas.rb b/db/migrate/20220615110417_create_amoebas.rb index 8e517c6b..4a49dc04 100644 --- a/db/migrate/20220615110417_create_amoebas.rb +++ b/db/migrate/20220615110417_create_amoebas.rb @@ -1,4 +1,4 @@ -class CreateAmoebas < ActiveRecord::Migration[6.0] +class CreateAmoebas < ActiveRecord::Migration[7.1] def up create_table :amoebas do |t| t.string :layout @@ -14,8 +14,8 @@ def up t.boolean :boolean, default: false t.string :people_type t.integer :people_id - t.string :object_type - t.integer :object_id + t.string :item_type + t.integer :item_id t.string :context_type t.integer :context_id t.text :configuration @@ -29,7 +29,7 @@ def up add_index :amoebas, :boolean add_index :amoebas, :layout add_index :amoebas, [:people_type, :people_id] - add_index :amoebas, [:object_type, :object_id] + add_index :amoebas, [:item_type, :item_id] add_index :amoebas, [:context_type, :context_id] add_index :amoebas, [:sort, :enabled] add_index :amoebas, :sort diff --git a/db/migrate/20230814110421_create_mylists.rb b/db/migrate/20230814110421_create_mylists.rb index 75a6ab12..89fcfa34 100644 --- a/db/migrate/20230814110421_create_mylists.rb +++ b/db/migrate/20230814110421_create_mylists.rb @@ -1,4 +1,4 @@ -class CreateMylists < ActiveRecord::Migration[6.0] +class CreateMylists < ActiveRecord::Migration[7.1] def up create_table :mylists do |t| t.string :layout diff --git a/db/migrate/20230918110422_create_numeros.rb b/db/migrate/20230918110422_create_numeros.rb index 1f31234d..b180a703 100644 --- a/db/migrate/20230918110422_create_numeros.rb +++ b/db/migrate/20230918110422_create_numeros.rb @@ -1,4 +1,4 @@ -class CreateNumeros < ActiveRecord::Migration[6.0] +class CreateNumeros < ActiveRecord::Migration[7.1] def up create_table :numeros do |t| t.string :layout diff --git a/db/migrate/20230918110424_create_background_tasks.rb b/db/migrate/20230918110424_create_background_tasks.rb new file mode 100644 index 00000000..5b6693b3 --- /dev/null +++ b/db/migrate/20230918110424_create_background_tasks.rb @@ -0,0 +1,46 @@ +class CreateBackgroundTasks < ActiveRecord::Migration[7.1] + def up + create_table :background_tasks do |t| + t.string :context_type + t.integer :context_id + t.string :creator_type + t.integer :creator_id + t.integer :task_type, default: 0 + t.string :file_encoding, default: 'UTF-8' + t.string :download_url + t.string :download_file_name + t.integer :status, default: 0 + t.boolean :has_error, default: false + t.string :perform_klass + t.string :perform_method + t.jsonb :perform_data, default: {} + t.string :job_identity + t.datetime :processing_at + t.datetime :finished_at + t.jsonb :on_success, default: {} + t.jsonb :on_fail, default: {} + t.jsonb :result_data, default: {} + t.jsonb :error_data, default: {} + t.jsonb :data, default: {} + t.timestamps + end + add_index :background_tasks, [:context_type, :context_id] + add_index :background_tasks, [:creator_type, :creator_id] + add_index :background_tasks, :task_type + add_index :background_tasks, :status + add_index :background_tasks, [:context_type, :context_id, :status], name: 'index_bt_on_context_and_status' + add_index :background_tasks, :has_error + add_index :background_tasks, [:status, :job_identity] + add_index :background_tasks, [:context_type, :context_id, :status, :job_identity], name: 'index_bt_on_context_and_status_and_job_identity' + add_index :background_tasks, :result_data, using: :gin + add_index :background_tasks, :error_data, using: :gin + add_index :background_tasks, :data, using: :gin + add_index :background_tasks, :on_fail, using: :gin + add_index :background_tasks, :on_success, using: :gin + add_index :background_tasks, :perform_data, using: :gin + end + + def down + drop_table :background_tasks + end +end diff --git a/db/migrate/20231117072407_devise_create_users.rb b/db/migrate/20231117072407_devise_create_users.rb index 9ee78881..746fce4b 100644 --- a/db/migrate/20231117072407_devise_create_users.rb +++ b/db/migrate/20231117072407_devise_create_users.rb @@ -1,4 +1,4 @@ -class DeviseCreateUsers < ActiveRecord::Migration[6.0] +class DeviseCreateUsers < ActiveRecord::Migration[7.1] def up create_table(:users) do |t| ## Database authenticatable diff --git a/db/schema.rb b/db/schema.rb index 79556f35..ef82c89a 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -2,15 +2,16 @@ # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. # -# This file is the source Rails uses to define your schema when running `rails -# db:schema:load`. When creating a new database, `rails db:schema:load` tends to +# This file is the source Rails uses to define your schema when running `bin/rails +# db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to # be faster and is potentially less error prone than running all of your # migrations from scratch. Old migrations may fail to apply correctly if those # migrations use external dependencies or application code. # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2023_11_17_072407) do +ActiveRecord::Schema[7.1].define(version: 2023_11_17_072407) do + create_schema "postgis" # These are extensions that must be enabled in order to support this database enable_extension "btree_gin" @@ -29,8 +30,8 @@ t.integer "target_id" t.date "acted_on" t.jsonb "data", default: {} - t.datetime "created_at", precision: 6, null: false - t.datetime "updated_at", precision: 6, null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false t.index ["acted_on"], name: "index_activities_on_acted_on" t.index ["action"], name: "index_activities_on_action" t.index ["actor_type", "actor_id"], name: "index_activities_on_actor_type_and_actor_id" @@ -58,8 +59,8 @@ t.string "mfa_token" t.string "mfa_secret" t.jsonb "data", default: {} - t.datetime "created_at", precision: 6, null: false - t.datetime "updated_at", precision: 6, null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false t.index ["confirmation_token"], name: "index_administrators_on_confirmation_token", unique: true t.index ["email"], name: "index_administrators_on_email", unique: true t.index ["reset_password_token"], name: "index_administrators_on_reset_password_token", unique: true @@ -79,20 +80,20 @@ t.boolean "boolean", default: false t.string "people_type" t.integer "people_id" - t.string "object_type" - t.integer "object_id" + t.string "item_type" + t.integer "item_id" t.string "context_type" t.integer "context_id" t.text "configuration" - t.datetime "created_at", precision: 6, null: false - t.datetime "updated_at", precision: 6, null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false t.index ["boolean"], name: "index_amoebas_on_boolean" t.index ["context_type", "context_id"], name: "index_amoebas_on_context_type_and_context_id" t.index ["data"], name: "index_amoebas_on_data", using: :gin t.index ["date"], name: "index_amoebas_on_date" t.index ["integer"], name: "index_amoebas_on_integer" + t.index ["item_type", "item_id"], name: "index_amoebas_on_item_type_and_item_id" t.index ["layout"], name: "index_amoebas_on_layout" - t.index ["object_type", "object_id"], name: "index_amoebas_on_object_type_and_object_id" t.index ["people_type", "people_id"], name: "index_amoebas_on_people_type_and_people_id" t.index ["sort", "enabled"], name: "index_amoebas_on_sort_and_enabled" t.index ["sort"], name: "index_amoebas_on_sort" @@ -110,8 +111,8 @@ t.integer "articles_count", default: 0, comment: "文章數" t.datetime "deleted_at" t.jsonb "data", default: {} - t.datetime "created_at", precision: 6, null: false - t.datetime "updated_at", precision: 6, null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false t.index ["data"], name: "index_article_categories_on_data", using: :gin t.index ["layout", "deep"], name: "index_article_categories_on_layout_and_deep" t.index ["layout", "enabled", "sort"], name: "index_article_categories_on_layout_and_enabled_and_sort" @@ -128,8 +129,8 @@ t.integer "sort", default: 999 t.string "layout" t.jsonb "data", default: {} - t.datetime "created_at", precision: 6, null: false - t.datetime "updated_at", precision: 6, null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false t.index ["article_category_id", "article_id"], name: "tyr_article_categoy_mapping_idx" t.index ["article_category_id"], name: "index_article_category_mappings_on_article_category_id" t.index ["article_id"], name: "index_article_category_mappings_on_article_id" @@ -158,8 +159,8 @@ t.datetime "deleted_at" t.datetime "modified_at" t.jsonb "data", default: {} - t.datetime "created_at", precision: 6, null: false - t.datetime "updated_at", precision: 6, null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false t.index ["author_name"], name: "index_articles_on_author_name", opclass: :gin_trgm_ops, using: :gin t.index ["body"], name: "index_articles_on_body", opclass: :gin_trgm_ops, using: :gin t.index ["data"], name: "index_articles_on_data", using: :gin @@ -192,8 +193,8 @@ t.integer "image_height" t.jsonb "image_exif", default: {} t.jsonb "data", default: {} - t.datetime "created_at", precision: 6, null: false - t.datetime "updated_at", precision: 6, null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false t.index ["creator_type", "creator_id"], name: "index_attachments_on_creator_type_and_creator_id" t.index ["data"], name: "index_attachments_on_data", using: :gin t.index ["description"], name: "index_attachments_on_description", opclass: :gin_trgm_ops, using: :gin @@ -211,8 +212,8 @@ t.integer "auth_id" t.jsonb "auth_data", default: {} t.jsonb "data", default: {} - t.datetime "created_at", precision: 6, null: false - t.datetime "updated_at", precision: 6, null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false t.index ["auth_data"], name: "index_authorizations_on_auth_data", using: :gin t.index ["auth_type", "auth_id", "provider"], name: "index_authorizations_on_auth_type_and_auth_id_and_provider" t.index ["auth_type", "auth_id"], name: "index_authorizations_on_auth_type_and_auth_id" @@ -220,6 +221,46 @@ t.index ["provider", "uid"], name: "index_authorizations_on_provider_and_uid" end + create_table "background_tasks", force: :cascade do |t| + t.string "context_type" + t.integer "context_id" + t.string "creator_type" + t.integer "creator_id" + t.integer "task_type", default: 0 + t.string "file_encoding", default: "UTF-8" + t.string "download_url" + t.string "download_file_name" + t.integer "status", default: 0 + t.boolean "has_error", default: false + t.string "perform_klass" + t.string "perform_method" + t.jsonb "perform_data", default: {} + t.string "job_identity" + t.datetime "processing_at" + t.datetime "finished_at" + t.jsonb "on_success", default: {} + t.jsonb "on_fail", default: {} + t.jsonb "result_data", default: {} + t.jsonb "error_data", default: {} + t.jsonb "data", default: {} + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["context_type", "context_id", "status", "job_identity"], name: "index_bt_on_context_and_status_and_job_identity" + t.index ["context_type", "context_id", "status"], name: "index_bt_on_context_and_status" + t.index ["context_type", "context_id"], name: "index_background_tasks_on_context_type_and_context_id" + t.index ["creator_type", "creator_id"], name: "index_background_tasks_on_creator_type_and_creator_id" + t.index ["data"], name: "index_background_tasks_on_data", using: :gin + t.index ["error_data"], name: "index_background_tasks_on_error_data", using: :gin + t.index ["has_error"], name: "index_background_tasks_on_has_error" + t.index ["on_fail"], name: "index_background_tasks_on_on_fail", using: :gin + t.index ["on_success"], name: "index_background_tasks_on_on_success", using: :gin + t.index ["perform_data"], name: "index_background_tasks_on_perform_data", using: :gin + t.index ["result_data"], name: "index_background_tasks_on_result_data", using: :gin + t.index ["status", "job_identity"], name: "index_background_tasks_on_status_and_job_identity" + t.index ["status"], name: "index_background_tasks_on_status" + t.index ["task_type"], name: "index_background_tasks_on_task_type" + end + create_table "catalog_items", force: :cascade do |t| t.string "layout" t.integer "catalog_id" @@ -228,8 +269,8 @@ t.integer "sort" t.integer "context_id" t.jsonb "data", default: {} - t.datetime "created_at", precision: 6, null: false - t.datetime "updated_at", precision: 6, null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false t.index ["catalog_id"], name: "index_catalog_items_on_catalog_id" t.index ["context_id", "catalog_id"], name: "index_catalog_items_on_context_id_and_catalog_id" t.index ["context_id", "item_id", "item_type", "catalog_id"], name: "index_catalog_items_on_context_id_and_item_and_and_catalog_id" @@ -254,8 +295,8 @@ t.integer "context_id" t.integer "creator_id" t.jsonb "data", default: {} - t.datetime "created_at", precision: 6, null: false - t.datetime "updated_at", precision: 6, null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false t.index ["data"], name: "index_catalogs_on_data", using: :gin t.index ["layout", "context_id"], name: "index_catalogs_on_layout_and_context_id" t.index ["layout", "creator_id"], name: "index_catalogs_on_layout_and_creator_id" @@ -275,8 +316,8 @@ t.string "identity" t.date "created_on" t.jsonb "data", default: {} - t.datetime "created_at", precision: 6, null: false - t.datetime "updated_at", precision: 6, null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false t.index ["created_on"], name: "index_event_logs_on_created_on" t.index ["data"], name: "index_event_logs_on_data", using: :gin t.index ["event_type", "identity"], name: "index_event_logs_on_event_type_and_identity" @@ -296,8 +337,8 @@ t.date "created_on" t.jsonb "item_data", default: {} t.jsonb "data", default: {} - t.datetime "created_at", precision: 6, null: false - t.datetime "updated_at", precision: 6, null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false t.index ["context_id", "created_on"], name: "index_mylists_on_context_id_and_created_on" t.index ["context_id"], name: "index_mylists_on_context_id" t.index ["created_on"], name: "index_mylists_on_created_on" @@ -321,22 +362,22 @@ t.string "sender_id" t.string "receiver_type" t.string "receiver_id" - t.string "object_type" - t.string "object_id" + t.string "item_type" + t.string "item_id" t.string "notify_type" t.boolean "readed", default: false t.string "subject" t.string "body" t.date "created_on" t.jsonb "data", default: {} - t.datetime "created_at", precision: 6, null: false - t.datetime "updated_at", precision: 6, null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false t.index ["body"], name: "index_notifications_on_body", opclass: :gin_trgm_ops, using: :gin t.index ["created_on"], name: "index_notifications_on_created_on" t.index ["data"], name: "index_notifications_on_data", using: :gin + t.index ["item_type", "item_id"], name: "index_notifications_on_item_type_and_item_id" t.index ["notify_type"], name: "index_notifications_on_notify_type" - t.index ["object_type", "object_id"], name: "index_notifications_on_object_type_and_object_id" - t.index ["readed", "receiver_type", "receiver_id"], name: "index_notifications_on_readed_and_receiver_type_and_receiver_id" + t.index ["readed", "receiver_type", "receiver_id"], name: "idx_on_readed_receiver_type_receiver_id_1d93789c5c" t.index ["receiver_type", "receiver_id"], name: "index_notifications_on_receiver_type_and_receiver_id" t.index ["sender_type", "sender_id"], name: "index_notifications_on_sender_type_and_sender_id" t.index ["subject"], name: "index_notifications_on_subject", opclass: :gin_trgm_ops, using: :gin @@ -365,8 +406,8 @@ t.integer "hour" t.string "note" t.jsonb "data", default: {} - t.datetime "created_at", precision: 6, null: false - t.datetime "updated_at", precision: 6, null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false t.index ["data"], name: "index_numeros_on_data", using: :gin t.index ["layout", "catalog_id"], name: "index_numeros_on_layout_and_catalog_id" t.index ["layout", "context_type", "context_id", "catalog_id"], name: "idx_numeros_on_lc_and_catalog" @@ -404,48 +445,6 @@ t.index ["subject_data"], name: "index_numeros_on_subject_data", using: :gin end - create_table "orders", force: :cascade do |t| - t.string "layout" - t.string "sn" - t.string "user_type" - t.integer "user_id" - t.string "creator_type" - t.integer "creator_id" - t.string "currency" - t.decimal "total_amount" - t.integer "state" - t.integer "payment_state" - t.string "context_type" - t.integer "context_id" - t.text "for_text_search" - t.date "created_on" - t.jsonb "data", default: {} - t.datetime "created_at", precision: 6, null: false - t.datetime "updated_at", precision: 6, null: false - t.index ["context_type", "context_id", "sn"], name: "index_orders_on_context_type_and_context_id_and_sn" - t.index ["created_on", "context_id", "context_type"], name: "index_orders_on_created_on_and_context_id_and_context_type" - t.index ["created_on", "layout"], name: "index_orders_on_created_on_and_layout" - t.index ["created_on"], name: "index_orders_on_created_on" - t.index ["creator_type", "creator_id", "context_id", "context_type"], name: "index_orders_on_creator_and_context" - t.index ["creator_type", "creator_id", "layout"], name: "index_orders_on_creator_type_and_creator_id_and_layout" - t.index ["creator_type", "creator_id"], name: "index_orders_on_creator_type_and_creator_id" - t.index ["data", "context_id", "context_type"], name: "index_orders_on_data_and_context_id_and_context_type", using: :gin - t.index ["data", "layout"], name: "index_orders_on_data_and_layout", using: :gin - t.index ["data"], name: "index_orders_on_data", using: :gin - t.index ["for_text_search"], name: "index_orders_on_for_text_search", opclass: :gin_trgm_ops, using: :gin - t.index ["layout", "sn"], name: "index_orders_on_layout_and_sn" - t.index ["payment_state", "context_id", "context_type"], name: "index_orders_on_payment_state_and_context_id_and_context_type" - t.index ["payment_state", "layout"], name: "index_orders_on_payment_state_and_layout" - t.index ["payment_state"], name: "index_orders_on_payment_state" - t.index ["sn"], name: "index_orders_on_sn" - t.index ["state", "context_id", "context_type"], name: "index_orders_on_state_and_context_id_and_context_type" - t.index ["state", "layout"], name: "index_orders_on_state_and_layout" - t.index ["state"], name: "index_orders_on_state" - t.index ["user_type", "user_id", "context_id", "context_type"], name: "index_orders_on_user_and_context" - t.index ["user_type", "user_id", "layout"], name: "index_orders_on_user_type_and_user_id_and_layout" - t.index ["user_type", "user_id"], name: "index_orders_on_user_type_and_user_id" - end - create_table "page_blocks", force: :cascade do |t| t.string "name" t.text "body" @@ -453,8 +452,8 @@ t.string "template_engine" t.text "variables" t.jsonb "data", default: {} - t.datetime "created_at", precision: 6, null: false - t.datetime "updated_at", precision: 6, null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false t.index ["data"], name: "index_page_blocks_on_data", using: :gin t.index ["enabled"], name: "index_page_blocks_on_enabled" t.index ["name"], name: "index_page_blocks_on_name" @@ -481,8 +480,8 @@ t.string "referer_domain", comment: "來源網域" t.jsonb "params", default: {}, comment: "參數" t.jsonb "data", default: {} - t.datetime "created_at", precision: 6, null: false - t.datetime "updated_at", precision: 6, null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false t.index ["city"], name: "index_pageviews_on_city" t.index ["continent"], name: "index_pageviews_on_continent" t.index ["country", "zip"], name: "index_pageviews_on_country_and_zip" @@ -511,8 +510,8 @@ t.string "people_type" t.integer "people_id" t.jsonb "data", default: {} - t.datetime "created_at", precision: 6, null: false - t.datetime "updated_at", precision: 6, null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false t.index ["data"], name: "index_role_peoples_on_data", using: :gin t.index ["people_type", "people_id"], name: "index_role_peoples_on_people_type_and_people_id" t.index ["role_id"], name: "index_role_peoples_on_role_id" @@ -525,8 +524,8 @@ t.boolean "enabled", default: false t.string "permissions", default: [], comment: "擁有的權限", array: true t.jsonb "data", default: {} - t.datetime "created_at", precision: 6, null: false - t.datetime "updated_at", precision: 6, null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false t.index ["data"], name: "index_roles_on_data", using: :gin t.index ["description"], name: "index_roles_on_description", opclass: :gin_trgm_ops, using: :gin t.index ["enabled"], name: "index_roles_on_enabled" @@ -546,8 +545,8 @@ t.datetime "created_at" t.index ["tag_id", "taggable_id", "taggable_type", "context", "tagger_id", "tagger_type"], name: "taggings_idx", unique: true t.index ["taggable_id", "taggable_type", "context"], name: "index_taggings_on_taggable_id_and_taggable_type_and_context" - t.index ["taggable_type", "taggable_id"], name: "index_taggings_on_taggable_type_and_taggable_id" - t.index ["tagger_type", "tagger_id"], name: "index_taggings_on_tagger_type_and_tagger_id" + t.index ["taggable_type", "taggable_id"], name: "index_taggings_on_taggable" + t.index ["tagger_type", "tagger_id"], name: "index_taggings_on_tagger" end create_table "tags", force: :cascade do |t| @@ -574,8 +573,8 @@ t.datetime "confirmation_sent_at" t.string "unconfirmed_email" t.jsonb "data", default: {} - t.datetime "created_at", precision: 6, null: false - t.datetime "updated_at", precision: 6, null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false t.index ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true t.index ["data"], name: "index_users_on_data", using: :gin t.index ["email"], name: "index_users_on_email", unique: true @@ -613,8 +612,8 @@ t.string "image", comment: "分享預覽圖" t.string "attachment", comment: "靜態檔案" t.jsonb "data", default: {} - t.datetime "created_at", precision: 6, null: false - t.datetime "updated_at", precision: 6, null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false t.index ["context_type", "context_id", "page_type"], name: "index_webpages_on_context_type_and_context_id_and_page_type" t.index ["context_type", "context_id", "path"], name: "index_webpages_on_context_type_and_context_id_and_path" t.index ["context_type", "context_id"], name: "index_webpages_on_context_type_and_context_id" diff --git a/spec/factories/notifications.rb b/spec/factories/notifications.rb index e69b0f67..a8996b90 100644 --- a/spec/factories/notifications.rb +++ b/spec/factories/notifications.rb @@ -7,8 +7,8 @@ # sender_id :string # receiver_type :string # receiver_id :string -# object_type :string -# object_id :string +# item_type :string +# item_id :string # notify_type :string # readed :boolean default(FALSE) # subject :string @@ -20,15 +20,15 @@ # # Indexes # -# index_notifications_on_body (body) USING gin -# index_notifications_on_created_on (created_on) -# index_notifications_on_data (data) USING gin -# index_notifications_on_notify_type (notify_type) -# index_notifications_on_object_type_and_object_id (object_type,object_id) -# index_notifications_on_readed_and_receiver_type_and_receiver_id (readed,receiver_type,receiver_id) -# index_notifications_on_receiver_type_and_receiver_id (receiver_type,receiver_id) -# index_notifications_on_sender_type_and_sender_id (sender_type,sender_id) -# index_notifications_on_subject (subject) USING gin +# idx_on_readed_receiver_type_receiver_id_1d93789c5c (readed,receiver_type,receiver_id) +# index_notifications_on_body (body) USING gin +# index_notifications_on_created_on (created_on) +# index_notifications_on_data (data) USING gin +# index_notifications_on_item_type_and_item_id (item_type,item_id) +# index_notifications_on_notify_type (notify_type) +# index_notifications_on_receiver_type_and_receiver_id (receiver_type,receiver_id) +# index_notifications_on_sender_type_and_sender_id (sender_type,sender_id) +# index_notifications_on_subject (subject) USING gin # FactoryBot.define do factory :notification do diff --git a/spec/models/notification_spec.rb b/spec/models/notification_spec.rb index b9ef9b3a..ee8554fc 100644 --- a/spec/models/notification_spec.rb +++ b/spec/models/notification_spec.rb @@ -7,8 +7,8 @@ # sender_id :string # receiver_type :string # receiver_id :string -# object_type :string -# object_id :string +# item_type :string +# item_id :string # notify_type :string # readed :boolean default(FALSE) # subject :string @@ -20,15 +20,15 @@ # # Indexes # -# index_notifications_on_body (body) USING gin -# index_notifications_on_created_on (created_on) -# index_notifications_on_data (data) USING gin -# index_notifications_on_notify_type (notify_type) -# index_notifications_on_object_type_and_object_id (object_type,object_id) -# index_notifications_on_readed_and_receiver_type_and_receiver_id (readed,receiver_type,receiver_id) -# index_notifications_on_receiver_type_and_receiver_id (receiver_type,receiver_id) -# index_notifications_on_sender_type_and_sender_id (sender_type,sender_id) -# index_notifications_on_subject (subject) USING gin +# idx_on_readed_receiver_type_receiver_id_1d93789c5c (readed,receiver_type,receiver_id) +# index_notifications_on_body (body) USING gin +# index_notifications_on_created_on (created_on) +# index_notifications_on_data (data) USING gin +# index_notifications_on_item_type_and_item_id (item_type,item_id) +# index_notifications_on_notify_type (notify_type) +# index_notifications_on_receiver_type_and_receiver_id (receiver_type,receiver_id) +# index_notifications_on_sender_type_and_sender_id (sender_type,sender_id) +# index_notifications_on_subject (subject) USING gin # require 'rails_helper' diff --git a/tyr b/tyr index cf8d5ad8..22b2f23d 160000 --- a/tyr +++ b/tyr @@ -1 +1 @@ -Subproject commit cf8d5ad80f5ced584a551661593128597cb862ae +Subproject commit 22b2f23d02af4a6ac1a78705dca1c8f6041ee336