diff --git a/.circleci/config.yml b/.circleci/config.yml index 7845f2da2e..625fe96a17 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -331,7 +331,7 @@ commands: # reusable commands with parameters taskname=$(echo $CIRCLE_JOB | sed -e 's/-\(postgres\|oracle\|[0-9]\).*//') bundle exec rake "test:files:${taskname}" | circleci tests run --command="cat > $list" --verbose --split-by=timings if [ -s $list ]; then - bundle exec rake test:run TEST="$(cat $list)" TESTOPTS=--verbose --verbose --trace + bundle exec rails test $(awk 'ORS=" "' < $list) --verbose --backtrace fi environment: *malloc_preload - upload-artifacts diff --git a/Gemfile b/Gemfile index b8e2f162d7..3e5e19262a 100644 --- a/Gemfile +++ b/Gemfile @@ -12,7 +12,7 @@ gem 'aws-sdk-rails', '~> 3' gem 'aws-sdk-s3', '~> 1' gem 'dotenv-rails', '~> 2.7' -gem 'rails', '~> 6.1' +gem 'rails', '~> 7.0.0' gem 'mail', '~> 2.8.1' @@ -24,7 +24,7 @@ gem 'protected_attributes_continued', '~> 1.8.2' gem 'rails-observers' -gem 'strong_migrations', '~> 0.6.8' +gem 'strong_migrations', '~> 2.1.0' group :assets do gem 'coffee-rails', '~> 5.0' @@ -71,7 +71,7 @@ gem 'cancancan', '~> 3.6.0' gem 'formtastic', '~> 4.0' gem 'htmlentities', '~>4.3', '>= 4.3.4' # TODO: Not actively maintained https://github.com/activeadmin/inherited_resources#notice replace with respond_with and fix things the rails way -gem 'inherited_resources', '~> 1.12.0' +gem 'inherited_resources', '~> 1.14.0' gem 'json', '~> 2.7', '>= 2.7.1' gem 'mysql2', '~> 0.5.3' @@ -86,7 +86,7 @@ gem 'nokogiri', '~> 1.15.5' gem 'secure_headers', '~> 6.3.0' gem 'redlock' -gem 'acts-as-taggable-on', '~> 8.0' +gem 'acts-as-taggable-on', '~> 11.0' gem 'baby_squeel', '~> 2.0' gem 'browser' gem 'diff-lcs', '~> 1.2' @@ -149,7 +149,7 @@ gem 'state_machines-activerecord', '~> 0.8' # for liquid docs on-fly generation gem 'commonmarker', '~> 0.23.10' gem 'escape_utils' -gem 'html-pipeline' +gem 'html-pipeline', '~> 2.14.3' # templating gem 'ruby-openid' @@ -201,7 +201,7 @@ group :test do gem 'equivalent-xml', require: false - gem 'rspec-rails', '~> 6.1', require: false # version 6.x is needed for for Rails 6.1 or 7.x + gem 'rspec-rails', '~> 7.1', require: false # Reason to use the fork: https://github.com/kucaahbe/rspec-html-matchers/pull/21 gem 'rspec_api_documentation' @@ -235,7 +235,7 @@ group :development, :test do gem 'active_record_query_trace' gem 'bootsnap', '~> 1.16' - gem 'bullet', '~> 6.1.5' + gem 'bullet', '~> 7.0.7' gem 'colorize' gem 'factory_bot_rails', '~> 6.2' @@ -259,7 +259,7 @@ gem 'unicorn', require: false, group: %i[production] # NOTE: Use ENV['DB'] only to install oracle dependencies group :oracle do oracle = -> { (ENV['ORACLE'] == '1') || ENV.fetch('DATABASE_URL', ENV['DB'])&.start_with?('oracle') } - gem 'activerecord-oracle_enhanced-adapter', '~> 6.1.6', install_if: oracle + gem 'activerecord-oracle_enhanced-adapter', '~> 7.0.3', install_if: oracle gem 'ruby-oci8', require: false, install_if: oracle end diff --git a/Gemfile.lock b/Gemfile.lock index c4db9cd9ff..047a4f4b17 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -72,48 +72,55 @@ GEM activesupport (>= 3.2.19) Ascii85 (1.1.0) RedCloth (4.3.3) - actioncable (6.1.7.9) - actionpack (= 6.1.7.9) - activesupport (= 6.1.7.9) + actioncable (7.0.8.6) + actionpack (= 7.0.8.6) + activesupport (= 7.0.8.6) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (6.1.7.9) - actionpack (= 6.1.7.9) - activejob (= 6.1.7.9) - activerecord (= 6.1.7.9) - activestorage (= 6.1.7.9) - activesupport (= 6.1.7.9) + actionmailbox (7.0.8.6) + actionpack (= 7.0.8.6) + activejob (= 7.0.8.6) + activerecord (= 7.0.8.6) + activestorage (= 7.0.8.6) + activesupport (= 7.0.8.6) mail (>= 2.7.1) - actionmailer (6.1.7.9) - actionpack (= 6.1.7.9) - actionview (= 6.1.7.9) - activejob (= 6.1.7.9) - activesupport (= 6.1.7.9) + net-imap + net-pop + net-smtp + actionmailer (7.0.8.6) + actionpack (= 7.0.8.6) + actionview (= 7.0.8.6) + activejob (= 7.0.8.6) + activesupport (= 7.0.8.6) mail (~> 2.5, >= 2.5.4) + net-imap + net-pop + net-smtp rails-dom-testing (~> 2.0) - actionpack (6.1.7.9) - actionview (= 6.1.7.9) - activesupport (= 6.1.7.9) - rack (~> 2.0, >= 2.0.9) + actionpack (7.0.8.6) + actionview (= 7.0.8.6) + activesupport (= 7.0.8.6) + rack (~> 2.0, >= 2.2.4) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (6.1.7.9) - actionpack (= 6.1.7.9) - activerecord (= 6.1.7.9) - activestorage (= 6.1.7.9) - activesupport (= 6.1.7.9) + actiontext (7.0.8.6) + actionpack (= 7.0.8.6) + activerecord (= 7.0.8.6) + activestorage (= 7.0.8.6) + activesupport (= 7.0.8.6) + globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (6.1.7.9) - activesupport (= 6.1.7.9) + actionview (7.0.8.6) + activesupport (= 7.0.8.6) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0) active_record_query_trace (1.8.2) activerecord (>= 6.0.0) - activejob (6.1.7.9) - activesupport (= 6.1.7.9) + activejob (7.0.8.6) + activesupport (= 7.0.8.6) globalid (>= 0.3.6) activejob-uniqueness (0.2.5) activejob (>= 4.2, < 7.1) @@ -123,33 +130,34 @@ GEM builder (>= 2.1.2, < 4.0.0) i18n (>= 0.6.9) nokogiri (~> 1.4) - activemodel (6.1.7.9) - activesupport (= 6.1.7.9) + activemodel (7.0.8.6) + activesupport (= 7.0.8.6) activemodel-serializers-xml (1.0.2) activemodel (> 5.x) activesupport (> 5.x) builder (~> 3.1) - activerecord (6.1.7.9) - activemodel (= 6.1.7.9) - activesupport (= 6.1.7.9) - activerecord-oracle_enhanced-adapter (6.1.6) - activerecord (~> 6.1.0) + activerecord (7.0.8.6) + activemodel (= 7.0.8.6) + activesupport (= 7.0.8.6) + activerecord-oracle_enhanced-adapter (7.0.3) + activerecord (~> 7.0.0) + ruby-oci8 ruby-plsql (>= 0.6.0) - activestorage (6.1.7.9) - actionpack (= 6.1.7.9) - activejob (= 6.1.7.9) - activerecord (= 6.1.7.9) - activesupport (= 6.1.7.9) + activestorage (7.0.8.6) + actionpack (= 7.0.8.6) + activejob (= 7.0.8.6) + activerecord (= 7.0.8.6) + activesupport (= 7.0.8.6) marcel (~> 1.0) mini_mime (>= 1.1.0) - activesupport (6.1.7.9) + activesupport (7.0.8.6) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) tzinfo (~> 2.0) - zeitwerk (~> 2.3) - acts-as-taggable-on (8.1.0) - activerecord (>= 5.0, < 6.2) + acts-as-taggable-on (11.0.0) + activerecord (>= 7.0, < 8.0) + zeitwerk (>= 2.4, < 3.0) acts_as_list (0.9.17) activerecord (>= 3.0) acts_as_tree (2.9.1) @@ -221,7 +229,7 @@ GEM bugsnag (6.26.3) concurrent-ruby (~> 1.0) builder (3.3.0) - bullet (6.1.5) + bullet (7.0.7) activesupport (>= 3.0.0) uniform_notifier (~> 1.11) byebug (11.1.3) @@ -317,7 +325,7 @@ GEM activerecord (>= 5.a) database_cleaner-core (~> 2.0.0) database_cleaner-core (2.0.1) - date (3.3.4) + date (3.4.0) debug_inspector (1.1.0) declarative (0.0.20) declarative-builder (0.1.0) @@ -389,7 +397,7 @@ GEM globalid (1.2.1) activesupport (>= 6.1) hana (1.3.7) - has_scope (0.8.1) + has_scope (0.8.2) actionpack (>= 5.2) activesupport (>= 5.2) hashdiff (1.1.1) @@ -397,7 +405,7 @@ GEM hashie (3.6.0) hiredis-client (0.22.2) redis-client (= 0.22.2) - html-pipeline (2.12.3) + html-pipeline (2.14.3) activesupport (>= 2) nokogiri (>= 1.4) htmlentities (4.3.4) @@ -411,13 +419,13 @@ GEM http-form_data (2.3.0) http-parser (1.2.3) ffi-compiler (>= 1.0, < 2.0) - i18n (1.14.5) + i18n (1.14.6) concurrent-ruby (~> 1.0) - inherited_resources (1.12.0) - actionpack (>= 5.2, < 6.2) - has_scope (~> 0.6) - railties (>= 5.2, < 6.2) - responders (>= 2, < 4) + inherited_resources (1.14.0) + actionpack (>= 6.0) + has_scope (>= 0.6) + railties (>= 6.0) + responders (>= 2) injectedlogger (0.0.13) innertube (1.1.0) jmespath (1.6.1) @@ -492,7 +500,7 @@ GEM ntlm-http (~> 0.1, >= 0.1.1) webrick (~> 1.7) webrobots (>= 0.0.9, < 0.2) - method_source (1.0.0) + method_source (1.1.0) middleware (0.1.0) mime-types (3.5.2) mime-types-data (~> 3.2015) @@ -523,7 +531,7 @@ GEM net-http-digest_auth (1.4.1) net-http-persistent (4.0.2) connection_pool (~> 2.2) - net-imap (0.4.17) + net-imap (0.5.1) date net-protocol net-pop (0.1.2) @@ -533,7 +541,7 @@ GEM net-smtp (0.5.0) net-protocol netrc (0.11.0) - nio4r (2.7.1) + nio4r (2.7.4) nokogiri (1.15.7) mini_portile2 (~> 2.8.2) racc (~> 1.4) @@ -601,7 +609,7 @@ GEM public_suffix (4.0.7) raabro (1.4.0) racc (1.8.1) - rack (2.2.9) + rack (2.2.10) rack-cors (1.1.1) rack (>= 2.0.0) rack-no_animations (1.0.3) @@ -613,21 +621,20 @@ GEM rack-utf8_sanitizer (1.9.1) rack (>= 1.0, < 4.0) rack-x_served_by (0.1.1) - rails (6.1.7.9) - actioncable (= 6.1.7.9) - actionmailbox (= 6.1.7.9) - actionmailer (= 6.1.7.9) - actionpack (= 6.1.7.9) - actiontext (= 6.1.7.9) - actionview (= 6.1.7.9) - activejob (= 6.1.7.9) - activemodel (= 6.1.7.9) - activerecord (= 6.1.7.9) - activestorage (= 6.1.7.9) - activesupport (= 6.1.7.9) + rails (7.0.8.6) + actioncable (= 7.0.8.6) + actionmailbox (= 7.0.8.6) + actionmailer (= 7.0.8.6) + actionpack (= 7.0.8.6) + actiontext (= 7.0.8.6) + actionview (= 7.0.8.6) + activejob (= 7.0.8.6) + activemodel (= 7.0.8.6) + activerecord (= 7.0.8.6) + activestorage (= 7.0.8.6) + activesupport (= 7.0.8.6) bundler (>= 1.15.0) - railties (= 6.1.7.9) - sprockets-rails (>= 2.0.0) + railties (= 7.0.8.6) rails-controller-testing (1.0.5) actionpack (>= 5.0.1.rc1) actionview (>= 5.0.1.rc1) @@ -651,15 +658,16 @@ GEM activemodel (>= 3.0) activesupport (>= 3.0) ruby_event_store (~> 0.9.0) - railties (6.1.7.9) - actionpack (= 6.1.7.9) - activesupport (= 6.1.7.9) + railties (7.0.8.6) + actionpack (= 7.0.8.6) + activesupport (= 7.0.8.6) method_source rake (>= 12.2) thor (~> 1.0) + zeitwerk (~> 2.5) rainbow (3.1.1) raindrops (0.20.1) - rake (13.1.0) + rake (13.2.1) ransack (2.6.0) activerecord (>= 6.0.4) activesupport (>= 6.0.4) @@ -727,22 +735,22 @@ GEM rspec-core (~> 3.13.0) rspec-expectations (~> 3.13.0) rspec-mocks (~> 3.13.0) - rspec-core (3.13.0) + rspec-core (3.13.2) rspec-support (~> 3.13.0) - rspec-expectations (3.13.0) + rspec-expectations (3.13.3) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) - rspec-mocks (3.13.0) + rspec-mocks (3.13.2) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) - rspec-rails (6.1.1) - 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-rails (7.1.0) + actionpack (>= 7.0) + activesupport (>= 7.0) + railties (>= 7.0) + rspec-core (~> 3.13) + rspec-expectations (~> 3.13) + rspec-mocks (~> 3.13) + rspec-support (~> 3.13) rspec-support (3.13.1) rspec_api_documentation (6.1.0) activesupport (>= 3.0.0) @@ -839,12 +847,13 @@ GEM sorted_set (1.0.3) rbtree set (~> 1.0) - sprockets (3.7.2) + sprockets (3.7.5) + base64 concurrent-ruby (~> 1.0) rack (> 1, < 3) - sprockets-rails (3.4.2) - actionpack (>= 5.2) - activesupport (>= 5.2) + sprockets-rails (3.5.2) + actionpack (>= 6.1) + activesupport (>= 6.1) sprockets (>= 3.0.0) state_machines (0.5.0) state_machines-activemodel (0.8.0) @@ -860,8 +869,8 @@ GEM unicode_utils (~> 1.4) strings-ansi (0.2.0) stripe (5.28.0) - strong_migrations (0.6.8) - activerecord (>= 5) + strong_migrations (2.1.0) + activerecord (>= 6.1) svg-graph (2.2.1) sys-uname (1.2.3) ffi (~> 1.1) @@ -882,9 +891,9 @@ GEM joiner (>= 0.3.4) middleware (>= 0.1.0) riddle (~> 2.3) - thor (1.3.1) + thor (1.3.2) tilt (2.0.11) - timeout (0.4.1) + timeout (0.4.2) tomlrb (2.0.3) ts-datetime-delta (2.0.2) thinking-sphinx (>= 1.3.8) @@ -922,7 +931,7 @@ GEM unicorn-rails (2.2.1) rack unicorn - uniform_notifier (1.14.2) + uniform_notifier (1.16.0) version_gem (1.1.3) webmock (3.24.0) addressable (>= 2.8.0) @@ -969,8 +978,8 @@ DEPENDENCIES activejob-uniqueness activemerchant (~> 1.107.4) activemodel-serializers-xml - activerecord-oracle_enhanced-adapter (~> 6.1.6) - acts-as-taggable-on (~> 8.0) + activerecord-oracle_enhanced-adapter (~> 7.0.3) + acts-as-taggable-on (~> 11.0) acts_as_list (~> 0.9.17) acts_as_tree (~> 2.9.1) addressable @@ -985,7 +994,7 @@ DEPENDENCIES braintree (~> 2.93) browser bugsnag (~> 6.26) - bullet (~> 6.1.5) + bullet (~> 7.0.7) cancancan (~> 3.6.0) capybara (~> 3.40.0) childprocess @@ -1014,11 +1023,11 @@ DEPENDENCIES formtastic (~> 4.0) hashie hiredis-client - html-pipeline + html-pipeline (~> 2.14.3) htmlentities (~> 4.3, >= 4.3.4) httpclient! i18n - inherited_resources (~> 1.12.0) + inherited_resources (~> 1.14.0) jquery-rails (~> 4.4) json (~> 2.7, >= 2.7.1) json-schema! @@ -1064,7 +1073,7 @@ DEPENDENCIES rack-no_animations (~> 1.0.3) rack-utf8_sanitizer rack-x_served_by (~> 0.1.1) - rails (~> 6.1) + rails (~> 7.0.0) rails-controller-testing (~> 1.0.4) rails-observers rails_event_store (~> 0.9.0) @@ -1080,7 +1089,7 @@ DEPENDENCIES rest-client (~> 2.0.2) roar-rails rspec-html-matchers! - rspec-rails (~> 6.1) + rspec-rails (~> 7.1) rspec_api_documentation rspec_junit_formatter rubocop (= 1.39) @@ -1107,7 +1116,7 @@ DEPENDENCIES state_machines-activerecord (~> 0.8) statsd-ruby stripe (~> 5.28.0) - strong_migrations (~> 0.6.8) + strong_migrations (~> 2.1.0) svg-graph swagger-ui_rails! swagger-ui_rails2! diff --git a/app/controllers/admin/api/accounts_controller.rb b/app/controllers/admin/api/accounts_controller.rb index 5c6da16b02..b6f32a6b68 100644 --- a/app/controllers/admin/api/accounts_controller.rb +++ b/app/controllers/admin/api/accounts_controller.rb @@ -116,8 +116,7 @@ def buyer_account end def preload_to_present(accounts) - # ActiveRecord::Associations::Preloader.new(records: Array(accounts), associations: [:annotations, {bought_plans: %i[original]}]).call # Rails 7.x - ActiveRecord::Associations::Preloader.new.preload(Array(accounts), [:annotations, {bought_plans: %i[original]}]) + ActiveRecord::Associations::Preloader.new(records: Array(accounts), associations: [:annotations, {bought_plans: %i[original]}]).call accounts end diff --git a/app/controllers/admin/api/base_controller.rb b/app/controllers/admin/api/base_controller.rb index 9262c300c4..7cee8a0a89 100644 --- a/app/controllers/admin/api/base_controller.rb +++ b/app/controllers/admin/api/base_controller.rb @@ -20,6 +20,8 @@ class Admin::Api::BaseController < ApplicationController include ::ThreeScale::Warnings::ControllerExtension include Logic::RollingUpdates::Controller + include Stale + extend ::Filters::ProviderRequired provider_required diff --git a/app/controllers/admin/api/services_controller.rb b/app/controllers/admin/api/services_controller.rb index 9b95e87576..d1f6847959 100644 --- a/app/controllers/admin/api/services_controller.rb +++ b/app/controllers/admin/api/services_controller.rb @@ -12,7 +12,7 @@ class Admin::Api::ServicesController < Admin::Api::ServiceBaseController # Service List # GET /admin/api/services.xml def index - services = accessible_services.includes(:proxy, :account, :annotations).order(:id).paginate(pagination_params) + services = accessible_services.includes(:proxy, :annotations).order(:id).paginate(pagination_params) respond_with(services) end diff --git a/app/controllers/api/services_controller.rb b/app/controllers/api/services_controller.rb index b4fb32d431..dde7dc1120 100644 --- a/app/controllers/api/services_controller.rb +++ b/app/controllers/api/services_controller.rb @@ -68,7 +68,7 @@ def create def update if integration_settings_updater_service.call(service_attributes: service_params.to_h, proxy_attributes: proxy_params.to_h) flash[:notice] = t('flash.services.update.notice') - redirect_back_or_to :action => :settings + redirect_back_or_to({ action: "settings" }) else flash.now[:error] = t('flash.services.update.error') render action: params[:update_settings].present? ? :settings : :edit # edit page is only page with free form fields. other forms are less probable to have errors diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 16f203a6d9..4a1eea0269 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -64,10 +64,6 @@ def status # helper_method :sublayout - def redirect_back_or_to(fallback_location) - redirect_back(fallback_location: fallback_location) - end - def sublayout sublayout = self.class._sublayout diff --git a/app/controllers/buyers/accounts_controller.rb b/app/controllers/buyers/accounts_controller.rb index 83cb735511..5c7da42bae 100644 --- a/app/controllers/buyers/accounts_controller.rb +++ b/app/controllers/buyers/accounts_controller.rb @@ -71,12 +71,12 @@ def destroy def toggle_monthly_charging account.settings.toggle!(:monthly_charging_enabled) - redirect_back(fallback_location: redirection_path) + redirect_back_or_to(redirection_path) end def toggle_monthly_billing account.settings.toggle!(:monthly_billing_enabled) - redirect_back(fallback_location: redirection_path) + redirect_back_or_to(redirection_path) end def show diff --git a/app/controllers/buyers/applications/bulk/base_controller.rb b/app/controllers/buyers/applications/bulk/base_controller.rb index 861aefb793..e5c6390bcd 100644 --- a/app/controllers/buyers/applications/bulk/base_controller.rb +++ b/app/controllers/buyers/applications/bulk/base_controller.rb @@ -24,6 +24,6 @@ def collection end def errors_template - 'buyers/applications/bulk/shared/errors.html' + 'buyers/applications/bulk/shared/errors' end end diff --git a/app/controllers/buyers/applications/bulk/send_emails_controller.rb b/app/controllers/buyers/applications/bulk/send_emails_controller.rb index af8d7fd711..212e47b266 100644 --- a/app/controllers/buyers/applications/bulk/send_emails_controller.rb +++ b/app/controllers/buyers/applications/bulk/send_emails_controller.rb @@ -14,6 +14,6 @@ def recipients end def errors_template - 'buyers/accounts/bulk/shared/errors.html' + 'buyers/accounts/bulk/shared/errors' end end diff --git a/app/controllers/buyers/service_contracts/bulk/base_controller.rb b/app/controllers/buyers/service_contracts/bulk/base_controller.rb index c08cb68fb0..8a254230ba 100644 --- a/app/controllers/buyers/service_contracts/bulk/base_controller.rb +++ b/app/controllers/buyers/service_contracts/bulk/base_controller.rb @@ -24,6 +24,6 @@ def collection end def errors_template - 'buyers/service_contracts/bulk/shared/errors.html' + 'buyers/service_contracts/bulk/shared/errors' end end diff --git a/app/controllers/buyers/service_contracts/bulk/send_emails_controller.rb b/app/controllers/buyers/service_contracts/bulk/send_emails_controller.rb index ab9bec2639..a6e1558951 100644 --- a/app/controllers/buyers/service_contracts/bulk/send_emails_controller.rb +++ b/app/controllers/buyers/service_contracts/bulk/send_emails_controller.rb @@ -14,6 +14,6 @@ def recipients end def errors_template - 'buyers/accounts/bulk/shared/errors.html' + 'buyers/accounts/bulk/shared/errors' end end diff --git a/app/controllers/buyers/service_contracts_controller.rb b/app/controllers/buyers/service_contracts_controller.rb index 0e6bdbba4b..79513d2bd4 100644 --- a/app/controllers/buyers/service_contracts_controller.rb +++ b/app/controllers/buyers/service_contracts_controller.rb @@ -73,7 +73,7 @@ def destroy flash[:error] = t('service_contracts.unsubscribe_failure') end - redirect_back(fallback_location: admin_buyers_account_service_contracts_path(@account)) + redirect_back_or_to(admin_buyers_account_service_contracts_path(@account)) end def approve @@ -83,7 +83,7 @@ def approve flash[:error] = 'Cannot approve service contract.' end - redirect_back(fallback_location: admin_buyers_account_service_contracts_path(@account)) + redirect_back_or_to(admin_buyers_account_service_contracts_path(@account)) end private diff --git a/app/controllers/buyers/users_controller.rb b/app/controllers/buyers/users_controller.rb index 501ad75126..87ed9a9438 100644 --- a/app/controllers/buyers/users_controller.rb +++ b/app/controllers/buyers/users_controller.rb @@ -92,6 +92,6 @@ def user_params end def redirect_back_or_show_detail - redirect_back(fallback_location: admin_buyers_account_user_path(account_id: user.account_id, id: user.id)) + redirect_back_or_to(admin_buyers_account_user_path(account_id: user.account_id, id: user.id)) end end diff --git a/app/controllers/finance/provider/billing_strategies_controller.rb b/app/controllers/finance/provider/billing_strategies_controller.rb index 4c9d006dd4..3cc26bb0ea 100644 --- a/app/controllers/finance/provider/billing_strategies_controller.rb +++ b/app/controllers/finance/provider/billing_strategies_controller.rb @@ -11,7 +11,7 @@ def update if type @billing_strategy.change_mode(type) - redirect_back(fallback_location: admin_finance_billing_strategy_path) + redirect_back_or_to(admin_finance_billing_strategy_path) else render_error(:not_found) end diff --git a/app/controllers/master/providers/switches_controller.rb b/app/controllers/master/providers/switches_controller.rb index f3c5ce29d0..8cfa7ec6b3 100644 --- a/app/controllers/master/providers/switches_controller.rb +++ b/app/controllers/master/providers/switches_controller.rb @@ -7,14 +7,12 @@ class SwitchesController < Master::Providers::BaseController def update status = @switch.allow ? :found : :not_modified - # Switch to `redirect_back_or_to` in Rails 7 - redirect_back(fallback_location: back_url, status: status) + redirect_back_or_to(back_url, status: status) end def destroy status = @switch.deny ? :found : :not_modified - # Switch to `redirect_back_or_to` in Rails 7 - redirect_back(fallback_location: back_url, status: status) + redirect_back_or_to(back_url, status: status) end protected diff --git a/app/controllers/provider/admin/applications_controller.rb b/app/controllers/provider/admin/applications_controller.rb index ccfde85067..0d8fb88506 100644 --- a/app/controllers/provider/admin/applications_controller.rb +++ b/app/controllers/provider/admin/applications_controller.rb @@ -101,7 +101,7 @@ def destroy redirect_to provider_admin_applications_path else flash[:notice] = 'Not possible to delete application' - redirect_back(fallback_location: provider_admin_applications_path) + redirect_back_or_to(provider_admin_applications_path) end end diff --git a/app/controllers/provider/admin/cms/builtin_legal_terms_controller.rb b/app/controllers/provider/admin/cms/builtin_legal_terms_controller.rb index 9d1cc18638..af05476f5b 100644 --- a/app/controllers/provider/admin/cms/builtin_legal_terms_controller.rb +++ b/app/controllers/provider/admin/cms/builtin_legal_terms_controller.rb @@ -10,7 +10,7 @@ def edit; end def update if @page.update(permitted_params.fetch(:cms_template)) flash[:info] = 'Legal terms saved.' - redirect_back(fallback_location: { action: "edit", id: @page.id}) + redirect_back_or_to({ action: "edit", id: @page.id}) else render :edit end diff --git a/app/controllers/provider/admin/cms/versions_controller.rb b/app/controllers/provider/admin/cms/versions_controller.rb index e52a603249..56bd6ab5e6 100644 --- a/app/controllers/provider/admin/cms/versions_controller.rb +++ b/app/controllers/provider/admin/cms/versions_controller.rb @@ -25,7 +25,7 @@ def revert redirect_to polymorphic_path([:edit, :provider, :admin, @page]) else flash[:error] = "Problem reverting version" - redirect_back(fallback_location: provider_admin_cms_template_version_path(@page, version)) + redirect_back_or_to(provider_admin_cms_template_version_path(@page, version)) end end diff --git a/app/controllers/provider/admin/dashboard/widget_controller.rb b/app/controllers/provider/admin/dashboard/widget_controller.rb index 214157de0e..b60aa34491 100644 --- a/app/controllers/provider/admin/dashboard/widget_controller.rb +++ b/app/controllers/provider/admin/dashboard/widget_controller.rb @@ -28,7 +28,7 @@ def timeline_data(current_data, previous_data) previous: previous_data }, value: current_sum, - current: incomplete_slice.values.sum, + current: incomplete_slice.values.first, previous_value: previous_sum, percentual_change: percentual_change, has_history: previous_sum > 0 diff --git a/app/controllers/provider/passwords_controller.rb b/app/controllers/provider/passwords_controller.rb index 623ad00a44..aa98b67796 100644 --- a/app/controllers/provider/passwords_controller.rb +++ b/app/controllers/provider/passwords_controller.rb @@ -7,7 +7,7 @@ class Provider::PasswordsController < FrontendController before_action :passwords_allowed? def new - return redirect_back(fallback_location: root_path), error: t('.has_password') if current_user.using_password? + return redirect_back_or_to(root_path), error: t('.has_password') if current_user.using_password? reset_session_password_token token = current_user.generate_lost_password_token diff --git a/app/controllers/sites/usage_rules_controller.rb b/app/controllers/sites/usage_rules_controller.rb index 8d19b62f8d..952fe0b9ea 100644 --- a/app/controllers/sites/usage_rules_controller.rb +++ b/app/controllers/sites/usage_rules_controller.rb @@ -9,7 +9,7 @@ def edit def update if @settings.update(params[:settings]) flash[:notice] = 'Settings updated.' - redirect_back(fallback_location: admin_site_settings_url) + redirect_back_or_to(admin_site_settings_url) else render :edit end diff --git a/app/decorators/application_decorator.rb b/app/decorators/application_decorator.rb index 590007830a..9f4f02101f 100644 --- a/app/decorators/application_decorator.rb +++ b/app/decorators/application_decorator.rb @@ -14,6 +14,6 @@ def self.collection_decorator_class end def updated_at - object.updated_at.to_s :long if object.updated_at? + object.updated_at.to_fs(:long) if object.updated_at? end end diff --git a/app/helpers/account_helper.rb b/app/helpers/account_helper.rb index 6e3110b852..08daf89edc 100644 --- a/app/helpers/account_helper.rb +++ b/app/helpers/account_helper.rb @@ -40,7 +40,7 @@ def parameterized_org_name_of_the_current_account def account_states_info(account) state_info = account.state.humanize if account.scheduled_for_deletion? - "#{state_info} (#{account.deletion_date.to_date.to_s(:long)})" + "#{state_info} (#{account.deletion_date.to_date.to_fs(:long)})" else state_info end @@ -69,7 +69,7 @@ def delete_buyer_link(account) msg = t("buyers.accounts.edit.#{account.provider? ? 'schedule_for_deletion_confirmation' : 'delete_confirmation'}", deletion_time_left: distance_of_time_in_words(Account::States::PERIOD_BEFORE_DELETION), name: h(account.name), - deletion_date: Account::States::PERIOD_BEFORE_DELETION.from_now.to_date.to_s(:long)) + deletion_date: Account::States::PERIOD_BEFORE_DELETION.from_now.to_date.to_fs(:long)) alert = t('buyers.accounts.edit.delete.admin_restricted', admin: current_account.first_admin.try(:email)) url = can?(:destroy, account) ? admin_buyers_account_path(account) : javascript_alert_url(alert) diff --git a/app/helpers/invitations_helper.rb b/app/helpers/invitations_helper.rb index dd938dc046..0158b0c81e 100644 --- a/app/helpers/invitations_helper.rb +++ b/app/helpers/invitations_helper.rb @@ -3,12 +3,12 @@ # TODO: remove and use invitations index presenter module InvitationsHelper def invitation_sent_date(invitation) - invitation.sent_at&.to_s(:long) || 'Not sent yet' + invitation.sent_at&.to_fs(:long) || 'Not sent yet' end def invitation_status(invitation) if invitation.accepted? - "yes, on #{invitation.accepted_at.to_s(:short)}" + "yes, on #{invitation.accepted_at.to_fs(:short)}" else "no" end diff --git a/app/lib/apicast/provider_source.rb b/app/lib/apicast/provider_source.rb index 611729c978..ab567546d5 100644 --- a/app/lib/apicast/provider_source.rb +++ b/app/lib/apicast/provider_source.rb @@ -46,7 +46,7 @@ def attributes_for_proxy ] } - ActiveRecord::Associations::Preloader.new.preload(provider, {services: [:service_tokens, {backend_api_configs: :backend_api, proxy: [:gateway_configuration, {proxy_rules: :metric}]}]}) + ActiveRecord::Associations::Preloader.new(records: Array(provider), associations: {services: [:service_tokens, {backend_api_configs: :backend_api, proxy: [:gateway_configuration, {proxy_rules: :metric}]}]}).call provider.as_json(hash).merge(timestamp: Time.now.utc.iso8601) end diff --git a/app/lib/backend/error.rb b/app/lib/backend.rb similarity index 100% rename from app/lib/backend/error.rb rename to app/lib/backend.rb diff --git a/app/lib/csv/buyers_exporter.rb b/app/lib/csv/buyers_exporter.rb index a1e2217756..100b29f767 100644 --- a/app/lib/csv/buyers_exporter.rb +++ b/app/lib/csv/buyers_exporter.rb @@ -23,7 +23,7 @@ def values_for_account(account) account.org_name, account.country.try!(:name), account.bought_account_plan.try!(:name), - account.created_at.to_s(:db), + account.created_at.to_fs(:db), account.bought_cinstances.count, account.decorate.admin_user_display_name, user&.email, diff --git a/app/lib/forum_support/user_topics.rb b/app/lib/forum_support/user_topics.rb index 5e16d86d6b..da4ce89ec6 100644 --- a/app/lib/forum_support/user_topics.rb +++ b/app/lib/forum_support/user_topics.rb @@ -28,7 +28,7 @@ def create respond_to do |format| flash[:notice] = 'You have successfully subscribed to the thread.' if @user_topic.save - format.html { redirect_back(fallback_location: forum_subscriptions_path) } + format.html { redirect_back_or_to(forum_subscriptions_path) } end end @@ -41,7 +41,7 @@ def destroy respond_to do |format| flash[:notice] = 'You have successfully unsubscribed from the thread.' - format.html { redirect_back(fallback_location: root_path) } + format.html { redirect_back_or_to(root_path) } end end end diff --git a/app/lib/month.rb b/app/lib/month.rb index f4d8183b7e..2e128a9268 100644 --- a/app/lib/month.rb +++ b/app/lib/month.rb @@ -44,17 +44,17 @@ def same_month?(date) end def to_param - self.begin.to_s(:db_month) + self.begin.to_fs(:db_month) end delegate :to_json, :to => :to_param def to_s(format = :long) - begin_formatted = self.begin.to_s(format) + begin_formatted = self.begin.to_fs(format) if format == :db begin_formatted else - "#{begin_formatted} - #{self.end.to_s(format)}" + "#{begin_formatted} - #{self.end.to_fs(format)}" end end diff --git a/app/lib/proxy_config_affecting_changes.rb b/app/lib/proxy_config_affecting_changes.rb index f0bd04386a..dfba61f6c1 100644 --- a/app/lib/proxy_config_affecting_changes.rb +++ b/app/lib/proxy_config_affecting_changes.rb @@ -135,6 +135,11 @@ def destroy super end + def update_columns(attributes) + track_proxy_affecting_changes if proxy_config_affecting_attributes.intersect?(attributes.keys.map(&:to_s)) + super + end + def write_attribute(attr_name, value) track_proxy_affecting_changes if proxy_config_affecting_attributes.include?(attr_name.to_s) super @@ -147,11 +152,6 @@ def _write_attribute(attr_name, value) protected - def write_attribute_without_type_cast(attr_name, value) - track_proxy_affecting_changes if proxy_config_affecting_attributes.include?(attr_name.to_s) - super - end - def write_store_attribute(store_attribute, key, value) track_proxy_affecting_changes if proxy_config_affecting_attributes.include?(store_attribute.to_s) super diff --git a/app/lib/signup/plans_with_defaults.rb b/app/lib/signup/plans_with_defaults.rb index 55d0a442d2..f79bdf087a 100644 --- a/app/lib/signup/plans_with_defaults.rb +++ b/app/lib/signup/plans_with_defaults.rb @@ -113,7 +113,7 @@ def service_plan_errors end def any_plan_for?(issuer:, plan_type:) - ActiveRecord::Associations::Preloader.new.preload(plans[plan_type], [:issuer]) + ActiveRecord::Associations::Preloader.new(records: Array(plans[plan_type]), associations: [:issuer]).call plans[plan_type].any? { |plan| plan.issuer == issuer } end end diff --git a/app/lib/stale.rb b/app/lib/stale.rb new file mode 100644 index 0000000000..55c4ab9195 --- /dev/null +++ b/app/lib/stale.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module Stale + # The API responder performs conditional GET and only produces the response for stale objects, + # but calling `stale?` for controllers that deal with objects that are not ActiveRecord descendants fails + # because it relies on `updated_at` field which is not available + # In such cases the object will always be considered stale + def stale?(object = nil, **freshness_kwargs) + has_updated_at = object.respond_to?(:updated_at) || object&.all? { _1.respond_to? :updated_at } + return super if has_updated_at + + true + end +end diff --git a/app/lib/stats/aggregation/rule.rb b/app/lib/stats/aggregation/rule.rb index 46490f304c..a96c96ae7a 100644 --- a/app/lib/stats/aggregation/rule.rb +++ b/app/lib/stats/aggregation/rule.rb @@ -81,7 +81,7 @@ def granularity_key_component(data) "eternity" else cycle = data[:created_at].beginning_of_cycle(granularity) - key_for(granularity => cycle.to_s(:compact)) + key_for(granularity => cycle.to_fs(:compact)) end end diff --git a/app/lib/stats/deprecated.rb b/app/lib/stats/deprecated.rb index c5874e0bd6..37c09f1de0 100644 --- a/app/lib/stats/deprecated.rb +++ b/app/lib/stats/deprecated.rb @@ -136,7 +136,7 @@ def self.call_for_all_metrics(method, source, options) end def self.date_labels(period, format) - period.to_time_range.each(:day).map { |time| time.to_date.to_s(format) } + period.to_time_range.each(:day).map { |time| time.to_date.to_fs(format) } end def self.weekday_name(number) diff --git a/app/lib/stats/storage.rb b/app/lib/stats/storage.rb index b6bb237ed5..8440196577 100644 --- a/app/lib/stats/storage.rb +++ b/app/lib/stats/storage.rb @@ -41,7 +41,7 @@ def ordered_hash(since, period, options) raise InvalidParameterError, "Missing parameter :by" unless options.key?(:by) source_key = key_for(options[:from]) - value_key = key_for(options[:by].push(period => since.to_s(:compact))) + value_key = key_for(options[:by].push(period => since.to_fs(:compact))) value_key_without_period = value_key.match(/(.*)\/.*/)[1] begin @@ -83,10 +83,10 @@ def resum_all_value(range, granularity, prefix) prefix = key_for(prefix) + '/hour:' range.each(g).map do |from| - # day_prefix = from.beginning_of(:day).to_s(:compact) + # day_prefix = from.beginning_of(:day).to_fs(:compact) to = from + (g - 3600) keys = (from..to).to_time_range.each(:hour).map do |time| - prefix + time.to_s(:compact) + prefix + time.to_fs(:compact) end mget(*keys).inject(0) { |sum,v| sum + v.to_i } @@ -189,7 +189,7 @@ def compute_timeshift_deltas(range, shift, granularity, prefix) keys = benchmark :shifted_range, level: :debug do shifted_range.each(granularity_for_iteration).flat_map do |date| - prefix_with_day = prefix + date.beginning_of(:day).to_s(:compact) + prefix_with_day = prefix + date.beginning_of(:day).to_fs(:compact) margin.map do |hour| prefix_with_day + HOURS_STRINGS[hour] @@ -212,7 +212,7 @@ def compute_timeshift_deltas(range, shift, granularity, prefix) def keys_for_range(range, granularity, key_prefix) key = key_for(key_prefix) prefix = key + '/' + granularity.to_s + ':' - transform = ->(time) { prefix + time.to_s(:compact) } + transform = ->(time) { prefix + time.to_fs(:compact) } case granularity when :day diff --git a/app/lib/stats/views/total.rb b/app/lib/stats/views/total.rb index 9d94d69424..d30ac0e1fd 100644 --- a/app/lib/stats/views/total.rb +++ b/app/lib/stats/views/total.rb @@ -59,7 +59,7 @@ def total_hits(options = {}) private def total_in_fixed_period(period, since, metric) - storage.get(key_for(:stats, source_key, metric, period => since.to_s(:compact))).to_i + storage.get(key_for(:stats, source_key, metric, period => since.to_fs(:compact))).to_i end def total_in_eternity(metric) diff --git a/app/models/backend/status.rb b/app/models/backend/status.rb index 6f6037da94..82ccd94097 100644 --- a/app/models/backend/status.rb +++ b/app/models/backend/status.rb @@ -56,8 +56,8 @@ def to_xml(options = {}) records.each do |record| xml.usage(:metric => record.metric_name, :period => record.period) do |xml| - xml.period_start(record.period_as_range.begin.to_s(:db)) unless record.period == :eternity - xml.period_end(record.period_as_range.end.to_s(:db)) unless record.period == :eternity + xml.period_start(record.period_as_range.begin.to_fs(:db)) unless record.period == :eternity + xml.period_end(record.period_as_range.end.to_fs(:db)) unless record.period == :eternity xml.current_value(record.current_value) xml.max_value(record.max_value) end diff --git a/app/models/backend/usage_accumulator.rb b/app/models/backend/usage_accumulator.rb index fd71308a3a..70c0c95a19 100644 --- a/app/models/backend/usage_accumulator.rb +++ b/app/models/backend/usage_accumulator.rb @@ -77,7 +77,7 @@ def storage_key(period, metric_id) key_for(:stats, {:service => cinstance_data[:service_id]}, {:cinstance => cinstance_data[:application_id]}, {:metric => metric_id}, - {period => Time.zone.now.beginning_of(period).to_s(:compact)}) + {period => Time.zone.now.beginning_of(period).to_fs(:compact)}) end def validate_limits!(options) diff --git a/app/models/cms/builtin.rb b/app/models/cms/builtin.rb index 4e6d708f69..898dd6aeb1 100644 --- a/app/models/cms/builtin.rb +++ b/app/models/cms/builtin.rb @@ -55,14 +55,8 @@ class CMS::Builtin < CMS::BasePage validates :system_name, presence: true # TODO: this is a quick fix: we should set the liquid enabled attribute to true when creating builtin templates - # in rails 4.2 use the attribute api - def read_attribute(name) - case name - when 'liquid_enabled'.freeze - true - else - super - end + def liquid_enabled? + true end # TODO: create url for draft/published link diff --git a/app/models/contract.rb b/app/models/contract.rb index 0faa50086f..62ba38a387 100644 --- a/app/models/contract.rb +++ b/app/models/contract.rb @@ -22,7 +22,7 @@ class Contract < ApplicationRecord after_destroy :destroy_customized_plan after_commit :notify_plan_changed, if: :saved_change_to_plan_id? - belongs_to :plan + belongs_to :plan, inverse_of: :contracts validate :correct_plan_subclass? # this breaks nested saving of records, when validating there is no user_account yet, its new record # validates_presence_of :user_account diff --git a/app/models/proxy_config.rb b/app/models/proxy_config.rb index 2f22ac4a54..786a21fe99 100644 --- a/app/models/proxy_config.rb +++ b/app/models/proxy_config.rb @@ -103,8 +103,8 @@ def update_version config.update_all("version = 1 + (#{Arel.sql max_version.to_sql})") # Read the value - version = config.connection.select_value(config.select(:version)).to_i - write_attribute_without_type_cast 'version', version + self.version = config.connection.select_value(config.select(:version)).to_i + clear_attribute_changes [:version] end def clone_to(environment:) diff --git a/app/models/service.rb b/app/models/service.rb index 72d8baf868..61c9a38342 100644 --- a/app/models/service.rb +++ b/app/models/service.rb @@ -463,7 +463,9 @@ def parameterized_system_name APPLY_I18N = ->(args) do args.map do |opt| [ - I18n.t(opt, scope: :deployment_options, raise: ActionView::Base.raise_on_missing_translations), + # The `raise:` argument can be removed after upgrading to Rails 7.1, because `I18n.t` should respect the + # `config.i18n.raise_on_missing_translations` config, see https://github.com/rails/rails/commit/6c4f3be929f1f427d6767050848f2fbee8c1f05f + I18n.t(opt, scope: :deployment_options, raise: Rails.application.config.i18n.raise_on_missing_translations), opt ] end.to_h.freeze diff --git a/app/presenters/api/services_index_presenter.rb b/app/presenters/api/services_index_presenter.rb index b576c978da..59bc704d16 100644 --- a/app/presenters/api/services_index_presenter.rb +++ b/app/presenters/api/services_index_presenter.rb @@ -31,7 +31,7 @@ def data id: product.id, name: product.name, systemName: product.system_name, - updatedAt: product.updated_at.to_s(:long), + updatedAt: product.updated_at.to_fs(:long), link: product.decorate.link, links: ServiceActionsPresenter.new(user).actions(product), appsCount: product.cinstances.size, diff --git a/app/presenters/buyer_presenter.rb b/app/presenters/buyer_presenter.rb index ff111ca89a..75a43c9f96 100644 --- a/app/presenters/buyer_presenter.rb +++ b/app/presenters/buyer_presenter.rb @@ -8,7 +8,7 @@ def new_application_data id: id, name: name, admin: decorate.admin_user_display_name, - createdAt: created_at.to_s(:long), + createdAt: created_at.to_fs(:long), contractedProducts: contracts, createApplicationPath: admin_buyers_account_applications_path(id), multipleAppsAllowed: multiple_applications_allowed? diff --git a/app/presenters/email_configuration_presenter.rb b/app/presenters/email_configuration_presenter.rb index 1bcde40410..8106666c1b 100644 --- a/app/presenters/email_configuration_presenter.rb +++ b/app/presenters/email_configuration_presenter.rb @@ -8,7 +8,7 @@ def index_table_data id: id, email: email, userName: user_name, - updatedAt: updated_at.to_s(:long), + updatedAt: updated_at.to_fs(:long), links: links } end diff --git a/app/presenters/provider/admin/account/authentication_providers_index_presenter.rb b/app/presenters/provider/admin/account/authentication_providers_index_presenter.rb index 5d10367b69..cd1ab96c6b 100644 --- a/app/presenters/provider/admin/account/authentication_providers_index_presenter.rb +++ b/app/presenters/provider/admin/account/authentication_providers_index_presenter.rb @@ -76,7 +76,7 @@ def to_table_data(auth_provider) { id: auth_provider.id, - createdOn: auth_provider.created_at.to_date.to_s(:long), + createdOn: auth_provider.created_at.to_date.to_fs(:long), name: auth_provider.human_kind, editPath: edit_provider_admin_account_authentication_provider_path(auth_provider), path: provider_admin_account_authentication_provider_path(auth_provider), diff --git a/app/presenters/provider/admin/backend_apis_index_presenter.rb b/app/presenters/provider/admin/backend_apis_index_presenter.rb index 909b4121d5..8040bdc9c9 100644 --- a/app/presenters/provider/admin/backend_apis_index_presenter.rb +++ b/app/presenters/provider/admin/backend_apis_index_presenter.rb @@ -29,7 +29,7 @@ def data id: backend.id, name: backend.name, systemName: backend.system_name, - updatedAt: backend.updated_at.to_s(:long), + updatedAt: backend.updated_at.to_fs(:long), privateEndpoint: backend.private_endpoint, link: backend.decorate.link, links: ServiceActionsPresenter.new(user).backend_actions(backend), diff --git a/app/presenters/provider/admin/dashboard_presenter.rb b/app/presenters/provider/admin/dashboard_presenter.rb index 484f563958..66f7451b6c 100644 --- a/app/presenters/provider/admin/dashboard_presenter.rb +++ b/app/presenters/provider/admin/dashboard_presenter.rb @@ -28,7 +28,7 @@ def products_widget_data { id: product.id, name: product.name, - updated_at: product.updated_at.to_s(:long), + updated_at: product.updated_at.to_fs(:long), link: product.decorate.link, links: service_actions_presenter.actions(product) } @@ -45,7 +45,7 @@ def backends_widget_data { id: backend.id, name: backend.name, - updated_at: backend.updated_at.to_s(:long), + updated_at: backend.updated_at.to_fs(:long), link: backend.decorate.link, links: service_actions_presenter.backend_actions(backend) } diff --git a/app/presenters/service_presenter.rb b/app/presenters/service_presenter.rb index c8366b1230..486972ce81 100644 --- a/app/presenters/service_presenter.rb +++ b/app/presenters/service_presenter.rb @@ -12,7 +12,7 @@ def new_application_data id: id, name: name, systemName: system_name, - updatedAt: updated_at.to_s(:long), + updatedAt: updated_at.to_fs(:long), appPlans: plans.reorder(:name).stock.select(:id, :name).as_json(root: false), servicePlans: service_plans.reorder(:name).select(:id, :name).as_json(root: false), defaultServicePlan: default_service_plan.as_json(root: false, only: %i[id name]), diff --git a/app/representers/authentication_provider_representer.rb b/app/representers/authentication_provider_representer.rb index edc458f889..c5f0df179a 100644 --- a/app/representers/authentication_provider_representer.rb +++ b/app/representers/authentication_provider_representer.rb @@ -47,7 +47,7 @@ def self.timestamp(time_object) class TimeDelegator < SimpleDelegator def to_s - super(:iso8601) + to_fs(:iso8601) end end end diff --git a/app/views/buyers/accounts/_account_details.html.slim b/app/views/buyers/accounts/_account_details.html.slim index 971dcf0007..8f696dc32a 100644 --- a/app/views/buyers/accounts/_account_details.html.slim +++ b/app/views/buyers/accounts/_account_details.html.slim @@ -30,7 +30,7 @@ table.list | (#{mail_to admin_user_email}) tr th Signed up on - td = account.created_at.to_s(:long) + td = account.created_at.to_fs(:long) = fields_definitions_rows account, %w{org_name org_legaladdress org_legaladdress_cont city state_region} - unless account.org_legaladdress.blank? \ diff --git a/app/views/buyers/users/index.html.slim b/app/views/buyers/users/index.html.slim index 6c44992f41..1f649abc55 100644 --- a/app/views/buyers/users/index.html.slim +++ b/app/views/buyers/users/index.html.slim @@ -26,7 +26,7 @@ div class="pf-c-card" td role="cell" data-label="Email" = user.email td role="cell" data-label="Created on" - = user.created_at.to_date.to_s(:long) + = user.created_at.to_date.to_fs(:long) td role="cell" data-label="Role" = user.role.to_s td role="cell" data-label="State" diff --git a/app/views/buyers/users/show.html.erb b/app/views/buyers/users/show.html.erb index 0ea9fe2a31..e3d6cd624d 100644 --- a/app/views/buyers/users/show.html.erb +++ b/app/views/buyers/users/show.html.erb @@ -16,13 +16,13 @@ Created on - <%= h @user.created_at.to_s(:long) %> + <%= h @user.created_at.to_fs(:long) %> <% if @user.last_login_at.present? -%> Last logged in on - <%= h @user.last_login_at.to_s(:long) %> + <%= h @user.last_login_at.to_fs(:long) %> <% end -%> diff --git a/app/views/provider/admin/messages/_message.html.erb b/app/views/provider/admin/messages/_message.html.erb index 707c25c36d..99a2c8acc2 100644 --- a/app/views/provider/admin/messages/_message.html.erb +++ b/app/views/provider/admin/messages/_message.html.erb @@ -3,7 +3,7 @@
Date Received
-
<%= message.created_at.to_s(:long) %>
+
<%= message.created_at.to_fs(:long) %>
From
<%= message_sender(message) %>
To
diff --git a/app/views/provider/admin/messages/inbox/index.html.slim b/app/views/provider/admin/messages/inbox/index.html.slim index 5accc3251e..700ba22fba 100644 --- a/app/views/provider/admin/messages/inbox/index.html.slim +++ b/app/views/provider/admin/messages/inbox/index.html.slim @@ -25,7 +25,7 @@ = bulk_select_one message td role="cell" data-label="Subject" = link_to message_subject(message), provider_admin_messages_inbox_path(message) td role="cell" data-label="From" = message_sender(message) - td role="cell" data-label="Date Sent" = message.created_at.to_s(:long) + td role="cell" data-label="Date Sent" = message.created_at.to_fs(:long) td role="cell" class="pf-c-table__action" div class="pf-c-overflow-menu" div class="pf-c-overflow-menu__content" diff --git a/app/views/provider/admin/messages/outbox/index.html.slim b/app/views/provider/admin/messages/outbox/index.html.slim index ba1c2b2eb7..57d73a2a04 100644 --- a/app/views/provider/admin/messages/outbox/index.html.slim +++ b/app/views/provider/admin/messages/outbox/index.html.slim @@ -30,7 +30,7 @@ td role="cell" data-label="To" = message_receiver(message) td role="cell" data-label="Data Sent" - = message.created_at.to_s(:long) + = message.created_at.to_fs(:long) td role="cell" class="pf-c-table__action" div class="pf-c-overflow-menu" div class="pf-c-overflow-menu__content" diff --git a/app/views/provider/admin/messages/trash/index.html.slim b/app/views/provider/admin/messages/trash/index.html.slim index 4956e50ed0..b48dcf05e5 100644 --- a/app/views/provider/admin/messages/trash/index.html.slim +++ b/app/views/provider/admin/messages/trash/index.html.slim @@ -26,7 +26,7 @@ td role="cell" data-label="Subject" = link_to message.subject, provider_admin_messages_trash_path(message) td role="cell" data-label="From" = link_to message_sender(message), provider_admin_messages_trash_path(message) td role="cell" data-label="To" = link_to message_receiver(message), provider_admin_messages_trash_path(message) - td role="cell" data-label="Data sent" = message.created_at.to_s(:long) + td role="cell" data-label="Data sent" = message.created_at.to_fs(:long) td role="cell" class="pf-c-table__action" div class="pf-c-overflow-menu" div class="pf-c-overflow-menu__content" diff --git a/app/views/stats/days/show.html.erb b/app/views/stats/days/show.html.erb index 4937e1b077..1fc621fb9b 100644 --- a/app/views/stats/days/show.html.erb +++ b/app/views/stats/days/show.html.erb @@ -6,10 +6,10 @@ <% @data.each do |date, data| %> -

<%= date.to_date.to_s(:long) %>

+

<%= date.to_date.to_fs(:long) %>

<%= area_line_chart(data, :class => 'small_chart', :line_color => '4477aa', - :x_label_proc => lambda { |time| time.to_s(:time) }, + :x_label_proc => lambda { |time| time.to_fs(:time) }, :x_labels_step => 2, :y_labels_count => 2) %> <% end %> diff --git a/app/workers/billing_worker.rb b/app/workers/billing_worker.rb index f8cb11a55b..81264d4fa1 100644 --- a/app/workers/billing_worker.rb +++ b/app/workers/billing_worker.rb @@ -52,7 +52,7 @@ def self.enqueue_for_buyer(buyer, billing_date) return end - time = billing_date.to_s(:iso8601) + time = billing_date.to_fs(:iso8601) perform_async(buyer.id, buyer.provider_account_id, time) end diff --git a/bin/rails b/bin/rails index 6fb4e4051c..efc0377492 100755 --- a/bin/rails +++ b/bin/rails @@ -1,4 +1,4 @@ #!/usr/bin/env ruby -APP_PATH = File.expand_path('../config/application', __dir__) +APP_PATH = File.expand_path("../config/application", __dir__) require_relative "../config/boot" require "rails/commands" diff --git a/bin/setup b/bin/setup index 634368ab93..56d78ce9e9 100755 --- a/bin/setup +++ b/bin/setup @@ -2,7 +2,7 @@ require "fileutils" # path to your application root. -APP_ROOT = File.expand_path('..', __dir__) +APP_ROOT = File.expand_path("..", __dir__) def system!(*args) system(*args) || abort("\n== Command #{args} failed ==") @@ -13,9 +13,9 @@ FileUtils.chdir APP_ROOT do # This script is idempotent, so that you can run it at any time and get an expectable outcome. # Add necessary setup steps to this file. - puts '== Installing dependencies ==' - system! 'gem install bundler --conservative' - system('bundle check') || system!('bundle install') + puts "== Installing dependencies ==" + system! "gem install bundler --conservative" + system("bundle check") || system!("bundle install") # Install JavaScript dependencies if using Yarn # system('bin/yarn') @@ -24,11 +24,11 @@ FileUtils.chdir APP_ROOT do cp_r 'config/examples/.', 'config/', preserve: true, dereference_root: true puts "\n== Preparing database ==" - system! 'bin/rails db:prepare' + system! "bin/rails db:prepare" puts "\n== Removing old logs and tempfiles ==" - system! 'bin/rails log:clear tmp:clear' + system! "bin/rails log:clear tmp:clear" puts "\n== Restarting application server ==" - system! 'bin/rails restart' + system! "bin/rails restart" end diff --git a/config/application.rb b/config/application.rb index 958a992e48..a00ea63ab4 100644 --- a/config/application.rb +++ b/config/application.rb @@ -3,7 +3,7 @@ require_relative "boot" # We don't want to load any Rails component we don't use -# See https://github.com/rails/rails/blob/v6.1.7.3/railties/lib/rails/all.rb for the list +# See https://github.com/rails/rails/blob/v7.0.8.6/railties/lib/rails/all.rb for the list # of what is being included here require "rails" @@ -58,13 +58,38 @@ class Application < Rails::Application # we do here instead of using initializers because of a Rails 5.1 vs # MySQL bug where `rake db:reset` causes ActiveRecord to be loaded # before initializers and causes configuration not to be respected. - config.load_defaults 6.1 + config.load_defaults 7.0 + + # TODO: consider removing this to enable the default value 'true', and setting `allow_other_host: true` for `redirect_to` only where needed + # Protect from open redirect attacks in `redirect_back_or_to` and `redirect_to`. + config.action_controller.raise_on_open_redirects = false + + # ** Please read carefully, this must be configured in config/application.rb ** + # Change the format of the cache entry. + # Changing this default means that all new cache entries added to the cache + # will have a different format that is not supported by Rails 6.1 applications. + # Only change this value after your application is fully deployed to Rails 7.0 + # and you have no plans to rollback. + # When you're ready to change format, change the value to 7.0 + # TODO: update to 7.0 - THREESCALE-11544 + config.active_support.cache_format_version = 6.1 + + # To migrate an existing application to the `:json` serializer, use the `:hybrid` option. + # + # Rails transparently deserializes existing (Marshal-serialized) cookies on read and + # re-writes them in the JSON format. + # + # It is fine to use `:hybrid` long term; you should do that until you're confident *all* your cookies + # have been converted to JSON. To keep using `:hybrid` long term, move this config to its own + # initializer or to `config/application.rb`. + # TODO: use the new default - THREESCALE-11545 + config.action_dispatch.cookies_serializer = :hybrid config.active_record.belongs_to_required_by_default = false config.active_record.include_root_in_json = true # Support for inversing belongs_to -> has_many Active Record associations. - # Overriding Rails 6.1 default, because it causes various issues. + # Overriding the default (since Rails 6.1) default, because it causes various issues. # Likely we need to keep it forever as we can't override it for individual use cases. # Also the feature has outstanding bugs: rails/rails#47559 rails/rails#50258. config.active_record.has_many_inversing = false @@ -79,10 +104,6 @@ class Application < Rails::Application # Make Ruby preserve the timezone of the receiver when calling `to_time`. config.active_support.to_time_preserves_timezone = false - # Use a modern approved hashing function. - # This is the default in Rails 7.0, so can be removed when we upgrade. - config.active_support.hash_digest_class = OpenSSL::Digest::SHA256 - # Applying the patch for CVE-2022-32224 broke YAML deserialization because some classes are disallowed in the serialized YAML config.active_record.yaml_column_permitted_classes = [Symbol, Time, Date, BigDecimal, OpenStruct, ActionController::Parameters, diff --git a/config/boot.rb b/config/boot.rb index 3ba7f4c2b9..3514eec327 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -1,4 +1,4 @@ -ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__) require "bundler/setup" # Set up gems listed in the Gemfile. diff --git a/config/environments/development.rb b/config/environments/development.rb index 0ac70c8a0f..befb2f0946 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -20,6 +20,9 @@ config.asset_host = config.three_scale.asset_host.presence + # Enable server timing + config.server_timing = true + # Match custom domains on development config.hosts << /.+\.localhost/ @@ -33,12 +36,9 @@ # when we don't set this, the default from application config is used # config.cache_store = :memory_store config.public_file_server.headers = { - 'Cache-Control' => "public, max-age=#{2.days.to_i}" + "Cache-Control" => "public, max-age=#{2.days.to_i}" } - # Store uploaded files on the local file system (see config/storage.yml for options) - # config.active_storage.service = :local - # Don't care if the mailer can't send. config.action_mailer.raise_delivery_errors = true config.action_mailer.perform_caching = false @@ -78,7 +78,7 @@ # Suppress logger output for asset requests. config.assets.quiet = true - # Raises error for missing translations + # Raises error for missing translations. config.i18n.raise_on_missing_translations = true # Annotate rendered view with file names. diff --git a/config/environments/production.rb b/config/environments/production.rb index 008b6061c7..217b12de2a 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -22,10 +22,10 @@ # 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? + # config.public_file_server.enabled = ENV["RAILS_SERVE_STATIC_FILES"].present? config.public_file_server.enabled = true config.public_file_server.headers = { - 'Cache-Control' => "public, max-age=#{(config.assets.digest ? 1.year : 1.minute).to_i}", + "Cache-Control" => "public, max-age=#{(config.assets.digest ? 1.year : 1.minute).to_i}", } # Compress JavaScripts and CSS. @@ -40,19 +40,11 @@ # `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' + # 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 - - # Store uploaded files on the local file system (see config/storage.yml for options) - # config.active_storage.service = :local - - # Mount Action Cable outside main process or domain - # config.action_cable.mount_path = nil - # config.action_cable.url = 'wss://example.com/cable' - # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ] + # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for Apache + # config.action_dispatch.x_sendfile_header = "X-Accel-Redirect" # for NGINX # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. # config.force_ssl = true @@ -67,9 +59,10 @@ # Use a different cache store in production. # config.cache_store = :mem_cache_store - # Use a real queuing backend for Active Job (and separate queues per environment) + # 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 = "system_#{Rails.env}" + # config.active_job.queue_name_prefix = "system_production" + config.action_mailer.perform_caching = false # Ignore bad email addresses and do not raise email delivery errors. @@ -80,6 +73,9 @@ # the I18n.default_locale when a translation cannot be found). config.i18n.fallbacks = true + # Don't log any deprecations. + # config.active_support.report_deprecations = false + # Send deprecation notices to registered listeners. config.active_support.deprecation = :notify @@ -94,7 +90,7 @@ # Use a different logger for distributed setups. # require "syslog/logger" - # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name') + # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new "app-name") if ENV["RAILS_LOG_TO_STDOUT"].present? logger = ActiveSupport::Logger.new(STDOUT) @@ -115,8 +111,7 @@ config.asset_host = config.three_scale.asset_host.presence - # do not change the tags withotu updating logstash rules - # https://github.com/3scale/puppet/blob/ac161671aee2019eefa87b51b150cb78fcb417e9/modules/logstash/templates/config/system-mt/filter.erb + # do not change the tags without updating logstash rules config.log_tags = [ :uuid, :host, :remote_ip ] config.middleware.insert_before ActionDispatch::Static, Rack::Deflater diff --git a/config/environments/test.rb b/config/environments/test.rb index 14fe179bec..61ec392c17 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -1,26 +1,28 @@ require "active_support/core_ext/integer/time" +# 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! + 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! + # Turn false under Spring and add config.action_view.cache_template_loading = true. config.cache_classes = true - # Do not eager load code on boot. This avoids loading your whole application - # just for the purpose of running a single test. If you are using a tool that - # preloads Rails for running tests, you may have to set it to true. - config.eager_load = !Kernel.const_defined?(:Spring) + # Eager loading loads your whole application. When running a single test locally, + # this probably isn't necessary. It's a good idea to do in a continuous integration + # system, or in some way before deploying your code. + config.eager_load = ENV["CI"].present? + # Configure public file server for tests with Cache-Control for performance. config.public_file_server.enabled = true config.public_file_server.headers = { - 'Cache-Control' => "public, max-age=#{1.hour.to_i}" + "Cache-Control" => "public, max-age=#{1.hour.to_i}" } # Show full error reports and disable caching. - # config.consider_all_requests_local = true config.consider_all_requests_local = false config.action_controller.perform_caching = false config.cache_store = :null_store @@ -30,10 +32,8 @@ # Disable request forgery protection in test environment. config.action_controller.allow_forgery_protection = false - config.action_mailer.perform_caching = false - # Store uploaded files on the local file system in a temporary directory - # config.active_storage.service = :test + config.action_mailer.perform_caching = false # Tell Action Mailer not to deliver emails to the real world. # The :test delivery method accumulates sent emails in the @@ -49,7 +49,7 @@ # Tell Active Support which deprecation messages to disallow. config.active_support.disallowed_deprecation_warnings = [] - # Raises error for missing translations + # Raises error for missing translations. config.i18n.raise_on_missing_translations = true # Annotate rendered view with file names. diff --git a/config/initializers/access_token_authentication.rb b/config/initializers/access_token_authentication.rb index 66482b96c4..dfdcee839b 100644 --- a/config/initializers/access_token_authentication.rb +++ b/config/initializers/access_token_authentication.rb @@ -1,21 +1,23 @@ # frozen_string_literal: true -ActiveSupport.on_load(:active_record) do - if defined?(ActiveRecord::ConnectionAdapters::Mysql2Adapter) - ActiveRecord::ConnectionAdapters::Mysql2Adapter.class_eval do - include ApiAuthentication::ByAccessToken::ConnectionExtension +Rails.application.config.to_prepare do + ActiveSupport.on_load(:active_record) do + if defined?(ActiveRecord::ConnectionAdapters::Mysql2Adapter) + ActiveRecord::ConnectionAdapters::Mysql2Adapter.class_eval do + include ApiAuthentication::ByAccessToken::ConnectionExtension + end end - end - if defined?(ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter) - ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter.class_eval do - include ApiAuthentication::ByAccessToken::OracleEnhancedConnectionExtension + if defined?(ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter) + ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter.class_eval do + include ApiAuthentication::ByAccessToken::OracleEnhancedConnectionExtension + end end - end - if defined?(ActiveRecord::ConnectionAdapters::PostgreSQLAdapter) - ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.class_eval do - include ApiAuthentication::ByAccessToken::ConnectionExtension + if defined?(ActiveRecord::ConnectionAdapters::PostgreSQLAdapter) + ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.class_eval do + include ApiAuthentication::ByAccessToken::ConnectionExtension + end end end end diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index 3350a8550e..9e05523b79 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -1,7 +1,7 @@ # Be sure to restart your server when you modify this file. # Version of your assets, change this if you want to expire all your assets. -Rails.application.config.assets.version = '1.0' +Rails.application.config.assets.version = "1.0" # We do not add to asset paths because or a webpacker compatibility # https://github.com/rails/webpacker/issues/1285#issuecomment-539553734 diff --git a/config/initializers/backend.rb b/config/initializers/backend.rb index 22f937e48d..b97db3c0e8 100644 --- a/config/initializers/backend.rb +++ b/config/initializers/backend.rb @@ -1,3 +1 @@ -require_or_load 'backend/error' - ThreeScale::Core::Logger.inject Rails.logger, prefix: '[core]' diff --git a/config/initializers/content_security_policy.rb b/config/initializers/content_security_policy.rb index 11eab26de8..f40d36938c 100644 --- a/config/initializers/content_security_policy.rb +++ b/config/initializers/content_security_policy.rb @@ -1,8 +1,8 @@ # Be sure to restart your server when you modify this file. -# Define an application-wide content security policy -# For further information see the following documentation -# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy +# Define an application-wide content security policy. +# See the Securing Rails Applications Guide for more information: +# https://guides.rubyonrails.org/security.html#content-security-policy-header Rails.application.config.to_prepare do Rails.application.config.content_security_policy do |policy| @@ -10,13 +10,22 @@ end end -# If you are using UJS then enable automatic nonce generation -# Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) } - -# Set the nonce only to specific directives -# Rails.application.config.content_security_policy_nonce_directives = %w(script-src) - -# Report CSP violations to a specified URI -# For further information see the following documentation: -# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only -# Rails.application.config.content_security_policy_report_only = true +# Rails.application.configure do +# config.content_security_policy do |policy| +# policy.default_src :self, :https +# policy.font_src :self, :https, :data +# policy.img_src :self, :https, :data +# policy.object_src :none +# policy.script_src :self, :https +# policy.style_src :self, :https +# # Specify URI for violation reports +# # policy.report_uri "/csp-violation-report-endpoint" +# end +# +# # Generate session nonces for permitted importmap and inline scripts +# config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s } +# config.content_security_policy_nonce_directives = %w(script-src) +# +# # Report violations without enforcing the policy. +# # config.content_security_policy_report_only = true +# end diff --git a/config/initializers/event_store.rb b/config/initializers/event_store.rb index 221598d93e..833ea0963a 100644 --- a/config/initializers/event_store.rb +++ b/config/initializers/event_store.rb @@ -1,10 +1,13 @@ # 0.9.0 version of rails_event_store gem causes active_record to load pre-maturely -ActiveSupport.on_load(:active_record) do - require 'rails_event_store' - require 'three_scale/sidekiq_retry_support' - System::Application.configure do - config = self.config - config.event_store = EventStore::Repository.new +Rails.application.config.to_prepare do + ActiveSupport.on_load(:active_record) do + require 'rails_event_store' + require 'three_scale/sidekiq_retry_support' + + System::Application.configure do + config = self.config + config.event_store = EventStore::Repository.new + end end end diff --git a/config/initializers/filter_parameter_logging.rb b/config/initializers/filter_parameter_logging.rb index 3ce3e7b391..ef59042a8e 100644 --- a/config/initializers/filter_parameter_logging.rb +++ b/config/initializers/filter_parameter_logging.rb @@ -1,7 +1,8 @@ -# frozen_string_literal: true # Be sure to restart your server when you modify this file. -# Configure sensitive parameters which will be filtered from the log file. +# Configure parameters to be filtered from the log file. Use this to limit dissemination of +# sensitive information. See the ActiveSupport::ParameterFilter documentation for supported +# notations and behaviors. Rails.application.config.filter_parameters += %i[activation_code cms_token credit_card credit_card_auth_code credit_card_authorize_net_payment_profile_token credit_card_expires_on credit_card_partial_number crypted_password janrain_api_key lost_password_token diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb index 6726ad1bf1..fffced996a 100644 --- a/config/initializers/inflections.rb +++ b/config/initializers/inflections.rb @@ -4,9 +4,9 @@ # are locale specific, and you may define rules for as many different # locales as you wish. All of these examples are active by default: # ActiveSupport::Inflector.inflections(:en) do |inflect| -# inflect.plural /^(ox)$/i, '\1en' -# inflect.singular /^(ox)en/i, '\1' -# inflect.irregular 'person', 'people' +# inflect.plural /^(ox)$/i, "\\1en" +# inflect.singular /^(ox)en/i, "\\1" +# inflect.irregular "person", "people" # inflect.uncountable %w( fish sheep ) # end ActiveSupport::Inflector.inflections do |inflect| @@ -27,5 +27,5 @@ # 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/initializers/money.rb b/config/initializers/money.rb index 5565bb24af..8753f3bd88 100644 --- a/config/initializers/money.rb +++ b/config/initializers/money.rb @@ -1,7 +1,8 @@ require 'three_scale/money_conversions' +require 'three_scale/has_money' ActiveSupport.on_load(:active_record) do - ActiveRecord::Base.send(:include, ThreeScale::HasMoney) + include ThreeScale::HasMoney end Rails.application.config.to_prepare do diff --git a/config/initializers/oracle.rb b/config/initializers/oracle.rb index b02372b2e9..32f553502e 100644 --- a/config/initializers/oracle.rb +++ b/config/initializers/oracle.rb @@ -5,7 +5,7 @@ require 'arel/visitors/oracle12_hack' ENV['SCHEMA'] = 'db/oracle_schema.rb' - Rails.configuration.active_record.schema_format = ActiveRecord::Base.schema_format = :ruby + Rails.configuration.active_record.schema_format = ActiveRecord.schema_format = :ruby ActiveRecord::ConnectionAdapters::TableDefinition.prepend(Module.new do def column(name, type, **options) @@ -183,5 +183,17 @@ def add_index(table_name, column_name, **options) #:nodoc: end end end + + # see https://github.com/rsim/oracle-enhanced/issues/2276 + module OracleEnhancedAdapterSchemaIssue2276 + def column_definitions(table_name) + deleted_object_id = prepared_statements_disabled_cache.delete(object_id) + super + ensure + prepared_statements_disabled_cache.add(deleted_object_id) if deleted_object_id + end + end + + ActiveRecord::ConnectionAdapters::OracleEnhancedAdapter.prepend OracleEnhancedAdapterSchemaIssue2276 end end diff --git a/config/initializers/permissions_policy.rb b/config/initializers/permissions_policy.rb new file mode 100644 index 0000000000..00f64d71b0 --- /dev/null +++ b/config/initializers/permissions_policy.rb @@ -0,0 +1,11 @@ +# Define an application-wide HTTP permissions policy. For further +# information see https://developers.google.com/web/updates/2018/06/feature-policy +# +# Rails.application.config.permissions_policy do |f| +# f.camera :none +# f.gyroscope :none +# f.microphone :none +# f.usb :none +# f.fullscreen :self +# f.payment :self, "https://secure.example.com" +# end diff --git a/config/initializers/time_formats.rb b/config/initializers/time_formats.rb index ce5fb95b7a..c99f00017b 100644 --- a/config/initializers/time_formats.rb +++ b/config/initializers/time_formats.rb @@ -3,5 +3,5 @@ Date::DATE_FORMATS[:db_month] = '%Y-%m' # This is like the :number, but with trailing zeroes removed. -Time::DATE_FORMATS[:compact] = ->(time) { time.to_s(:number).sub(/0{0,6}$/, '') } +Time::DATE_FORMATS[:compact] = ->(time) { time.to_fs(:number).sub(/0{0,6}$/, '') } Date::DATE_FORMATS[:compact] = Date::DATE_FORMATS[:number] diff --git a/config/initializers/wrap_parameters.rb b/config/initializers/wrap_parameters.rb deleted file mode 100644 index e55389b04e..0000000000 --- a/config/initializers/wrap_parameters.rb +++ /dev/null @@ -1,14 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# This file contains settings for ActionController::ParamsWrapper which -# is enabled by default. - -# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. -ActiveSupport.on_load(:action_controller) do - wrap_parameters format: [] -end - -# To enable root element in JSON for ActiveRecord objects. -# ActiveSupport.on_load(:active_record) do -# self.include_root_in_json = true -# end diff --git a/db/oracle_schema.rb b/db/oracle_schema.rb index d8ef595361..fe18ae9482 100644 --- a/db/oracle_schema.rb +++ b/db/oracle_schema.rb @@ -10,8 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2024_11_07_134140) do - +ActiveRecord::Schema[7.0].define(version: 2024_11_07_134140) do create_table "access_tokens", force: :cascade do |t| t.integer "owner_id", precision: 38, null: false t.text "scopes" @@ -19,16 +18,16 @@ t.string "name", null: false t.string "permission", null: false t.integer "tenant_id", precision: 38 - t.datetime "created_at", precision: 6 - t.datetime "updated_at", precision: 6 - t.datetime "expires_at", precision: 6 + t.datetime "created_at" + t.datetime "updated_at" + t.datetime "expires_at" end create_table "accounts", force: :cascade do |t| t.string "org_name", default: "", null: false t.string "org_legaladdress", default: "" - t.datetime "created_at", precision: 6, null: false - t.datetime "updated_at", precision: 6 + t.datetime "created_at", null: false + t.datetime "updated_at" t.boolean "provider", default: false t.boolean "buyer", default: false t.integer "country_id", precision: 38 @@ -53,7 +52,7 @@ t.string "state_region" t.string "state" t.boolean "paid", default: false - t.datetime "paid_at", precision: 6 + t.datetime "paid_at" t.boolean "signs_legal_terms", default: true t.string "timezone" t.boolean "delta", default: true, null: false @@ -76,7 +75,7 @@ t.integer "prepared_assets_version", precision: 38 t.boolean "sample_data" t.integer "proxy_configs_file_size", precision: 38 - t.datetime "proxy_configs_updated_at", precision: 6 + t.datetime "proxy_configs_updated_at" t.string "proxy_configs_content_type" t.string "proxy_configs_file_name" t.string "support_email" @@ -88,10 +87,10 @@ t.string "proxy_configs_conf_file_name" t.string "proxy_configs_conf_content_type" t.integer "proxy_configs_conf_file_size", precision: 38 - t.datetime "proxy_configs_conf_updated_at", precision: 6 - t.datetime "hosted_proxy_deployed_at", precision: 6 + t.datetime "proxy_configs_conf_updated_at" + t.datetime "hosted_proxy_deployed_at" t.string "po_number" - t.datetime "state_changed_at", precision: 6 + t.datetime "state_changed_at" t.index ["default_service_id"], name: "index_accounts_on_default_service_id" t.index ["domain", "state_changed_at"], name: "index_accounts_on_domain_and_state_changed_at" t.index ["domain"], name: "index_accounts_on_domain", unique: true @@ -105,7 +104,7 @@ create_table "alerts", force: :cascade do |t| t.integer "account_id", precision: 38, null: false - t.datetime "timestamp", precision: 6, null: false + t.datetime "timestamp", null: false t.string "state", null: false t.integer "cinstance_id", precision: 38, null: false t.decimal "utilization", precision: 6, scale: 2, null: false @@ -126,8 +125,8 @@ t.string "annotated_type", null: false t.integer "annotated_id", precision: 38, null: false t.integer "tenant_id", precision: 38 - 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 ["annotated_type", "annotated_id", "name"], name: "index_annotations_on_annotated_type_and_annotated_id_and_name", unique: true end @@ -138,8 +137,8 @@ t.text "body" t.text "description" t.boolean "published", default: false - t.datetime "created_at", precision: 6 - t.datetime "updated_at", precision: 6 + t.datetime "created_at" + t.datetime "updated_at" t.string "system_name" t.string "base_path" t.string "swagger_version" @@ -153,8 +152,8 @@ create_table "application_keys", force: :cascade do |t| t.integer "application_id", precision: 38, null: false t.string "value", null: false - t.datetime "created_at", precision: 6 - t.datetime "updated_at", precision: 6 + t.datetime "created_at" + t.datetime "updated_at" t.integer "tenant_id", precision: 38 t.index ["application_id", "value"], name: "index_application_keys_on_application_id_and_value", unique: true end @@ -167,7 +166,7 @@ t.string "username" t.string "action" t.integer "version", precision: 38, default: 0 - t.datetime "created_at", precision: 6 + t.datetime "created_at" t.integer "tenant_id", precision: 38 t.integer "provider_id", precision: 38 t.string "kind" @@ -199,8 +198,8 @@ t.string "authorize_url" t.string "site" t.integer "account_id", precision: 38 - t.datetime "created_at", precision: 6 - t.datetime "updated_at", precision: 6 + t.datetime "created_at" + t.datetime "updated_at" t.integer "tenant_id", precision: 38 t.string "identifier_key", default: "id" t.string "username_key", default: "login" @@ -220,8 +219,8 @@ t.string "path", default: "" t.integer "service_id", precision: 38 t.integer "backend_api_id", precision: 38 - 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.integer "tenant_id", precision: 38 t.index ["backend_api_id", "service_id"], name: "index_backend_api_configs_on_backend_api_id_and_service_id", unique: true t.index ["path", "service_id"], name: "index_backend_api_configs_on_path_and_service_id", unique: true @@ -234,8 +233,8 @@ t.text "description" t.string "private_endpoint" t.integer "account_id", precision: 38 - 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.integer "tenant_id", precision: 38 t.string "state", default: "published", null: false t.index ["account_id", "system_name"], name: "index_backend_apis_on_account_id_and_system_name", unique: true @@ -244,8 +243,8 @@ create_table "backend_events", force: :cascade do |t| t.text "data" - t.datetime "created_at", precision: 6, null: false - t.datetime "updated_at", precision: 6, null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end create_table "billing_strategies", force: :cascade do |t| @@ -254,8 +253,8 @@ t.boolean "charging_enabled", default: false t.integer "charging_retry_delay", precision: 38, default: 3 t.integer "charging_retry_times", precision: 38, default: 3 - t.datetime "created_at", precision: 6 - t.datetime "updated_at", precision: 6 + t.datetime "created_at" + t.datetime "updated_at" t.string "numbering_period", default: "monthly" t.string "currency", default: "USD" t.integer "tenant_id", precision: 38 @@ -267,8 +266,8 @@ t.integer "category_type_id", precision: 38 t.integer "parent_id", precision: 38 t.string "name" - t.datetime "created_at", precision: 6 - t.datetime "updated_at", precision: 6 + t.datetime "created_at" + t.datetime "updated_at" t.integer "account_id", precision: 38 t.integer "tenant_id", precision: 38 t.index ["account_id"], name: "index_categories_on_account_id" @@ -276,8 +275,8 @@ create_table "category_types", force: :cascade do |t| t.string "name" - t.datetime "created_at", precision: 6 - t.datetime "updated_at", precision: 6 + t.datetime "created_at" + t.datetime "updated_at" t.integer "account_id", precision: 38 t.integer "tenant_id", precision: 38 t.index ["account_id"], name: "index_category_types_on_account_id" @@ -288,25 +287,25 @@ t.integer "user_account_id", precision: 38 t.string "user_key", limit: 256 t.string "provider_public_key" - t.datetime "created_at", precision: 6, null: false - t.datetime "updated_at", precision: 6 + t.datetime "created_at", null: false + t.datetime "updated_at" t.string "state", null: false t.text "description" - t.datetime "paid_until", precision: 6 + t.datetime "paid_until" t.string "application_id" t.string "name" - t.datetime "trial_period_expires_at", precision: 6 + t.datetime "trial_period_expires_at" t.decimal "setup_fee", precision: 20, scale: 2, default: "0.0" t.string "type", default: "Cinstance", null: false t.text "redirect_url" - t.datetime "variable_cost_paid_until", precision: 6 + t.datetime "variable_cost_paid_until" t.text "extra_fields" t.integer "tenant_id", precision: 38 t.string "create_origin" - t.datetime "first_traffic_at", precision: 6 - t.datetime "first_daily_traffic_at", precision: 6 + t.datetime "first_traffic_at" + t.datetime "first_daily_traffic_at" t.integer "service_id", precision: 38 - t.datetime "accepted_at", precision: 6 + t.datetime "accepted_at" t.index ["application_id"], name: "index_cinstances_on_application_id" t.index ["plan_id"], name: "fk_ct_contract_id" t.index ["type", "plan_id", "service_id", "state"], name: "index_cinstances_on_type_and_plan_id_and_service_id_and_state" @@ -321,15 +320,15 @@ t.integer "provider_id", precision: 38, null: false t.integer "section_id", precision: 38 t.integer "tenant_id", precision: 38 - t.datetime "attachment_updated_at", precision: 6 + t.datetime "attachment_updated_at" t.string "attachment_content_type" t.integer "attachment_file_size", precision: 38 t.string "attachment_file_name" t.string "random_secret" t.string "path" t.boolean "downloadable" - t.datetime "created_at", precision: 6 - t.datetime "updated_at", precision: 6 + t.datetime "created_at" + t.datetime "updated_at" t.index ["provider_id", "path"], name: "index_cms_files_on_provider_id_and_path" t.index ["provider_id"], name: "index_cms_files_on_provider_id" t.index ["section_id"], name: "index_cms_files_on_section_id" @@ -346,8 +345,8 @@ t.integer "tenant_id", precision: 38 t.integer "provider_id", precision: 38, null: false t.string "name" - t.datetime "created_at", precision: 6 - t.datetime "updated_at", precision: 6 + t.datetime "created_at" + t.datetime "updated_at" t.index ["provider_id"], name: "index_cms_groups_on_provider_id" end @@ -355,8 +354,8 @@ t.integer "tenant_id", precision: 38 t.integer "account_id", precision: 38 t.string "name" - t.datetime "created_at", precision: 6 - t.datetime "updated_at", precision: 6 + t.datetime "created_at" + t.datetime "updated_at" t.integer "group_id", precision: 38 t.index ["account_id"], name: "index_cms_permissions_on_account_id" end @@ -365,8 +364,8 @@ t.integer "provider_id", precision: 38, null: false t.string "source", null: false t.string "target", null: false - t.datetime "created_at", precision: 6 - t.datetime "updated_at", precision: 6 + t.datetime "created_at" + t.datetime "updated_at" t.integer "tenant_id", precision: 38 t.index ["provider_id", "source"], name: "index_cms_redirects_on_provider_id_and_source" t.index ["provider_id"], name: "index_cms_redirects_on_provider_id" @@ -379,8 +378,8 @@ t.string "partial_path" t.string "title" t.string "system_name" - t.datetime "created_at", precision: 6 - t.datetime "updated_at", precision: 6 + t.datetime "created_at" + t.datetime "updated_at" t.boolean "public", default: true t.string "type", default: "CMS::Section" t.index ["parent_id"], name: "index_cms_sections_on_parent_id" @@ -399,8 +398,8 @@ t.text "draft" t.boolean "liquid_enabled" t.string "content_type" - t.datetime "created_at", precision: 6 - t.datetime "updated_at", precision: 6 + t.datetime "created_at" + t.datetime "updated_at" t.integer "layout_id", precision: 38 t.text "options" t.string "updated_by" @@ -427,8 +426,8 @@ t.text "draft" t.boolean "liquid_enabled" t.string "content_type" - t.datetime "created_at", precision: 6 - t.datetime "updated_at", precision: 6 + t.datetime "created_at" + t.datetime "updated_at" t.integer "layout_id", precision: 38 t.integer "template_id", precision: 38 t.string "template_type" @@ -445,8 +444,8 @@ t.string "configurable_type", limit: 50 t.string "name" t.string "value" - t.datetime "created_at", precision: 6 - t.datetime "updated_at", precision: 6 + t.datetime "created_at" + t.datetime "updated_at" t.integer "tenant_id", precision: 38 t.index ["configurable_id", "configurable_type", "name"], name: "index_on_configurable_and_name", unique: true t.index ["configurable_id", "configurable_type"], name: "index_on_configurable" @@ -457,8 +456,8 @@ t.string "name" t.string "currency" t.decimal "tax_rate", precision: 5, scale: 2, default: "0.0", null: false - t.datetime "created_at", precision: 6 - t.datetime "updated_at", precision: 6 + t.datetime "created_at" + t.datetime "updated_at" t.integer "tenant_id", precision: 38 t.boolean "enabled", default: true t.index ["code"], name: "index_countries_on_code" @@ -469,7 +468,7 @@ t.string "owner_type" t.integer "object_id", precision: 38 t.string "object_type" - t.datetime "created_at", precision: 6, null: false + t.datetime "created_at", null: false t.text "metadata" t.index ["object_type", "object_id"], name: "index_deleted_objects_on_object_type_and_object_id" t.index ["owner_type", "owner_id"], name: "index_deleted_objects_on_owner_type_and_owner_id" @@ -487,8 +486,8 @@ t.string "address" t.integer "port", precision: 38 t.integer "tenant_id", precision: 38 - 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 ["account_id"], name: "index_email_configurations_on_account_id" t.index ["email"], name: "index_email_configurations_on_email", unique: true end @@ -499,7 +498,7 @@ t.string "event_id", null: false t.text "metadata" t.text "data" - t.datetime "created_at", precision: 6, null: false + t.datetime "created_at", null: false t.integer "provider_id", precision: 38 t.integer "tenant_id", precision: 38 t.index ["created_at"], name: "index_event_store_events_on_created_at" @@ -512,8 +511,8 @@ t.integer "featurable_id", precision: 38 t.string "name" t.text "description" - t.datetime "created_at", precision: 6 - t.datetime "updated_at", precision: 6 + t.datetime "created_at" + t.datetime "updated_at" t.string "system_name" t.boolean "visible", default: true, null: false t.string "featurable_type", default: "Service", null: false @@ -534,8 +533,8 @@ create_table "fields_definitions", force: :cascade do |t| t.integer "account_id", precision: 38 - t.datetime "created_at", precision: 6 - t.datetime "updated_at", precision: 6 + t.datetime "created_at" + t.datetime "updated_at" t.string "target" t.boolean "hidden", default: false t.boolean "required", default: false @@ -568,15 +567,15 @@ t.text "settings" t.integer "proxy_id", precision: 38 t.integer "tenant_id", precision: 38 - 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 ["proxy_id"], name: "index_gateway_configurations_on_proxy_id", unique: true end create_table "go_live_states", force: :cascade do |t| t.integer "account_id", precision: 38 - 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.text "steps" t.string "recent" t.boolean "finished", default: false @@ -587,11 +586,11 @@ create_table "invitations", force: :cascade do |t| t.string "token" t.string "email" - t.datetime "sent_at", precision: 6 - t.datetime "created_at", precision: 6 - t.datetime "updated_at", precision: 6 + t.datetime "sent_at" + t.datetime "created_at" + t.datetime "updated_at" t.integer "account_id", precision: 38 - t.datetime "accepted_at", precision: 6 + t.datetime "accepted_at" t.integer "tenant_id", precision: 38 t.integer "user_id", precision: 38 end @@ -600,28 +599,28 @@ t.integer "provider_account_id", precision: 38, null: false t.string "invoice_prefix", null: false t.integer "invoice_count", precision: 38, default: 0 - t.datetime "created_at", precision: 6 - t.datetime "updated_at", precision: 6 + t.datetime "created_at" + t.datetime "updated_at" t.index ["provider_account_id", "invoice_prefix"], name: "index_invoice_counters_provider_prefix", unique: true end create_table "invoices", force: :cascade do |t| t.integer "provider_account_id", precision: 38 t.integer "buyer_account_id", precision: 38 - t.datetime "paid_at", precision: 6 - t.datetime "created_at", precision: 6 - t.datetime "updated_at", precision: 6 + t.datetime "paid_at" + t.datetime "created_at" + t.datetime "updated_at" t.date "due_on" t.string "pdf_file_name" t.string "pdf_content_type" t.integer "pdf_file_size", precision: 38 - t.datetime "pdf_updated_at", precision: 6 + t.datetime "pdf_updated_at" t.date "period" t.date "issued_on" t.string "state", default: "open", null: false t.string "friendly_id", default: "fix", null: false t.integer "tenant_id", precision: 38 - t.datetime "finalized_at", precision: 6 + t.datetime "finalized_at" t.string "fiscal_code" t.string "vat_code" t.decimal "vat_rate", precision: 20, scale: 2 @@ -657,8 +656,8 @@ t.integer "legal_term_version", precision: 38 t.string "resource_type" t.integer "resource_id", precision: 38 - t.datetime "created_at", precision: 6 - t.datetime "updated_at", precision: 6 + t.datetime "created_at" + t.datetime "updated_at" t.integer "tenant_id", precision: 38 t.integer "account_id", precision: 38 t.index ["account_id"], name: "index_legal_term_acceptances_on_account_id" @@ -669,8 +668,8 @@ t.integer "legal_term_version", precision: 38 t.string "resource_type" t.integer "resource_id", precision: 38 - t.datetime "created_at", precision: 6 - t.datetime "updated_at", precision: 6 + t.datetime "created_at" + t.datetime "updated_at" t.string "scope" t.integer "tenant_id", precision: 38 end @@ -681,8 +680,8 @@ t.string "name" t.string "slug" t.text "body" - t.datetime "created_at", precision: 6 - t.datetime "updated_at", precision: 6 + t.datetime "created_at" + t.datetime "updated_at" t.boolean "published", default: false t.boolean "deleted", default: false t.boolean "archived", default: false @@ -698,8 +697,8 @@ t.string "name" t.string "slug" t.text "body" - t.datetime "created_at", precision: 6 - t.datetime "updated_at", precision: 6 + t.datetime "created_at" + t.datetime "updated_at" t.boolean "published", default: false t.boolean "deleted", default: false t.boolean "archived", default: false @@ -715,11 +714,11 @@ t.string "name" t.string "description" t.decimal "cost", precision: 20, scale: 4, default: "0.0", null: false - t.datetime "created_at", precision: 6 - t.datetime "updated_at", precision: 6 + t.datetime "created_at" + t.datetime "updated_at" t.string "type", default: "" t.integer "metric_id", precision: 38 - t.datetime "finished_at", precision: 6 + t.datetime "finished_at" t.integer "quantity", precision: 38 t.date "started_at" t.integer "tenant_id", precision: 38 @@ -736,8 +735,8 @@ t.integer "buyer_id", precision: 38 t.integer "level", precision: 38, default: 10 t.string "description" - t.datetime "created_at", precision: 6 - t.datetime "updated_at", precision: 6 + t.datetime "created_at" + t.datetime "updated_at" t.index ["provider_id"], name: "index_log_entries_on_provider_id" end @@ -746,8 +745,8 @@ t.integer "system_operation_id", precision: 38 t.text "emails" t.boolean "dispatch", default: true - t.datetime "created_at", precision: 6 - t.datetime "updated_at", precision: 6 + t.datetime "created_at" + t.datetime "updated_at" t.integer "tenant_id", precision: 38 t.index ["account_id", "system_operation_id"], name: "index_mail_dispatch_rules_on_account_id_and_system_operation_id", unique: true end @@ -755,8 +754,8 @@ create_table "member_permissions", force: :cascade do |t| t.integer "user_id", precision: 38 t.string "admin_section" - t.datetime "created_at", precision: 6 - t.datetime "updated_at", precision: 6 + t.datetime "created_at" + t.datetime "updated_at" t.integer "tenant_id", precision: 38 t.binary "service_ids" t.index ["user_id"], name: "index_member_permissions_on_user_id" @@ -769,9 +768,9 @@ t.string "kind", default: "", null: false t.integer "position", precision: 38 t.string "state", null: false - t.datetime "hidden_at", precision: 6 + t.datetime "hidden_at" t.integer "tenant_id", precision: 38 - t.datetime "deleted_at", precision: 6 + t.datetime "deleted_at" t.index ["message_id", "kind"], name: "index_message_recipients_on_message_id_and_kind" t.index ["receiver_id"], name: "idx_receiver_id" end @@ -781,10 +780,10 @@ t.text "subject" t.text "body" t.string "state", null: false - t.datetime "hidden_at", precision: 6 + t.datetime "hidden_at" t.string "type" - t.datetime "created_at", precision: 6 - t.datetime "updated_at", precision: 6 + t.datetime "created_at" + t.datetime "updated_at" t.integer "system_operation_id", precision: 38 t.text "headers" t.integer "tenant_id", precision: 38 @@ -796,8 +795,8 @@ t.string "system_name" t.text "description" t.string "unit" - t.datetime "created_at", precision: 6, null: false - t.datetime "updated_at", precision: 6 + t.datetime "created_at", null: false + t.datetime "updated_at" t.integer "service_id", precision: 38 t.string "friendly_name" t.integer "parent_id", precision: 38 @@ -814,16 +813,16 @@ create_table "moderatorships", force: :cascade do |t| t.integer "forum_id", precision: 38 t.integer "user_id", precision: 38 - t.datetime "created_at", precision: 6 - t.datetime "updated_at", precision: 6 + t.datetime "created_at" + t.datetime "updated_at" t.integer "tenant_id", precision: 38 end create_table "notification_preferences", force: :cascade do |t| t.integer "user_id", precision: 38 t.binary "preferences" - t.datetime "created_at", precision: 6 - t.datetime "updated_at", precision: 6 + t.datetime "created_at" + t.datetime "updated_at" t.integer "tenant_id", precision: 38 t.index ["user_id"], name: "index_notification_preferences_on_user_id", unique: true end @@ -833,8 +832,8 @@ t.string "event_id", null: false t.string "system_name", limit: 1000 t.string "state", limit: 20 - t.datetime "created_at", precision: 6 - t.datetime "updated_at", precision: 6 + t.datetime "created_at" + t.datetime "updated_at" t.string "title", limit: 1000 t.index ["event_id"], name: "index_notifications_on_event_id" t.index ["user_id"], name: "index_notifications_on_user_id" @@ -845,8 +844,8 @@ t.string "oidc_configurable_type", null: false t.integer "oidc_configurable_id", precision: 38, null: false t.integer "tenant_id", precision: 38 - 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 ["oidc_configurable_type", "oidc_configurable_id"], name: "oidc_configurable", unique: true end @@ -856,8 +855,8 @@ t.string "bubble_api_state" t.string "bubble_metric_state" t.string "bubble_deployment_state" - 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.string "bubble_mapping_state" t.string "bubble_limit_state" t.integer "tenant_id", precision: 38 @@ -867,8 +866,8 @@ create_table "partners", force: :cascade do |t| t.string "name" t.string "api_key" - 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.string "system_name" t.string "logout_url" end @@ -879,8 +878,8 @@ t.string "payment_service_reference" t.string "credit_card_partial_number" t.date "credit_card_expires_on" - 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.integer "tenant_id", precision: 38 t.string "payment_method_id" t.index ["account_id", "buyer_reference"], name: "index_payment_details_on_account_id_and_buyer_reference" @@ -892,8 +891,8 @@ t.binary "gateway_settings" t.string "gateway_type" t.integer "account_id", precision: 38 - t.datetime "created_at", precision: 6 - t.datetime "updated_at", precision: 6 + t.datetime "created_at" + t.datetime "updated_at" t.integer "tenant_id", precision: 38 t.index ["account_id"], name: "index_payment_gateway_settings_on_account_id" end @@ -902,8 +901,8 @@ t.integer "invoice_id", precision: 38, null: false t.string "state" t.integer "tenant_id", precision: 38 - 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.string "reference" t.index ["invoice_id"], name: "index_payment_intents_on_invoice_id" t.index ["reference"], name: "index_payment_intents_on_reference", unique: true @@ -921,8 +920,8 @@ t.string "action" t.text "params" t.boolean "test", default: false, null: false - t.datetime "created_at", precision: 6 - t.datetime "updated_at", precision: 6 + t.datetime "created_at" + t.datetime "updated_at" t.integer "tenant_id", precision: 38 t.index ["invoice_id"], name: "index_payment_transactions_on_invoice_id" end @@ -932,8 +931,8 @@ t.integer "metric_id", precision: 38 t.boolean "visible", default: true t.boolean "limits_only_text", default: true - t.datetime "created_at", precision: 6 - t.datetime "updated_at", precision: 6 + t.datetime "created_at" + t.datetime "updated_at" t.string "plan_type", null: false t.integer "tenant_id", precision: 38 t.index ["metric_id"], name: "idx_plan_metrics_metric_id" @@ -947,8 +946,8 @@ t.text "full_legal" t.decimal "cost_per_month", precision: 20, scale: 4, default: "0.0", null: false t.integer "trial_period_days", precision: 38 - t.datetime "created_at", precision: 6 - t.datetime "updated_at", precision: 6 + t.datetime "created_at" + t.datetime "updated_at" t.integer "position", precision: 38, default: 0 t.string "state", null: false t.integer "cancellation_period", precision: 38, default: 0, null: false @@ -975,8 +974,8 @@ t.binary "schema", null: false t.integer "account_id", precision: 38, null: false t.integer "tenant_id", precision: 38 - t.datetime "created_at", precision: 6 - t.datetime "updated_at", precision: 6 + t.datetime "created_at" + t.datetime "updated_at" t.string "identifier" t.index ["account_id", "identifier"], name: "index_policies_on_account_id_and_identifier", unique: true t.index ["account_id"], name: "index_policies_on_account_id" @@ -986,8 +985,8 @@ t.integer "user_id", precision: 38 t.integer "topic_id", precision: 38 t.text "body" - t.datetime "created_at", precision: 6 - t.datetime "updated_at", precision: 6 + t.datetime "created_at" + t.datetime "updated_at" t.integer "forum_id", precision: 38 t.text "body_html" t.string "email" @@ -1005,8 +1004,8 @@ t.integer "min", precision: 38, default: 1, null: false t.integer "max", precision: 38 t.decimal "cost_per_unit", precision: 20, scale: 4, default: "0.0", null: false - t.datetime "created_at", precision: 6 - t.datetime "updated_at", precision: 6 + t.datetime "created_at" + t.datetime "updated_at" t.integer "plan_id", precision: 38 t.integer "tenant_id", precision: 38 end @@ -1021,8 +1020,8 @@ t.string "email_sales" t.string "email_techsupport" t.string "email_press" - t.datetime "created_at", precision: 6 - t.datetime "updated_at", precision: 6 + t.datetime "created_at" + t.datetime "updated_at" t.string "logo_file_name" t.string "logo_content_type" t.integer "logo_file_size", precision: 38 @@ -1039,9 +1038,9 @@ t.text "value" t.integer "user_id", precision: 38 t.integer "tenant_id", precision: 38 - t.datetime "expires_at", precision: 6 - t.datetime "created_at", precision: 6 - t.datetime "updated_at", precision: 6 + t.datetime "expires_at" + t.datetime "created_at" + t.datetime "updated_at" end create_table "provider_constraints", force: :cascade do |t| @@ -1049,8 +1048,8 @@ t.integer "provider_id", precision: 38 t.integer "max_users", precision: 38 t.integer "max_services", precision: 38 - 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 ["provider_id"], name: "index_provider_constraints_on_provider_id", unique: true end @@ -1058,15 +1057,15 @@ t.integer "tenant_id", precision: 38 t.integer "service_id", precision: 38 t.string "endpoint" - t.datetime "deployed_at", precision: 6 + t.datetime "deployed_at" t.string "auth_app_key", default: "app_key" t.string "auth_app_id", default: "app_id" t.string "auth_user_key", default: "user_key" t.string "credentials_location", default: "query", null: false t.string "error_auth_failed", default: "Authentication failed" t.string "error_auth_missing", default: "Authentication parameters missing" - t.datetime "created_at", precision: 6 - t.datetime "updated_at", precision: 6 + t.datetime "created_at" + t.datetime "updated_at" t.integer "error_status_auth_failed", precision: 38, default: 403, null: false t.string "error_headers_auth_failed", default: "text/plain; charset=us-ascii", null: false t.integer "error_status_auth_missing", precision: 38, default: 403, null: false @@ -1097,8 +1096,8 @@ create_table "proxy_config_affecting_changes", force: :cascade do |t| t.integer "proxy_id", precision: 38, null: false - t.datetime "created_at", precision: 6, null: false - t.datetime "updated_at", precision: 6, null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false t.index ["proxy_id"], name: "index_proxy_config_affecting_changes_on_proxy_id", unique: true end @@ -1109,8 +1108,8 @@ t.integer "tenant_id", precision: 38 t.string "environment", null: false t.text "content", null: false - t.datetime "created_at", precision: 6, null: false - t.datetime "updated_at", precision: 6, null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false t.string "hosts", limit: 8192 t.index ["proxy_id", "environment", "version"], name: "index_proxy_configs_on_proxy_id_and_environment_and_version" t.index ["proxy_id"], name: "index_proxy_configs_on_proxy_id" @@ -1122,8 +1121,8 @@ t.integer "tenant_id", precision: 38 t.text "lua_file" t.string "status" - t.datetime "created_at", precision: 6 - t.datetime "updated_at", precision: 6 + t.datetime "created_at" + t.datetime "updated_at" end create_table "proxy_rules", force: :cascade do |t| @@ -1134,8 +1133,8 @@ t.string "metric_system_name" t.integer "delta", precision: 38 t.integer "tenant_id", precision: 38 - t.datetime "created_at", precision: 6, null: false - t.datetime "updated_at", precision: 6 + t.datetime "created_at", null: false + t.datetime "updated_at" t.text "redirect_url" t.integer "position", precision: 38 t.boolean "last", default: false @@ -1148,8 +1147,8 @@ create_table "referrer_filters", force: :cascade do |t| t.integer "application_id", precision: 38, null: false t.string "value", null: false - t.datetime "created_at", precision: 6 - t.datetime "updated_at", precision: 6 + t.datetime "created_at" + t.datetime "updated_at" t.integer "tenant_id", precision: 38 t.index ["application_id"], name: "index_referrer_filters_on_application_id" end @@ -1157,16 +1156,16 @@ create_table "service_cubert_infos", force: :cascade do |t| t.string "bucket_id" t.integer "service_id", precision: 38 - 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.integer "tenant_id", precision: 38 end create_table "service_tokens", force: :cascade do |t| t.integer "service_id", precision: 38 t.string "value" - t.datetime "created_at", precision: 6 - t.datetime "updated_at", precision: 6 + t.datetime "created_at" + t.datetime "updated_at" t.integer "tenant_id", precision: 38 t.index ["service_id"], name: "index_service_tokens_on_service_id" end @@ -1176,8 +1175,8 @@ t.string "name", default: "" t.text "description" t.text "txt_support" - t.datetime "created_at", precision: 6 - t.datetime "updated_at", precision: 6 + t.datetime "created_at" + t.datetime "updated_at" t.string "logo_file_name" t.string "logo_content_type" t.integer "logo_file_size", precision: 38 @@ -1211,8 +1210,8 @@ t.string "bg_colour" t.string "link_colour" t.string "text_colour" - t.datetime "created_at", precision: 6 - t.datetime "updated_at", precision: 6 + t.datetime "created_at" + t.datetime "updated_at" t.string "menu_bg_colour" t.string "link_label" t.string "link_url" @@ -1284,7 +1283,7 @@ t.string "name" t.string "sluggable_type", limit: 50 t.integer "sluggable_id", precision: 38 - t.datetime "created_at", precision: 6 + t.datetime "created_at" t.integer "sequence", precision: 38, default: 1, null: false t.integer "tenant_id", precision: 38 t.index ["name", "sluggable_type", "sequence"], name: "index_slugs_on_n_s_and_s" @@ -1295,8 +1294,8 @@ t.string "uid" t.integer "authentication_provider_id", precision: 38 t.integer "user_id", precision: 38 - t.datetime "created_at", precision: 6 - t.datetime "updated_at", precision: 6 + t.datetime "created_at" + t.datetime "updated_at" t.integer "tenant_id", precision: 38 t.text "id_token" t.index ["authentication_provider_id"], name: "index_sso_authorizations_on_authentication_provider_id" @@ -1307,8 +1306,8 @@ t.string "ref" t.string "name" t.text "description" - t.datetime "created_at", precision: 6 - t.datetime "updated_at", precision: 6 + t.datetime "created_at" + t.datetime "updated_at" t.integer "pos", precision: 38 t.integer "tenant_id", precision: 38 end @@ -1317,8 +1316,8 @@ t.integer "tag_id", precision: 38 t.integer "taggable_id", precision: 38 t.string "taggable_type" - t.datetime "created_at", precision: 6 - t.datetime "updated_at", precision: 6 + t.datetime "created_at" + t.datetime "updated_at" t.integer "tenant_id", precision: 38 t.integer "tagger_id", precision: 38 t.string "tagger_type" @@ -1329,8 +1328,8 @@ create_table "tags", force: :cascade do |t| t.string "name" - t.datetime "created_at", precision: 6 - t.datetime "updated_at", precision: 6 + t.datetime "created_at" + t.datetime "updated_at" t.integer "account_id", precision: 38 t.integer "tenant_id", precision: 38 t.integer "taggings_count", precision: 38, default: 0 @@ -1340,8 +1339,8 @@ create_table "topic_categories", force: :cascade do |t| t.string "name" - t.datetime "created_at", precision: 6 - t.datetime "updated_at", precision: 6 + t.datetime "created_at" + t.datetime "updated_at" t.integer "forum_id", precision: 38 t.integer "tenant_id", precision: 38 t.index ["forum_id"], name: "index_topic_categories_on_forum_id" @@ -1351,14 +1350,14 @@ t.integer "forum_id", precision: 38 t.integer "user_id", precision: 38 t.string "title" - t.datetime "created_at", precision: 6 - t.datetime "updated_at", precision: 6 + t.datetime "created_at" + t.datetime "updated_at" t.integer "hits", precision: 38, default: 0 t.boolean "sticky", default: false, null: false t.integer "posts_count", precision: 38, default: 0 t.boolean "locked", default: false t.integer "last_post_id", precision: 38 - t.datetime "last_updated_at", precision: 6 + t.datetime "last_updated_at" t.integer "last_user_id", precision: 38 t.string "permalink" t.integer "category_id", precision: 38 @@ -1373,8 +1372,8 @@ t.integer "metric_id", precision: 38 t.string "period" t.integer "value", precision: 38 - t.datetime "created_at", precision: 6 - t.datetime "updated_at", precision: 6 + t.datetime "created_at" + t.datetime "updated_at" t.integer "plan_id", precision: 38 t.string "plan_type", null: false t.integer "tenant_id", precision: 38 @@ -1388,11 +1387,11 @@ t.string "key" t.string "ip" t.string "user_agent" - t.datetime "accessed_at", precision: 6 - t.datetime "revoked_at", precision: 6 - t.datetime "created_at", precision: 6, null: false - t.datetime "updated_at", precision: 6, null: false - t.datetime "secured_until", precision: 6 + t.datetime "accessed_at" + t.datetime "revoked_at" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.datetime "secured_until" t.integer "sso_authorization_id", precision: 38 t.index ["key"], name: "idx_key" t.index ["user_id"], name: "idx_user_id" @@ -1401,8 +1400,8 @@ create_table "user_topics", force: :cascade do |t| t.integer "user_id", precision: 38 t.integer "topic_id", precision: 38 - t.datetime "created_at", precision: 6 - t.datetime "updated_at", precision: 6 + t.datetime "created_at" + t.datetime "updated_at" t.integer "tenant_id", precision: 38 end @@ -1411,12 +1410,12 @@ t.string "email" t.string "crypted_password", limit: 40 t.string "salt", limit: 40 - t.datetime "created_at", precision: 6, null: false - t.datetime "updated_at", precision: 6 + t.datetime "created_at", null: false + t.datetime "updated_at" t.string "remember_token", limit: 40 - t.datetime "remember_token_expires_at", precision: 6 + t.datetime "remember_token_expires_at" t.string "activation_code", limit: 40 - t.datetime "activated_at", precision: 6 + t.datetime "activated_at" t.string "state" t.string "role", default: "" t.string "lost_password_token" @@ -1426,14 +1425,14 @@ t.string "last_name" t.string "signup_type" t.string "job_role" - t.datetime "last_login_at", precision: 6 + t.datetime "last_login_at" t.string "last_login_ip" t.string "email_verification_code" t.string "title" t.text "extra_fields" t.integer "tenant_id", precision: 38 t.string "cas_identifier" - t.datetime "lost_password_token_generated_at", precision: 6 + t.datetime "lost_password_token_generated_at" t.string "authentication_id" t.string "open_id" t.string "password_digest" @@ -1456,8 +1455,8 @@ t.boolean "application_created_on", default: false t.boolean "application_updated_on", default: false t.boolean "application_deleted_on", default: false - t.datetime "created_at", precision: 6 - t.datetime "updated_at", precision: 6 + t.datetime "created_at" + t.datetime "updated_at" t.boolean "provider_actions", default: false t.boolean "account_plan_changed_on", default: false t.boolean "application_plan_changed_on", default: false diff --git a/db/postgres_schema.rb b/db/postgres_schema.rb index d4a4c5f2b8..5ab56cac3e 100644 --- a/db/postgres_schema.rb +++ b/db/postgres_schema.rb @@ -10,8 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2024_11_07_134140) do - +ActiveRecord::Schema[7.0].define(version: 2024_11_07_134140) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -22,16 +21,16 @@ t.string "name", limit: 255, null: false t.string "permission", limit: 255, null: false t.bigint "tenant_id" - t.datetime "created_at" - t.datetime "updated_at" - t.datetime "expires_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil + t.datetime "expires_at", precision: nil end create_table "accounts", force: :cascade do |t| t.string "org_name", limit: 255, default: "", null: false t.string "org_legaladdress", limit: 255, default: "" - t.datetime "created_at", null: false - t.datetime "updated_at" + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil t.boolean "provider", default: false t.boolean "buyer", default: false t.bigint "country_id" @@ -56,7 +55,7 @@ t.string "state_region", limit: 255 t.string "state", limit: 255 t.boolean "paid", default: false - t.datetime "paid_at" + t.datetime "paid_at", precision: nil t.boolean "signs_legal_terms", default: true t.string "timezone", limit: 255 t.boolean "delta", default: true, null: false @@ -79,7 +78,7 @@ t.integer "prepared_assets_version" t.boolean "sample_data" t.integer "proxy_configs_file_size" - t.datetime "proxy_configs_updated_at" + t.datetime "proxy_configs_updated_at", precision: nil t.string "proxy_configs_content_type", limit: 255 t.string "proxy_configs_file_name", limit: 255 t.string "support_email", limit: 255 @@ -91,10 +90,10 @@ t.string "proxy_configs_conf_file_name", limit: 255 t.string "proxy_configs_conf_content_type", limit: 255 t.integer "proxy_configs_conf_file_size" - t.datetime "proxy_configs_conf_updated_at" - t.datetime "hosted_proxy_deployed_at" + t.datetime "proxy_configs_conf_updated_at", precision: nil + t.datetime "hosted_proxy_deployed_at", precision: nil t.string "po_number", limit: 255 - t.datetime "state_changed_at" + t.datetime "state_changed_at", precision: nil t.index ["default_service_id"], name: "index_accounts_on_default_service_id" t.index ["domain", "state_changed_at"], name: "index_accounts_on_domain_and_state_changed_at" t.index ["domain"], name: "index_accounts_on_domain", unique: true @@ -108,7 +107,7 @@ create_table "alerts", force: :cascade do |t| t.bigint "account_id", null: false - t.datetime "timestamp", null: false + t.datetime "timestamp", precision: nil, null: false t.string "state", limit: 255, null: false t.bigint "cinstance_id", null: false t.decimal "utilization", precision: 6, scale: 2, null: false @@ -129,8 +128,8 @@ t.string "annotated_type", null: false t.bigint "annotated_id", null: false t.integer "tenant_id" - t.datetime "created_at", precision: 6, null: false - t.datetime "updated_at", precision: 6, null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false t.index ["annotated_type", "annotated_id", "name"], name: "index_annotations_on_annotated_type_and_annotated_id_and_name", unique: true end @@ -141,8 +140,8 @@ t.text "body" t.text "description" t.boolean "published", default: false - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.string "system_name", limit: 255 t.string "base_path", limit: 255 t.string "swagger_version", limit: 255 @@ -156,8 +155,8 @@ create_table "application_keys", force: :cascade do |t| t.bigint "application_id", null: false t.string "value", limit: 255, null: false - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.bigint "tenant_id" t.index ["application_id", "value"], name: "index_application_keys_on_application_id_and_value", unique: true end @@ -170,7 +169,7 @@ t.string "username", limit: 255 t.string "action", limit: 255 t.integer "version", default: 0 - t.datetime "created_at" + t.datetime "created_at", precision: nil t.bigint "tenant_id" t.bigint "provider_id" t.string "kind", limit: 255 @@ -202,8 +201,8 @@ t.string "authorize_url", limit: 255 t.string "site", limit: 255 t.bigint "account_id" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.bigint "tenant_id" t.string "identifier_key", limit: 255, default: "id" t.string "username_key", limit: 255, default: "login" @@ -223,8 +222,8 @@ t.string "path", default: "" t.bigint "service_id" t.bigint "backend_api_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.bigint "tenant_id" t.index ["backend_api_id", "service_id"], name: "index_backend_api_configs_on_backend_api_id_and_service_id", unique: true t.index ["path", "service_id"], name: "index_backend_api_configs_on_path_and_service_id", unique: true @@ -237,8 +236,8 @@ t.text "description" t.string "private_endpoint" t.bigint "account_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.bigint "tenant_id" t.string "state", default: "published", null: false t.index ["account_id", "system_name"], name: "index_backend_apis_on_account_id_and_system_name", unique: true @@ -247,8 +246,8 @@ create_table "backend_events", id: :bigint, default: nil, force: :cascade do |t| t.text "data" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false end create_table "billing_strategies", force: :cascade do |t| @@ -257,8 +256,8 @@ t.boolean "charging_enabled", default: false t.integer "charging_retry_delay", default: 3 t.integer "charging_retry_times", default: 3 - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.string "numbering_period", limit: 255, default: "monthly" t.string "currency", limit: 255, default: "USD" t.bigint "tenant_id" @@ -270,8 +269,8 @@ t.bigint "category_type_id" t.bigint "parent_id" t.string "name", limit: 255 - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.bigint "account_id" t.bigint "tenant_id" t.index ["account_id"], name: "index_categories_on_account_id" @@ -279,8 +278,8 @@ create_table "category_types", force: :cascade do |t| t.string "name", limit: 255 - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.bigint "account_id" t.bigint "tenant_id" t.index ["account_id"], name: "index_category_types_on_account_id" @@ -291,25 +290,25 @@ t.bigint "user_account_id" t.string "user_key", limit: 256 t.string "provider_public_key", limit: 255 - t.datetime "created_at", null: false - t.datetime "updated_at" + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil t.string "state", limit: 255, null: false t.text "description" - t.datetime "paid_until" + t.datetime "paid_until", precision: nil t.string "application_id", limit: 255 t.string "name", limit: 255 - t.datetime "trial_period_expires_at" + t.datetime "trial_period_expires_at", precision: nil t.decimal "setup_fee", precision: 20, scale: 2, default: "0.0" t.string "type", limit: 255, default: "Cinstance", null: false t.text "redirect_url" - t.datetime "variable_cost_paid_until" + t.datetime "variable_cost_paid_until", precision: nil t.text "extra_fields" t.bigint "tenant_id" t.string "create_origin", limit: 255 - t.datetime "first_traffic_at" - t.datetime "first_daily_traffic_at" + t.datetime "first_traffic_at", precision: nil + t.datetime "first_daily_traffic_at", precision: nil t.bigint "service_id" - t.datetime "accepted_at" + t.datetime "accepted_at", precision: nil t.index ["application_id"], name: "index_cinstances_on_application_id" t.index ["plan_id"], name: "fk_ct_contract_id" t.index ["type", "plan_id", "service_id", "state"], name: "index_cinstances_on_type_and_plan_id_and_service_id_and_state" @@ -324,15 +323,15 @@ t.bigint "provider_id", null: false t.bigint "section_id" t.bigint "tenant_id" - t.datetime "attachment_updated_at" + t.datetime "attachment_updated_at", precision: nil t.string "attachment_content_type", limit: 255 t.bigint "attachment_file_size" t.string "attachment_file_name", limit: 255 t.string "random_secret", limit: 255 t.string "path", limit: 255 t.boolean "downloadable" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.index ["provider_id", "path"], name: "index_cms_files_on_provider_id_and_path" t.index ["provider_id"], name: "index_cms_files_on_provider_id" t.index ["section_id"], name: "index_cms_files_on_section_id" @@ -349,8 +348,8 @@ t.bigint "tenant_id" t.bigint "provider_id", null: false t.string "name", limit: 255 - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.index ["provider_id"], name: "index_cms_groups_on_provider_id" end @@ -358,8 +357,8 @@ t.bigint "tenant_id" t.bigint "account_id" t.string "name", limit: 255 - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.bigint "group_id" t.index ["account_id"], name: "index_cms_permissions_on_account_id" end @@ -368,8 +367,8 @@ t.bigint "provider_id", null: false t.string "source", limit: 255, null: false t.string "target", limit: 255, null: false - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.bigint "tenant_id" t.index ["provider_id", "source"], name: "index_cms_redirects_on_provider_id_and_source" t.index ["provider_id"], name: "index_cms_redirects_on_provider_id" @@ -382,8 +381,8 @@ t.string "partial_path", limit: 255 t.string "title", limit: 255 t.string "system_name", limit: 255 - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.boolean "public", default: true t.string "type", limit: 255, default: "CMS::Section" t.index ["parent_id"], name: "index_cms_sections_on_parent_id" @@ -402,8 +401,8 @@ t.text "draft" t.boolean "liquid_enabled" t.string "content_type", limit: 255 - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.bigint "layout_id" t.text "options" t.string "updated_by", limit: 255 @@ -430,8 +429,8 @@ t.text "draft" t.boolean "liquid_enabled" t.string "content_type", limit: 255 - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.bigint "layout_id" t.bigint "template_id" t.string "template_type", limit: 255 @@ -448,8 +447,8 @@ t.string "configurable_type", limit: 50 t.string "name", limit: 255 t.string "value", limit: 255 - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.bigint "tenant_id" t.index ["configurable_id", "configurable_type", "name"], name: "index_on_configurable_and_name", unique: true t.index ["configurable_id", "configurable_type"], name: "index_on_configurable" @@ -460,8 +459,8 @@ t.string "name", limit: 255 t.string "currency", limit: 255 t.decimal "tax_rate", precision: 5, scale: 2, default: "0.0", null: false - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.integer "tenant_id" t.boolean "enabled", default: true t.index ["code"], name: "index_countries_on_code" @@ -472,7 +471,7 @@ t.string "owner_type" t.bigint "object_id" t.string "object_type" - t.datetime "created_at", null: false + t.datetime "created_at", precision: nil, null: false t.text "metadata" t.index ["object_type", "object_id"], name: "index_deleted_objects_on_object_type_and_object_id" t.index ["owner_type", "owner_id"], name: "index_deleted_objects_on_owner_type_and_owner_id" @@ -490,8 +489,8 @@ t.string "address" t.integer "port" t.bigint "tenant_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.index ["account_id"], name: "index_email_configurations_on_account_id" t.index ["email"], name: "index_email_configurations_on_email", unique: true end @@ -502,7 +501,7 @@ t.string "event_id", limit: 255, null: false t.text "metadata" t.text "data" - t.datetime "created_at", null: false + t.datetime "created_at", precision: nil, null: false t.bigint "provider_id" t.bigint "tenant_id" t.index ["created_at"], name: "index_event_store_events_on_created_at" @@ -515,8 +514,8 @@ t.bigint "featurable_id" t.string "name", limit: 255 t.text "description" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.string "system_name", limit: 255 t.boolean "visible", default: true, null: false t.string "featurable_type", limit: 255, default: "Service", null: false @@ -537,8 +536,8 @@ create_table "fields_definitions", force: :cascade do |t| t.bigint "account_id" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.string "target", limit: 255 t.boolean "hidden", default: false t.boolean "required", default: false @@ -571,15 +570,15 @@ t.text "settings" t.bigint "proxy_id" t.bigint "tenant_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.index ["proxy_id"], name: "index_gateway_configurations_on_proxy_id", unique: true end create_table "go_live_states", force: :cascade do |t| t.bigint "account_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.text "steps" t.string "recent", limit: 255 t.boolean "finished", default: false @@ -590,11 +589,11 @@ create_table "invitations", force: :cascade do |t| t.string "token", limit: 255 t.string "email", limit: 255 - t.datetime "sent_at" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "sent_at", precision: nil + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.bigint "account_id" - t.datetime "accepted_at" + t.datetime "accepted_at", precision: nil t.bigint "tenant_id" t.bigint "user_id" end @@ -603,28 +602,28 @@ t.bigint "provider_account_id", null: false t.string "invoice_prefix", limit: 255, null: false t.integer "invoice_count", default: 0 - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.index ["provider_account_id", "invoice_prefix"], name: "index_invoice_counters_provider_prefix", unique: true end create_table "invoices", force: :cascade do |t| t.bigint "provider_account_id" t.bigint "buyer_account_id" - t.datetime "paid_at" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "paid_at", precision: nil + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.date "due_on" t.string "pdf_file_name", limit: 255 t.string "pdf_content_type", limit: 255 t.integer "pdf_file_size" - t.datetime "pdf_updated_at" + t.datetime "pdf_updated_at", precision: nil t.date "period" t.date "issued_on" t.string "state", limit: 255, default: "open", null: false t.string "friendly_id", limit: 255, default: "fix", null: false t.bigint "tenant_id" - t.datetime "finalized_at" + t.datetime "finalized_at", precision: nil t.string "fiscal_code", limit: 255 t.string "vat_code", limit: 255 t.decimal "vat_rate", precision: 20, scale: 2 @@ -660,8 +659,8 @@ t.integer "legal_term_version" t.string "resource_type", limit: 255 t.bigint "resource_id" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.bigint "tenant_id" t.bigint "account_id" t.index ["account_id"], name: "index_legal_term_acceptances_on_account_id" @@ -672,8 +671,8 @@ t.integer "legal_term_version" t.string "resource_type", limit: 255 t.bigint "resource_id" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.string "scope", limit: 255 t.bigint "tenant_id" end @@ -684,8 +683,8 @@ t.string "name", limit: 255 t.string "slug", limit: 255 t.text "body" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.boolean "published", default: false t.boolean "deleted", default: false t.boolean "archived", default: false @@ -701,8 +700,8 @@ t.string "name", limit: 255 t.string "slug", limit: 255 t.text "body" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.boolean "published", default: false t.boolean "deleted", default: false t.boolean "archived", default: false @@ -718,11 +717,11 @@ t.string "name", limit: 255 t.string "description", limit: 255 t.decimal "cost", precision: 20, scale: 4, default: "0.0", null: false - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.string "type", limit: 255, default: "" t.bigint "metric_id" - t.datetime "finished_at" + t.datetime "finished_at", precision: nil t.integer "quantity" t.time "started_at" t.bigint "tenant_id" @@ -739,8 +738,8 @@ t.bigint "buyer_id" t.integer "level", default: 10 t.string "description", limit: 255 - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.index ["provider_id"], name: "index_log_entries_on_provider_id" end @@ -749,8 +748,8 @@ t.bigint "system_operation_id" t.text "emails" t.boolean "dispatch", default: true - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.bigint "tenant_id" t.index ["account_id", "system_operation_id"], name: "index_mail_dispatch_rules_on_account_id_and_system_operation_id", unique: true end @@ -758,8 +757,8 @@ create_table "member_permissions", force: :cascade do |t| t.bigint "user_id" t.string "admin_section", limit: 255 - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.bigint "tenant_id" t.binary "service_ids" t.index ["user_id"], name: "index_member_permissions_on_user_id" @@ -772,9 +771,9 @@ t.string "kind", limit: 255, default: "", null: false t.integer "position" t.string "state", limit: 255, null: false - t.datetime "hidden_at" + t.datetime "hidden_at", precision: nil t.bigint "tenant_id" - t.datetime "deleted_at" + t.datetime "deleted_at", precision: nil t.index ["message_id", "kind"], name: "index_message_recipients_on_message_id_and_kind" t.index ["receiver_id"], name: "idx_receiver_id" end @@ -784,10 +783,10 @@ t.text "subject" t.text "body" t.string "state", limit: 255, null: false - t.datetime "hidden_at" + t.datetime "hidden_at", precision: nil t.string "type", limit: 255 - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.bigint "system_operation_id" t.text "headers" t.bigint "tenant_id" @@ -799,8 +798,8 @@ t.string "system_name", limit: 255 t.text "description" t.string "unit", limit: 255 - t.datetime "created_at", null: false - t.datetime "updated_at" + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil t.bigint "service_id" t.string "friendly_name", limit: 255 t.bigint "parent_id" @@ -817,16 +816,16 @@ create_table "moderatorships", force: :cascade do |t| t.bigint "forum_id" t.bigint "user_id" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.bigint "tenant_id" end create_table "notification_preferences", force: :cascade do |t| t.bigint "user_id" t.binary "preferences" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.bigint "tenant_id" t.index ["user_id"], name: "index_notification_preferences_on_user_id", unique: true end @@ -836,8 +835,8 @@ t.string "event_id", limit: 255, null: false t.string "system_name", limit: 1000 t.string "state", limit: 20 - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.string "title", limit: 1000 t.index ["event_id"], name: "index_notifications_on_event_id" t.index ["user_id"], name: "index_notifications_on_user_id" @@ -848,8 +847,8 @@ t.string "oidc_configurable_type", null: false t.bigint "oidc_configurable_id", null: false t.bigint "tenant_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.index ["oidc_configurable_type", "oidc_configurable_id"], name: "oidc_configurable", unique: true end @@ -859,8 +858,8 @@ t.string "bubble_api_state", limit: 255 t.string "bubble_metric_state", limit: 255 t.string "bubble_deployment_state", limit: 255 - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.string "bubble_mapping_state", limit: 255 t.string "bubble_limit_state", limit: 255 t.bigint "tenant_id" @@ -870,8 +869,8 @@ create_table "partners", force: :cascade do |t| t.string "name", limit: 255 t.string "api_key", limit: 255 - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.string "system_name", limit: 255 t.string "logout_url", limit: 255 end @@ -882,8 +881,8 @@ t.string "payment_service_reference", limit: 255 t.string "credit_card_partial_number", limit: 255 t.date "credit_card_expires_on" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.bigint "tenant_id" t.string "payment_method_id" t.index ["account_id", "buyer_reference"], name: "index_payment_details_on_account_id_and_buyer_reference" @@ -895,8 +894,8 @@ t.binary "gateway_settings" t.string "gateway_type", limit: 255 t.bigint "account_id" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.bigint "tenant_id" t.index ["account_id"], name: "index_payment_gateway_settings_on_account_id" end @@ -905,8 +904,8 @@ t.integer "invoice_id", null: false t.string "state" t.bigint "tenant_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.string "reference" t.index ["invoice_id"], name: "index_payment_intents_on_invoice_id" t.index ["reference"], name: "index_payment_intents_on_reference", unique: true @@ -924,8 +923,8 @@ t.string "action", limit: 255 t.text "params" t.boolean "test", default: false, null: false - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.bigint "tenant_id" t.index ["invoice_id"], name: "index_payment_transactions_on_invoice_id" end @@ -935,8 +934,8 @@ t.bigint "metric_id" t.boolean "visible", default: true t.boolean "limits_only_text", default: true - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.string "plan_type", limit: 255, null: false t.bigint "tenant_id" t.index ["metric_id"], name: "idx_plan_metrics_metric_id" @@ -950,8 +949,8 @@ t.text "full_legal" t.decimal "cost_per_month", precision: 20, scale: 4, default: "0.0", null: false t.integer "trial_period_days" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.integer "position", default: 0 t.string "state", limit: 255, null: false t.integer "cancellation_period", default: 0, null: false @@ -978,8 +977,8 @@ t.binary "schema", null: false t.bigint "account_id", null: false t.bigint "tenant_id" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.string "identifier" t.index ["account_id", "identifier"], name: "index_policies_on_account_id_and_identifier", unique: true t.index ["account_id"], name: "index_policies_on_account_id" @@ -989,8 +988,8 @@ t.bigint "user_id" t.bigint "topic_id" t.text "body" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.bigint "forum_id" t.text "body_html" t.string "email", limit: 255 @@ -1008,8 +1007,8 @@ t.bigint "min", default: 1, null: false t.bigint "max" t.decimal "cost_per_unit", precision: 20, scale: 4, default: "0.0", null: false - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.bigint "plan_id" t.bigint "tenant_id" end @@ -1024,8 +1023,8 @@ t.string "email_sales", limit: 255 t.string "email_techsupport", limit: 255 t.string "email_press", limit: 255 - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.string "logo_file_name", limit: 255 t.string "logo_content_type", limit: 255 t.integer "logo_file_size" @@ -1042,9 +1041,9 @@ t.text "value" t.bigint "user_id" t.bigint "tenant_id" - t.datetime "expires_at" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "expires_at", precision: nil + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.index ["user_id"], name: "fk_rails_260e99b630" end @@ -1053,8 +1052,8 @@ t.bigint "provider_id" t.integer "max_users" t.integer "max_services" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.index ["provider_id"], name: "index_provider_constraints_on_provider_id", unique: true end @@ -1062,15 +1061,15 @@ t.bigint "tenant_id" t.bigint "service_id" t.string "endpoint", limit: 255 - t.datetime "deployed_at" + t.datetime "deployed_at", precision: nil t.string "auth_app_key", limit: 255, default: "app_key" t.string "auth_app_id", limit: 255, default: "app_id" t.string "auth_user_key", limit: 255, default: "user_key" t.string "credentials_location", limit: 255, default: "query", null: false t.string "error_auth_failed", limit: 255, default: "Authentication failed" t.string "error_auth_missing", limit: 255, default: "Authentication parameters missing" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.integer "error_status_auth_failed", default: 403, null: false t.string "error_headers_auth_failed", limit: 255, default: "text/plain; charset=us-ascii", null: false t.integer "error_status_auth_missing", default: 403, null: false @@ -1101,8 +1100,8 @@ create_table "proxy_config_affecting_changes", force: :cascade do |t| t.integer "proxy_id", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.index ["proxy_id"], name: "index_proxy_config_affecting_changes_on_proxy_id", unique: true end @@ -1113,8 +1112,8 @@ t.bigint "tenant_id" t.string "environment", limit: 255, null: false t.text "content", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.string "hosts", limit: 8192 t.index ["proxy_id", "environment", "version"], name: "index_proxy_configs_on_proxy_id_and_environment_and_version" t.index ["proxy_id"], name: "index_proxy_configs_on_proxy_id" @@ -1126,8 +1125,8 @@ t.bigint "tenant_id" t.text "lua_file" t.string "status", limit: 255 - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil end create_table "proxy_rules", force: :cascade do |t| @@ -1138,8 +1137,8 @@ t.string "metric_system_name", limit: 255 t.integer "delta" t.bigint "tenant_id" - t.datetime "created_at", null: false - t.datetime "updated_at" + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil t.text "redirect_url" t.integer "position" t.boolean "last", default: false @@ -1152,8 +1151,8 @@ create_table "referrer_filters", force: :cascade do |t| t.bigint "application_id", null: false t.string "value", limit: 255, null: false - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.bigint "tenant_id" t.index ["application_id"], name: "index_referrer_filters_on_application_id" end @@ -1161,16 +1160,16 @@ create_table "service_cubert_infos", force: :cascade do |t| t.string "bucket_id", limit: 255 t.bigint "service_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.bigint "tenant_id" end create_table "service_tokens", force: :cascade do |t| t.bigint "service_id" t.string "value", limit: 255 - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.bigint "tenant_id" t.index ["service_id"], name: "index_service_tokens_on_service_id" end @@ -1180,8 +1179,8 @@ t.string "name", limit: 255, default: "" t.text "description" t.text "txt_support" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.string "logo_file_name", limit: 255 t.string "logo_content_type", limit: 255 t.integer "logo_file_size" @@ -1215,8 +1214,8 @@ t.string "bg_colour", limit: 255 t.string "link_colour", limit: 255 t.string "text_colour", limit: 255 - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.string "menu_bg_colour", limit: 255 t.string "link_label", limit: 255 t.string "link_url", limit: 255 @@ -1288,7 +1287,7 @@ t.string "name", limit: 255 t.string "sluggable_type", limit: 50 t.bigint "sluggable_id" - t.datetime "created_at" + t.datetime "created_at", precision: nil t.integer "sequence", default: 1, null: false t.bigint "tenant_id" t.index ["name", "sluggable_type", "sequence"], name: "index_slugs_on_n_s_and_s" @@ -1299,8 +1298,8 @@ t.string "uid", limit: 255 t.bigint "authentication_provider_id" t.bigint "user_id" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.bigint "tenant_id" t.text "id_token" t.index ["authentication_provider_id"], name: "index_sso_authorizations_on_authentication_provider_id" @@ -1311,8 +1310,8 @@ t.string "ref", limit: 255 t.string "name", limit: 255 t.text "description" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.integer "pos" t.integer "tenant_id" end @@ -1321,8 +1320,8 @@ t.bigint "tag_id" t.bigint "taggable_id" t.string "taggable_type", limit: 255 - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.bigint "tenant_id" t.integer "tagger_id" t.string "tagger_type", limit: 255 @@ -1333,8 +1332,8 @@ create_table "tags", force: :cascade do |t| t.string "name", limit: 255 - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.bigint "account_id" t.bigint "tenant_id" t.integer "taggings_count", default: 0 @@ -1344,8 +1343,8 @@ create_table "topic_categories", force: :cascade do |t| t.string "name", limit: 255 - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.bigint "forum_id" t.bigint "tenant_id" t.index ["forum_id"], name: "index_topic_categories_on_forum_id" @@ -1355,14 +1354,14 @@ t.bigint "forum_id" t.bigint "user_id" t.string "title", limit: 255 - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.integer "hits", default: 0 t.boolean "sticky", default: false, null: false t.integer "posts_count", default: 0 t.boolean "locked", default: false t.bigint "last_post_id" - t.datetime "last_updated_at" + t.datetime "last_updated_at", precision: nil t.bigint "last_user_id" t.string "permalink", limit: 255 t.bigint "category_id" @@ -1377,8 +1376,8 @@ t.bigint "metric_id" t.string "period", limit: 255 t.bigint "value" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.bigint "plan_id" t.string "plan_type", limit: 255, null: false t.bigint "tenant_id" @@ -1392,11 +1391,11 @@ t.string "key", limit: 255 t.string "ip", limit: 255 t.string "user_agent", limit: 255 - t.datetime "accessed_at" - t.datetime "revoked_at" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.datetime "secured_until" + t.datetime "accessed_at", precision: nil + t.datetime "revoked_at", precision: nil + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false + t.datetime "secured_until", precision: nil t.bigint "sso_authorization_id" t.index ["key"], name: "idx_key" t.index ["sso_authorization_id"], name: "index_user_sessions_on_sso_authorization_id" @@ -1406,8 +1405,8 @@ create_table "user_topics", force: :cascade do |t| t.bigint "user_id" t.bigint "topic_id" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.bigint "tenant_id" end @@ -1416,12 +1415,12 @@ t.string "email", limit: 255 t.string "crypted_password", limit: 40 t.string "salt", limit: 40 - t.datetime "created_at", null: false - t.datetime "updated_at" + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil t.string "remember_token", limit: 40 - t.datetime "remember_token_expires_at" + t.datetime "remember_token_expires_at", precision: nil t.string "activation_code", limit: 40 - t.datetime "activated_at" + t.datetime "activated_at", precision: nil t.string "state", limit: 255 t.string "role", limit: 255, default: "" t.string "lost_password_token", limit: 255 @@ -1431,14 +1430,14 @@ t.string "last_name", limit: 255 t.string "signup_type", limit: 255 t.string "job_role", limit: 255 - t.datetime "last_login_at" + t.datetime "last_login_at", precision: nil t.string "last_login_ip", limit: 255 t.string "email_verification_code", limit: 255 t.string "title", limit: 255 t.text "extra_fields" t.bigint "tenant_id" t.string "cas_identifier", limit: 255 - t.datetime "lost_password_token_generated_at" + t.datetime "lost_password_token_generated_at", precision: nil t.string "authentication_id", limit: 255 t.string "open_id", limit: 255 t.string "password_digest", limit: 255 @@ -1461,8 +1460,8 @@ t.boolean "application_created_on", default: false t.boolean "application_updated_on", default: false t.boolean "application_deleted_on", default: false - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.boolean "provider_actions", default: false t.boolean "account_plan_changed_on", default: false t.boolean "application_plan_changed_on", default: false diff --git a/db/schema.rb b/db/schema.rb index c2698ae116..75fa15cf5e 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,8 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2024_11_07_134140) do - +ActiveRecord::Schema[7.0].define(version: 2024_11_07_134140) do create_table "access_tokens", charset: "utf8mb3", collation: "utf8mb3_bin", force: :cascade do |t| t.bigint "owner_id", null: false t.text "scopes" @@ -19,9 +18,9 @@ t.string "name", null: false t.string "permission", null: false t.bigint "tenant_id" - t.datetime "created_at" - t.datetime "updated_at" - t.datetime "expires_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil + t.datetime "expires_at", precision: nil t.index ["owner_id"], name: "idx_auth_tokens_of_user" t.index ["value", "owner_id"], name: "idx_value_auth_tokens_of_user", unique: true end @@ -29,8 +28,8 @@ create_table "accounts", charset: "utf8mb3", collation: "utf8mb3_bin", force: :cascade do |t| t.string "org_name", default: "", null: false t.string "org_legaladdress", default: "" - t.datetime "created_at", null: false - t.datetime "updated_at" + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil t.boolean "provider", default: false t.boolean "buyer", default: false t.bigint "country_id" @@ -55,7 +54,7 @@ t.string "state_region" t.string "state" t.boolean "paid", default: false - t.datetime "paid_at" + t.datetime "paid_at", precision: nil t.boolean "signs_legal_terms", default: true t.string "timezone" t.boolean "delta", default: true, null: false @@ -78,7 +77,7 @@ t.integer "prepared_assets_version" t.boolean "sample_data" t.integer "proxy_configs_file_size" - t.datetime "proxy_configs_updated_at" + t.datetime "proxy_configs_updated_at", precision: nil t.string "proxy_configs_content_type" t.string "proxy_configs_file_name" t.string "support_email" @@ -90,10 +89,10 @@ t.string "proxy_configs_conf_file_name" t.string "proxy_configs_conf_content_type" t.integer "proxy_configs_conf_file_size" - t.datetime "proxy_configs_conf_updated_at" - t.datetime "hosted_proxy_deployed_at" + t.datetime "proxy_configs_conf_updated_at", precision: nil + t.datetime "hosted_proxy_deployed_at", precision: nil t.string "po_number" - t.datetime "state_changed_at" + t.datetime "state_changed_at", precision: nil t.index ["default_service_id"], name: "index_accounts_on_default_service_id" t.index ["domain", "state_changed_at"], name: "index_accounts_on_domain_and_state_changed_at" t.index ["domain"], name: "index_accounts_on_domain", unique: true @@ -107,7 +106,7 @@ create_table "alerts", charset: "utf8mb3", collation: "utf8mb3_bin", force: :cascade do |t| t.bigint "account_id", null: false - t.datetime "timestamp", null: false + t.datetime "timestamp", precision: nil, null: false t.string "state", null: false t.bigint "cinstance_id", null: false t.decimal "utilization", precision: 6, scale: 2, null: false @@ -128,8 +127,8 @@ t.string "annotated_type", null: false t.bigint "annotated_id", null: false t.integer "tenant_id" - t.datetime "created_at", precision: 6, null: false - t.datetime "updated_at", precision: 6, null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false t.index ["annotated_type", "annotated_id", "name"], name: "index_annotations_on_annotated_type_and_annotated_id_and_name", unique: true end @@ -140,8 +139,8 @@ t.text "body", size: :long t.text "description" t.boolean "published", default: false - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.string "system_name" t.string "base_path" t.string "swagger_version" @@ -155,8 +154,8 @@ create_table "application_keys", charset: "utf8mb3", collation: "utf8mb3_bin", force: :cascade do |t| t.bigint "application_id", null: false t.string "value", null: false - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.bigint "tenant_id" t.index ["application_id", "value"], name: "index_application_keys_on_application_id_and_value", unique: true end @@ -169,7 +168,7 @@ t.string "username" t.string "action" t.integer "version", default: 0 - t.datetime "created_at" + t.datetime "created_at", precision: nil t.bigint "tenant_id" t.bigint "provider_id" t.string "kind" @@ -201,8 +200,8 @@ t.string "authorize_url" t.string "site" t.bigint "account_id" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.bigint "tenant_id" t.string "identifier_key", default: "id" t.string "username_key", default: "login" @@ -222,8 +221,8 @@ t.string "path", default: "" t.bigint "service_id" t.bigint "backend_api_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.bigint "tenant_id" t.index ["backend_api_id", "service_id"], name: "index_backend_api_configs_on_backend_api_id_and_service_id", unique: true t.index ["path", "service_id"], name: "index_backend_api_configs_on_path_and_service_id", unique: true @@ -236,8 +235,8 @@ t.text "description", size: :medium t.string "private_endpoint" t.bigint "account_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.bigint "tenant_id" t.string "state", default: "published", null: false t.index ["account_id", "system_name"], name: "index_backend_apis_on_account_id_and_system_name", unique: true @@ -246,8 +245,8 @@ create_table "backend_events", id: :bigint, default: nil, charset: "utf8mb3", collation: "utf8mb3_bin", force: :cascade do |t| t.text "data" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false end create_table "billing_strategies", charset: "utf8mb3", collation: "utf8mb3_bin", force: :cascade do |t| @@ -256,8 +255,8 @@ t.boolean "charging_enabled", default: false t.integer "charging_retry_delay", default: 3 t.integer "charging_retry_times", default: 3 - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.string "numbering_period", default: "monthly" t.string "currency", default: "USD" t.bigint "tenant_id" @@ -269,8 +268,8 @@ t.bigint "category_type_id" t.bigint "parent_id" t.string "name" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.bigint "account_id" t.bigint "tenant_id" t.index ["account_id"], name: "index_categories_on_account_id" @@ -278,8 +277,8 @@ create_table "category_types", charset: "utf8mb3", collation: "utf8mb3_bin", force: :cascade do |t| t.string "name" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.bigint "account_id" t.bigint "tenant_id" t.index ["account_id"], name: "index_category_types_on_account_id" @@ -290,25 +289,25 @@ t.bigint "user_account_id" t.string "user_key", limit: 256 t.string "provider_public_key" - t.datetime "created_at", null: false - t.datetime "updated_at" + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil t.string "state", null: false t.text "description" - t.datetime "paid_until" + t.datetime "paid_until", precision: nil t.string "application_id" t.string "name" - t.datetime "trial_period_expires_at" + t.datetime "trial_period_expires_at", precision: nil t.decimal "setup_fee", precision: 20, scale: 2, default: "0.0" t.string "type", default: "Cinstance", null: false t.text "redirect_url" - t.datetime "variable_cost_paid_until" + t.datetime "variable_cost_paid_until", precision: nil t.text "extra_fields" t.bigint "tenant_id" t.string "create_origin" - t.datetime "first_traffic_at" - t.datetime "first_daily_traffic_at" + t.datetime "first_traffic_at", precision: nil + t.datetime "first_daily_traffic_at", precision: nil t.bigint "service_id" - t.datetime "accepted_at" + t.datetime "accepted_at", precision: nil t.index ["application_id"], name: "index_cinstances_on_application_id" t.index ["plan_id"], name: "fk_ct_contract_id" t.index ["type", "plan_id", "service_id", "state"], name: "index_cinstances_on_type_and_plan_id_and_service_id_and_state" @@ -323,15 +322,15 @@ t.bigint "provider_id", null: false t.bigint "section_id" t.bigint "tenant_id" - t.datetime "attachment_updated_at" + t.datetime "attachment_updated_at", precision: nil t.string "attachment_content_type" t.bigint "attachment_file_size" t.string "attachment_file_name" t.string "random_secret" t.string "path" t.boolean "downloadable" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.index ["provider_id", "path"], name: "index_cms_files_on_provider_id_and_path" t.index ["provider_id"], name: "index_cms_files_on_provider_id" t.index ["section_id"], name: "index_cms_files_on_section_id" @@ -348,8 +347,8 @@ t.bigint "tenant_id" t.bigint "provider_id", null: false t.string "name" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.index ["provider_id"], name: "index_cms_groups_on_provider_id" end @@ -357,8 +356,8 @@ t.bigint "tenant_id" t.bigint "account_id" t.string "name" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.bigint "group_id" t.index ["account_id"], name: "index_cms_permissions_on_account_id" end @@ -367,8 +366,8 @@ t.bigint "provider_id", null: false t.string "source", null: false t.string "target", null: false - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.bigint "tenant_id" t.index ["provider_id", "source"], name: "index_cms_redirects_on_provider_id_and_source" t.index ["provider_id"], name: "index_cms_redirects_on_provider_id" @@ -381,8 +380,8 @@ t.string "partial_path" t.string "title" t.string "system_name" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.boolean "public", default: true t.string "type", default: "CMS::Section" t.index ["parent_id"], name: "index_cms_sections_on_parent_id" @@ -401,8 +400,8 @@ t.text "draft", size: :medium t.boolean "liquid_enabled" t.string "content_type" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.bigint "layout_id" t.text "options" t.string "updated_by" @@ -429,8 +428,8 @@ t.text "draft", size: :medium t.boolean "liquid_enabled" t.string "content_type" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.bigint "layout_id" t.bigint "template_id" t.string "template_type" @@ -447,8 +446,8 @@ t.string "configurable_type", limit: 50 t.string "name" t.string "value" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.bigint "tenant_id" t.index ["configurable_id", "configurable_type", "name"], name: "index_on_configurable_and_name", unique: true t.index ["configurable_id", "configurable_type"], name: "index_on_configurable" @@ -459,8 +458,8 @@ t.string "name" t.string "currency" t.decimal "tax_rate", precision: 5, scale: 2, default: "0.0", null: false - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.integer "tenant_id" t.boolean "enabled", default: true t.index ["code"], name: "index_countries_on_code" @@ -471,7 +470,7 @@ t.string "owner_type" t.bigint "object_id" t.string "object_type" - t.datetime "created_at", null: false + t.datetime "created_at", precision: nil, null: false t.text "metadata" t.index ["object_type", "object_id"], name: "index_deleted_objects_on_object_type_and_object_id" t.index ["owner_type", "owner_id"], name: "index_deleted_objects_on_owner_type_and_owner_id" @@ -489,8 +488,8 @@ t.string "address", collation: "utf8mb3_general_ci" t.integer "port", limit: 2, unsigned: true t.bigint "tenant_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.index ["account_id"], name: "index_email_configurations_on_account_id" t.index ["email"], name: "index_email_configurations_on_email", unique: true end @@ -501,7 +500,7 @@ t.string "event_id", null: false t.text "metadata", size: :medium t.text "data" - t.datetime "created_at", null: false + t.datetime "created_at", precision: nil, null: false t.bigint "provider_id" t.bigint "tenant_id" t.index ["created_at"], name: "index_event_store_events_on_created_at" @@ -514,8 +513,8 @@ t.bigint "featurable_id" t.string "name" t.text "description" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.string "system_name" t.boolean "visible", default: true, null: false t.string "featurable_type", default: "Service", null: false @@ -536,8 +535,8 @@ create_table "fields_definitions", charset: "utf8mb3", collation: "utf8mb3_bin", force: :cascade do |t| t.bigint "account_id" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.string "target" t.boolean "hidden", default: false t.boolean "required", default: false @@ -570,15 +569,15 @@ t.text "settings" t.bigint "proxy_id" t.bigint "tenant_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.index ["proxy_id"], name: "index_gateway_configurations_on_proxy_id", unique: true end create_table "go_live_states", charset: "utf8mb3", collation: "utf8mb3_bin", force: :cascade do |t| t.bigint "account_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.text "steps" t.string "recent" t.boolean "finished", default: false @@ -589,11 +588,11 @@ create_table "invitations", charset: "utf8mb3", collation: "utf8mb3_bin", force: :cascade do |t| t.string "token" t.string "email" - t.datetime "sent_at" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "sent_at", precision: nil + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.bigint "account_id" - t.datetime "accepted_at" + t.datetime "accepted_at", precision: nil t.bigint "tenant_id" t.bigint "user_id" end @@ -602,28 +601,28 @@ t.bigint "provider_account_id", null: false t.string "invoice_prefix", null: false t.integer "invoice_count", default: 0 - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.index ["provider_account_id", "invoice_prefix"], name: "index_invoice_counters_provider_prefix", unique: true end create_table "invoices", charset: "utf8mb3", collation: "utf8mb3_bin", force: :cascade do |t| t.bigint "provider_account_id" t.bigint "buyer_account_id" - t.datetime "paid_at" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "paid_at", precision: nil + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.date "due_on" t.string "pdf_file_name" t.string "pdf_content_type" t.integer "pdf_file_size" - t.datetime "pdf_updated_at" + t.datetime "pdf_updated_at", precision: nil t.date "period" t.date "issued_on" t.string "state", default: "open", null: false t.string "friendly_id", default: "fix", null: false t.bigint "tenant_id" - t.datetime "finalized_at" + t.datetime "finalized_at", precision: nil t.string "fiscal_code" t.string "vat_code" t.decimal "vat_rate", precision: 20, scale: 2 @@ -659,8 +658,8 @@ t.integer "legal_term_version" t.string "resource_type" t.bigint "resource_id" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.bigint "tenant_id" t.bigint "account_id" t.index ["account_id"], name: "index_legal_term_acceptances_on_account_id" @@ -671,8 +670,8 @@ t.integer "legal_term_version" t.string "resource_type" t.bigint "resource_id" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.string "scope" t.bigint "tenant_id" end @@ -683,8 +682,8 @@ t.string "name" t.string "slug" t.text "body", size: :long - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.boolean "published", default: false t.boolean "deleted", default: false t.boolean "archived", default: false @@ -700,8 +699,8 @@ t.string "name" t.string "slug" t.text "body", size: :long - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.boolean "published", default: false t.boolean "deleted", default: false t.boolean "archived", default: false @@ -717,11 +716,11 @@ t.string "name" t.string "description" t.decimal "cost", precision: 20, scale: 4, default: "0.0", null: false - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.string "type", default: "" t.bigint "metric_id" - t.datetime "finished_at" + t.datetime "finished_at", precision: nil t.integer "quantity" t.time "started_at" t.bigint "tenant_id" @@ -738,8 +737,8 @@ t.bigint "buyer_id" t.integer "level", default: 10 t.string "description" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.index ["provider_id"], name: "index_log_entries_on_provider_id" end @@ -748,8 +747,8 @@ t.bigint "system_operation_id" t.text "emails" t.boolean "dispatch", default: true - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.bigint "tenant_id" t.index ["account_id", "system_operation_id"], name: "index_mail_dispatch_rules_on_account_id_and_system_operation_id", unique: true end @@ -757,8 +756,8 @@ create_table "member_permissions", charset: "utf8mb3", collation: "utf8mb3_bin", force: :cascade do |t| t.bigint "user_id" t.string "admin_section" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.bigint "tenant_id" t.binary "service_ids" t.index ["user_id"], name: "index_member_permissions_on_user_id" @@ -771,9 +770,9 @@ t.string "kind", default: "", null: false t.integer "position" t.string "state", null: false - t.datetime "hidden_at" + t.datetime "hidden_at", precision: nil t.bigint "tenant_id" - t.datetime "deleted_at" + t.datetime "deleted_at", precision: nil t.index ["message_id", "kind"], name: "index_message_recipients_on_message_id_and_kind" t.index ["receiver_id"], name: "idx_receiver_id" end @@ -783,10 +782,10 @@ t.text "subject" t.text "body" t.string "state", null: false - t.datetime "hidden_at" + t.datetime "hidden_at", precision: nil t.string "type" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.bigint "system_operation_id" t.text "headers" t.bigint "tenant_id" @@ -798,8 +797,8 @@ t.string "system_name" t.text "description" t.string "unit" - t.datetime "created_at", null: false - t.datetime "updated_at" + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil t.bigint "service_id" t.string "friendly_name" t.bigint "parent_id" @@ -816,16 +815,16 @@ create_table "moderatorships", charset: "utf8mb3", collation: "utf8mb3_bin", force: :cascade do |t| t.bigint "forum_id" t.bigint "user_id" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.bigint "tenant_id" end create_table "notification_preferences", charset: "utf8mb3", collation: "utf8mb3_bin", force: :cascade do |t| t.bigint "user_id" t.binary "preferences" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.bigint "tenant_id" t.index ["user_id"], name: "index_notification_preferences_on_user_id", unique: true end @@ -835,8 +834,8 @@ t.string "event_id", null: false t.string "system_name", limit: 1000 t.string "state", limit: 20 - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.string "title", limit: 1000 t.index ["event_id"], name: "index_notifications_on_event_id" t.index ["user_id"], name: "index_notifications_on_user_id" @@ -847,8 +846,8 @@ t.string "oidc_configurable_type", null: false t.bigint "oidc_configurable_id", null: false t.bigint "tenant_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.index ["oidc_configurable_type", "oidc_configurable_id"], name: "oidc_configurable", unique: true end @@ -858,8 +857,8 @@ t.string "bubble_api_state" t.string "bubble_metric_state" t.string "bubble_deployment_state" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.string "bubble_mapping_state" t.string "bubble_limit_state" t.bigint "tenant_id" @@ -869,8 +868,8 @@ create_table "partners", charset: "utf8mb3", collation: "utf8mb3_bin", force: :cascade do |t| t.string "name" t.string "api_key" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.string "system_name" t.string "logout_url" end @@ -881,8 +880,8 @@ t.string "payment_service_reference" t.string "credit_card_partial_number" t.date "credit_card_expires_on" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.bigint "tenant_id" t.string "payment_method_id" t.index ["account_id", "buyer_reference"], name: "index_payment_details_on_account_id_and_buyer_reference" @@ -894,8 +893,8 @@ t.binary "gateway_settings" t.string "gateway_type" t.bigint "account_id" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.bigint "tenant_id" t.index ["account_id"], name: "index_payment_gateway_settings_on_account_id" end @@ -904,8 +903,8 @@ t.integer "invoice_id", null: false t.string "state" t.bigint "tenant_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.string "reference" t.index ["invoice_id"], name: "index_payment_intents_on_invoice_id" t.index ["reference"], name: "index_payment_intents_on_reference", unique: true @@ -923,8 +922,8 @@ t.string "action" t.text "params" t.boolean "test", default: false, null: false - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.bigint "tenant_id" t.index ["invoice_id"], name: "index_payment_transactions_on_invoice_id" end @@ -934,8 +933,8 @@ t.bigint "metric_id" t.boolean "visible", default: true t.boolean "limits_only_text", default: true - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.string "plan_type", null: false t.bigint "tenant_id" t.index ["metric_id"], name: "idx_plan_metrics_metric_id" @@ -949,8 +948,8 @@ t.text "full_legal", size: :long t.decimal "cost_per_month", precision: 20, scale: 4, default: "0.0", null: false t.integer "trial_period_days" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.integer "position", default: 0 t.string "state", null: false t.integer "cancellation_period", default: 0, null: false @@ -977,8 +976,8 @@ t.binary "schema", size: :long, null: false t.bigint "account_id", null: false t.bigint "tenant_id" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.string "identifier" t.index ["account_id", "identifier"], name: "index_policies_on_account_id_and_identifier", unique: true t.index ["account_id"], name: "index_policies_on_account_id" @@ -988,8 +987,8 @@ t.bigint "user_id" t.bigint "topic_id" t.text "body" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.bigint "forum_id" t.text "body_html" t.string "email" @@ -1007,8 +1006,8 @@ t.bigint "min", default: 1, null: false t.bigint "max" t.decimal "cost_per_unit", precision: 20, scale: 4, default: "0.0", null: false - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.bigint "plan_id" t.bigint "tenant_id" t.index ["plan_id"], name: "index_pricing_rules_on_plan_id_and_plan_type" @@ -1024,8 +1023,8 @@ t.string "email_sales" t.string "email_techsupport" t.string "email_press" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.string "logo_file_name" t.string "logo_content_type" t.integer "logo_file_size" @@ -1042,9 +1041,9 @@ t.text "value" t.bigint "user_id" t.bigint "tenant_id" - t.datetime "expires_at" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "expires_at", precision: nil + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.index ["user_id"], name: "fk_rails_260e99b630" end @@ -1053,8 +1052,8 @@ t.bigint "provider_id" t.integer "max_users" t.integer "max_services" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.index ["provider_id"], name: "index_provider_constraints_on_provider_id", unique: true end @@ -1062,15 +1061,15 @@ t.bigint "tenant_id" t.bigint "service_id" t.string "endpoint" - t.datetime "deployed_at" + t.datetime "deployed_at", precision: nil t.string "auth_app_key", default: "app_key" t.string "auth_app_id", default: "app_id" t.string "auth_user_key", default: "user_key" t.string "credentials_location", default: "query", null: false t.string "error_auth_failed", default: "Authentication failed" t.string "error_auth_missing", default: "Authentication parameters missing" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.integer "error_status_auth_failed", default: 403, null: false t.string "error_headers_auth_failed", default: "text/plain; charset=us-ascii", null: false t.integer "error_status_auth_missing", default: 403, null: false @@ -1101,8 +1100,8 @@ create_table "proxy_config_affecting_changes", charset: "utf8mb3", collation: "utf8mb3_bin", force: :cascade do |t| t.integer "proxy_id", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.index ["proxy_id"], name: "index_proxy_config_affecting_changes_on_proxy_id", unique: true end @@ -1113,8 +1112,8 @@ t.bigint "tenant_id" t.string "environment", null: false t.text "content", size: :medium, null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.string "hosts", limit: 8192 t.index ["proxy_id", "environment", "version"], name: "index_proxy_configs_on_proxy_id_and_environment_and_version" t.index ["proxy_id"], name: "index_proxy_configs_on_proxy_id" @@ -1126,8 +1125,8 @@ t.bigint "tenant_id" t.text "lua_file", size: :medium t.string "status" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil end create_table "proxy_rules", charset: "utf8mb3", collation: "utf8mb3_bin", force: :cascade do |t| @@ -1138,8 +1137,8 @@ t.string "metric_system_name" t.integer "delta" t.bigint "tenant_id" - t.datetime "created_at", null: false - t.datetime "updated_at" + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil t.text "redirect_url" t.integer "position" t.boolean "last", default: false @@ -1152,8 +1151,8 @@ create_table "referrer_filters", charset: "utf8mb3", collation: "utf8mb3_bin", force: :cascade do |t| t.bigint "application_id", null: false t.string "value", null: false - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.bigint "tenant_id" t.index ["application_id"], name: "index_referrer_filters_on_application_id" end @@ -1161,16 +1160,16 @@ create_table "service_cubert_infos", charset: "utf8mb3", collation: "utf8mb3_bin", force: :cascade do |t| t.string "bucket_id" t.bigint "service_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false t.bigint "tenant_id" end create_table "service_tokens", charset: "utf8mb3", collation: "utf8mb3_bin", force: :cascade do |t| t.bigint "service_id" t.string "value" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.bigint "tenant_id" t.index ["service_id"], name: "index_service_tokens_on_service_id" end @@ -1180,8 +1179,8 @@ t.string "name", default: "" t.text "description" t.text "txt_support" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.string "logo_file_name" t.string "logo_content_type" t.integer "logo_file_size" @@ -1215,8 +1214,8 @@ t.string "bg_colour" t.string "link_colour" t.string "text_colour" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.string "menu_bg_colour" t.string "link_label" t.string "link_url" @@ -1288,7 +1287,7 @@ t.string "name" t.string "sluggable_type", limit: 50 t.bigint "sluggable_id" - t.datetime "created_at" + t.datetime "created_at", precision: nil t.integer "sequence", default: 1, null: false t.bigint "tenant_id" t.index ["name", "sluggable_type", "sequence"], name: "index_slugs_on_n_s_and_s" @@ -1299,8 +1298,8 @@ t.string "uid" t.bigint "authentication_provider_id" t.bigint "user_id" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.bigint "tenant_id" t.text "id_token" t.index ["authentication_provider_id"], name: "index_sso_authorizations_on_authentication_provider_id" @@ -1311,8 +1310,8 @@ t.string "ref" t.string "name" t.text "description" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.integer "pos" t.integer "tenant_id" end @@ -1321,8 +1320,8 @@ t.bigint "tag_id" t.bigint "taggable_id" t.string "taggable_type" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.bigint "tenant_id" t.integer "tagger_id" t.string "tagger_type" @@ -1333,8 +1332,8 @@ create_table "tags", charset: "utf8mb3", collation: "utf8mb3_bin", force: :cascade do |t| t.string "name" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.bigint "account_id" t.bigint "tenant_id" t.integer "taggings_count", default: 0 @@ -1344,8 +1343,8 @@ create_table "topic_categories", charset: "utf8mb3", collation: "utf8mb3_bin", force: :cascade do |t| t.string "name" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.bigint "forum_id" t.bigint "tenant_id" t.index ["forum_id"], name: "index_topic_categories_on_forum_id" @@ -1355,14 +1354,14 @@ t.bigint "forum_id" t.bigint "user_id" t.string "title" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.integer "hits", default: 0 t.boolean "sticky", default: false, null: false t.integer "posts_count", default: 0 t.boolean "locked", default: false t.bigint "last_post_id" - t.datetime "last_updated_at" + t.datetime "last_updated_at", precision: nil t.bigint "last_user_id" t.string "permalink" t.bigint "category_id" @@ -1377,8 +1376,8 @@ t.bigint "metric_id" t.string "period" t.bigint "value" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.bigint "plan_id" t.string "plan_type", null: false t.bigint "tenant_id" @@ -1392,11 +1391,11 @@ t.string "key" t.string "ip" t.string "user_agent" - t.datetime "accessed_at" - t.datetime "revoked_at" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.datetime "secured_until" + t.datetime "accessed_at", precision: nil + t.datetime "revoked_at", precision: nil + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false + t.datetime "secured_until", precision: nil t.bigint "sso_authorization_id" t.index ["key"], name: "idx_key" t.index ["sso_authorization_id"], name: "index_user_sessions_on_sso_authorization_id" @@ -1406,8 +1405,8 @@ create_table "user_topics", charset: "utf8mb3", collation: "utf8mb3_bin", force: :cascade do |t| t.bigint "user_id" t.bigint "topic_id" - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.bigint "tenant_id" end @@ -1416,12 +1415,12 @@ t.string "email" t.string "crypted_password", limit: 40 t.string "salt", limit: 40 - t.datetime "created_at", null: false - t.datetime "updated_at" + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil t.string "remember_token", limit: 40 - t.datetime "remember_token_expires_at" + t.datetime "remember_token_expires_at", precision: nil t.string "activation_code", limit: 40 - t.datetime "activated_at" + t.datetime "activated_at", precision: nil t.string "state" t.string "role", default: "" t.string "lost_password_token" @@ -1431,14 +1430,14 @@ t.string "last_name" t.string "signup_type" t.string "job_role" - t.datetime "last_login_at" + t.datetime "last_login_at", precision: nil t.string "last_login_ip" t.string "email_verification_code" t.string "title" t.text "extra_fields" t.bigint "tenant_id" t.string "cas_identifier" - t.datetime "lost_password_token_generated_at" + t.datetime "lost_password_token_generated_at", precision: nil t.string "authentication_id" t.string "open_id" t.string "password_digest" @@ -1461,8 +1460,8 @@ t.boolean "application_created_on", default: false t.boolean "application_updated_on", default: false t.boolean "application_deleted_on", default: false - t.datetime "created_at" - t.datetime "updated_at" + t.datetime "created_at", precision: nil + t.datetime "updated_at", precision: nil t.boolean "provider_actions", default: false t.boolean "account_plan_changed_on", default: false t.boolean "application_plan_changed_on", default: false diff --git a/features/step_definitions/provider_steps.rb b/features/step_definitions/provider_steps.rb index a410100081..1cf2ef4e8a 100644 --- a/features/step_definitions/provider_steps.rb +++ b/features/step_definitions/provider_steps.rb @@ -247,9 +247,11 @@ def create_provider_with_plan(name, plan) # TODO: RENAME THIS NOWWW @provider = FactoryBot.create(:provider_account_with_pending_users_signed_up_to_no_plan, org_name: name, domain: name, self_domain: "admin.#{name}") - @provider.application_contracts.delete_all - - @provider.buy!(plan, name: 'Default', description: 'Default') unless @provider.bought?(plan) + unless @provider.bought?(plan) + @provider.application_contracts.delete_all + @provider.buy!(plan, name: 'Default', description: 'Default') + @provider.bought_cinstances.reset + end import_simple_layout(@provider) end @@ -338,7 +340,7 @@ def create_provider_with_plan(name, plan) # TODO: RENAME THIS NOWWW Given(/^master is the provider$/) do @provider = Account.master - @service ||= @provider.default_service + @service = @provider.default_service @provider.settings.allow_multiple_applications! @provider.settings.show_multiple_applications! FactoryBot.create(:application_plan, name: 'The Plan', diff --git a/features/step_definitions/stats/provider_response_codes.rb b/features/step_definitions/stats/provider_response_codes.rb index bcab889c3f..3a63a84c3f 100644 --- a/features/step_definitions/stats/provider_response_codes.rb +++ b/features/step_definitions/stats/provider_response_codes.rb @@ -11,7 +11,7 @@ service = @provider.first_service! keys = RESPONSE_CODES.flat_map do |code| - [["stats/{service:#{service.id}}/response_code:#{code}/hour:#{now.at_beginning_of_day.to_s(:compact)}", RESPONSE_CODE_VALUE]] + [["stats/{service:#{service.id}}/response_code:#{code}/hour:#{now.at_beginning_of_day.to_fs(:compact)}", RESPONSE_CODE_VALUE]] end.to_h storage.mapped_mset(keys) diff --git a/lib/arel/visitors/oracle12_hack.rb b/lib/arel/visitors/oracle12_hack.rb index 6376c292ac..0cd11eabcc 100644 --- a/lib/arel/visitors/oracle12_hack.rb +++ b/lib/arel/visitors/oracle12_hack.rb @@ -27,8 +27,12 @@ def visit_Arel_Nodes_NotIn(o, collector) # Oracle can't compare CLOB columns with standard SQL operators for comparison. # We need to replace standard equality for text/binary columns to use DBMS_LOB.COMPARE function. # Fixes ORA-00932: inconsistent datatypes: expected - got CLOB - # remove if https://github.com/rsim/oracle-enhanced/issues/2239 is fixed (in Rails 7.0.1) + # remove when https://github.com/rsim/oracle-enhanced/pull/2415 is merged def visit_Arel_Nodes_Equality(o, collector) + right = o.right + + return super if right.nil? + case (left = o.left) when Arel::Attributes::Attribute table = left.relation.table_name @@ -42,7 +46,7 @@ def visit_Arel_Nodes_Equality(o, collector) when :text, :binary # https://docs.oracle.com/cd/B19306_01/appdev.102/b14258/d_lob.htm#i1016668 # returns 0 when the comparison succeeds - comparator = Arel::Nodes::NamedFunction.new('DBMS_LOB.COMPARE', [left, o.right]) + comparator = Arel::Nodes::NamedFunction.new('DBMS_LOB.COMPARE', [left, right]) collector = visit comparator, collector collector << ' = 0' collector @@ -54,7 +58,7 @@ def visit_Arel_Nodes_Equality(o, collector) end end - # remove when addressed: https://github.com/rsim/oracle-enhanced/pull/2247 + # remove when addressed: https://github.com/rsim/oracle-enhanced/pull/2247 - included in v7.1.0 def visit_Arel_Nodes_Matches o, collector if !o.case_sensitive && o.left && o.right o.left = Arel::Nodes::NamedFunction.new('UPPER', [o.left]) diff --git a/lib/developer_portal/app/controllers/developer_portal/admin/applications/user_keys_controller.rb b/lib/developer_portal/app/controllers/developer_portal/admin/applications/user_keys_controller.rb index 66fc8d145c..6eb4a7a8d7 100644 --- a/lib/developer_portal/app/controllers/developer_portal/admin/applications/user_keys_controller.rb +++ b/lib/developer_portal/app/controllers/developer_portal/admin/applications/user_keys_controller.rb @@ -9,7 +9,7 @@ def update @cinstance.change_user_key! flash[:notice] = 'The user key was regenerated.' - redirect_back(fallback_location: admin_application_user_key_path(@cinstance.id)) + redirect_back_or_to(admin_application_user_key_path(@cinstance.id)) end private diff --git a/lib/developer_portal/app/controllers/developer_portal/cms/new_content_controller.rb b/lib/developer_portal/app/controllers/developer_portal/cms/new_content_controller.rb index 09c2d279fe..afeafb4818 100644 --- a/lib/developer_portal/app/controllers/developer_portal/cms/new_content_controller.rb +++ b/lib/developer_portal/app/controllers/developer_portal/cms/new_content_controller.rb @@ -46,7 +46,6 @@ def show append_view_path Liquid::Template::FallbackResolver.new append_view_path Liquid::Template::FallbackResolverNoPrefix.new - page = find_page! assign_drops :page => Liquid::Drops::Page.new(page), diff --git a/lib/developer_portal/lib/liquid/template/fallback_resolver.rb b/lib/developer_portal/lib/liquid/template/fallback_resolver.rb index 27908d0ec2..7accdcf485 100644 --- a/lib/developer_portal/lib/liquid/template/fallback_resolver.rb +++ b/lib/developer_portal/lib/liquid/template/fallback_resolver.rb @@ -8,19 +8,8 @@ def initialize(path = DeveloperPortal::VIEW_PATH) end def _find_all(name, prefix, partial, details, key = nil, locals = []) - path = build_path(name, prefix, partial) - # force just liquid format - details = details.merge(handlers: [:liquid]) - - query(path, details, details[:formats], locals, cache: !!key) - end - - def build_path(name, prefix, partial) - prefix = prefix ? [prefix] : [] - prefix = ::File.join(*prefix) - ::Rails.logger.debug { "FallbackResolver: path: #{[name, prefix, partial].inspect}" } - Path.build(name, prefix, partial) + super(name, prefix, partial, details.merge(handlers: [:liquid]), key, locals) end public :_find_all diff --git a/lib/developer_portal/lib/liquid/template/fallback_resolver_no_prefix.rb b/lib/developer_portal/lib/liquid/template/fallback_resolver_no_prefix.rb index b5d95f64b5..dbc9b5610a 100644 --- a/lib/developer_portal/lib/liquid/template/fallback_resolver_no_prefix.rb +++ b/lib/developer_portal/lib/liquid/template/fallback_resolver_no_prefix.rb @@ -3,18 +3,9 @@ module Liquid class Template class FallbackResolverNoPrefix < FallbackResolver - - def initialize(path = DeveloperPortal::VIEW_PATH) - super - end - def _find_all(name, prefix, partial, details, key = nil, locals = []) - path = build_path(name, prefix = nil, partial) - - # force just liquid format - details = details.merge(handlers: [:liquid]) - - query(path, details, details[:formats], locals, cache: !!key) + # force just liquid format and set an empty prefix + super(name, '', partial, details.merge(handlers: [:liquid]), key, locals) end end end diff --git a/lib/developer_portal/lib/liquid/template/without_liquid_resolver.rb b/lib/developer_portal/lib/liquid/template/without_liquid_resolver.rb index 93e7cb450d..574ac92975 100644 --- a/lib/developer_portal/lib/liquid/template/without_liquid_resolver.rb +++ b/lib/developer_portal/lib/liquid/template/without_liquid_resolver.rb @@ -1,6 +1,6 @@ module Liquid class Template - class WithoutLiquidResolver < ActionView::OptimizedFileSystemResolver + class WithoutLiquidResolver < ActionView::FileSystemResolver def initialize(path = Rails.root.join('app', 'views')) super diff --git a/app/lib/three_scale/has_money.rb b/lib/three_scale/has_money.rb similarity index 100% rename from app/lib/three_scale/has_money.rb rename to lib/three_scale/has_money.rb diff --git a/lib/three_scale/tenant_id_integrity_checker.rb b/lib/three_scale/tenant_id_integrity_checker.rb index 815c5e75c1..ee506440a2 100644 --- a/lib/three_scale/tenant_id_integrity_checker.rb +++ b/lib/three_scale/tenant_id_integrity_checker.rb @@ -21,7 +21,7 @@ def check def associated_inconsistent_pairs(model, processed: []) model.reflect_on_all_associations.inject([]) do |inconsistent_found, association| - next inconsistent_found if can_skip_asociation?(association, processed: processed) + next inconsistent_found if can_skip_asociation?(model, association, processed: processed) processed << association @@ -50,7 +50,7 @@ def pk_fields(model) model.primary_key ? Array(model.primary_key) : model.connection.primary_keys(model.table_name) end - def can_skip_asociation?(association, processed: []) + def can_skip_asociation?(model, association, processed: []) # we can ignore these as they can't be automatically excluded but are redundant for the check anyway ignored = { Service => %i[all_metrics], # all metrics of service and APIs used by service so is redundant @@ -58,10 +58,13 @@ def can_skip_asociation?(association, processed: []) # bought_* are redundant with contracts # email_templates is redundant with templates Account => %i[provider_accounts bought_account_contract bought_cinstances bought_service_contracts email_templates], - Cinstance => %i[plan], # this is redundant with Contract.plan but overrides it so is not auto-detected - ApplicationPlan => %i[cinstances], # same as Cinstance.plan, this is covered by Plan.contracts + # Cinstance.plan is redundant with Contract.plan but overrides it so is not auto-detected + # Cinstance.service is inverse of Service.cinstances but is not autodetected so disabling it here + Cinstance => %i[plan service], + ApplicationPlan => %i[cinstances], # same as Cinstance.plan, this is covered also by Plan.contracts } - model = association.active_record + + return true if model != association.active_record # we want only association of base STI model instead of a sub-model return true if ignored[model]&.include?(association.name) diff --git a/openshift/system/Dockerfile b/openshift/system/Dockerfile index 8f11489a56..da1a7640a6 100644 --- a/openshift/system/Dockerfile +++ b/openshift/system/Dockerfile @@ -20,7 +20,7 @@ RUN dnf -y --enablerepo=crb --setopt=module_stream_switch=True module enable rub && bundle install --jobs $(grep -c processor /proc/cpuinfo) --retry=5 \ && npm install -g yarn \ && yarn install:safe --no-progress \ - # TODO: update to SECRET_KEY_BASE_DUMMY=1 when we upgrade to Rails 7.0 + # TODO: update to SECRET_KEY_BASE_DUMMY=1 when we upgrade to Rails 7.1 && SECRET_KEY_BASE=rails/32947 bundle exec rake assets:precompile tmp:clear \ && rm -rf node_modules /usr/local/share/gems/cache /usr/local/share/gems/doc @@ -99,7 +99,7 @@ ENV THINKING_SPHINX_ADDRESS=0.0.0.0 \ THINKING_SPHINX_QUERY_LOG=/dev/stdout \ THINKING_SPHINX_LOG=/dev/stdout \ RAILS_ENV=production \ - # TODO: update to SECRET_KEY_BASE_DUMMY=1 when we upgrade to Rails 7.0 + # TODO: update to SECRET_KEY_BASE_DUMMY=1 when we upgrade to Rails 7.1 SECRET_KEY_BASE=dummy \ DATABASE_URL='mysql2://root:@localhost/porta' USER 0 diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index c68f61740b..b4d6bfb415 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -73,7 +73,7 @@ RSpec.configure do |config| config.include RSpecHtmlMatchers # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures - config.fixture_path = "#{::Rails.root}/test/fixtures" + config.file_fixture_path = "#{::Rails.root}/test/fixtures" # If you're not using ActiveRecord, or you'd prefer not to run each of your # examples within a transaction, remove the following line or assign false diff --git a/test/functional/developer_portal/admin/plans_widget_controller_not_requiring_credit_card_test.rb b/test/functional/developer_portal/admin/plans_widget_controller_not_requiring_credit_card_test.rb index aaa62615e6..5cbc2f9802 100644 --- a/test/functional/developer_portal/admin/plans_widget_controller_not_requiring_credit_card_test.rb +++ b/test/functional/developer_portal/admin/plans_widget_controller_not_requiring_credit_card_test.rb @@ -32,8 +32,8 @@ def setup test 'show allow direct plan change for paid plans' do get :index, params: { :service_id => @service.id, :application_id => @application.id } - assert_select('input[id=?]', "change-plan-#{@paid_plan.id}", :value => 'Change Plan') - assert_select('input[id=?]', "change-plan-#{@free_plan.id}", :value => 'Change Plan') + assert_select('button[id=?]', "change-plan-#{@paid_plan.id}", :value => 'Change Plan') + assert_select('button[id=?]', "change-plan-#{@free_plan.id}", :value => 'Change Plan') end end diff --git a/test/functional/developer_portal/admin/plans_widget_controller_requiring_credit_card_test.rb b/test/functional/developer_portal/admin/plans_widget_controller_requiring_credit_card_test.rb index 83adcfa499..8d528e3411 100644 --- a/test/functional/developer_portal/admin/plans_widget_controller_requiring_credit_card_test.rb +++ b/test/functional/developer_portal/admin/plans_widget_controller_requiring_credit_card_test.rb @@ -40,7 +40,7 @@ def setup selector = format('a[id="%s"][href="%s"]', "change-plan-#{@paid_plan.id}", url) assert_select(selector, text: 'enter your Credit Card details') - assert_select('input[id=?]', "change-plan-#{@free_plan.id}", :value => 'Change Plan') + assert_select('button[id=?]', "change-plan-#{@free_plan.id}", :value => 'Change Plan') end test 'show link to enter CC details for paid plans when buyer CC details are missing and buyer is charged without wizard' do @@ -54,7 +54,7 @@ def setup selector = format('a[id="%s"][href="%s"]', "change-plan-#{@paid_plan.id}", url) assert_select(selector, text: 'enter your Credit Card details') - assert_select('input[id=?]', "change-plan-#{@free_plan.id}", :value => 'Change Plan') + assert_select('button[id=?]', "change-plan-#{@free_plan.id}", :value => 'Change Plan') end test 'show button to change plan when buyer is not charged' do @@ -64,8 +64,8 @@ def setup get :index, params: { :service_id => @service.id, :application_id => @application.id } - assert_select('input[id=?]', "change-plan-#{@paid_plan.id}", value: 'Change Plan') - assert_select('input[id=?]', "change-plan-#{@free_plan.id}", value: 'Change Plan') + assert_select('button[id=?]', "change-plan-#{@paid_plan.id}", value: 'Change Plan') + assert_select('button[id=?]', "change-plan-#{@free_plan.id}", value: 'Change Plan') end test 'show button to change plan when buyer CC details are stored' do @@ -77,8 +77,8 @@ def setup get :index, params: { :service_id => @service.id, :application_id => @application.id } - assert_select('input[id=?]', "change-plan-#{@paid_plan.id}", :value => 'Change Plan') - assert_select('input[id=?]', "change-plan-#{@free_plan.id}", :value => 'Change Plan') + assert_select('button[id=?]', "change-plan-#{@paid_plan.id}", :value => 'Change Plan') + assert_select('button[id=?]', "change-plan-#{@free_plan.id}", :value => 'Change Plan') end end diff --git a/test/integration/admin/api/backend_apis/metrics_controller_test.rb b/test/integration/admin/api/backend_apis/metrics_controller_test.rb index aa946bf713..3ffe7285da 100644 --- a/test/integration/admin/api/backend_apis/metrics_controller_test.rb +++ b/test/integration/admin/api/backend_apis/metrics_controller_test.rb @@ -77,7 +77,7 @@ def setup end test 'system_name can be created but not updated' do - post admin_api_backend_api_metrics_path(backend_api), params: { access_token: access_token_value, friendly_name: 'metric friendly name', unit: 'hit', system_name: 'edited', system_name: 'first-system-name' } + post admin_api_backend_api_metrics_path(backend_api), params: { access_token: access_token_value, friendly_name: 'metric friendly name', unit: 'hit', system_name: 'first-system-name' } metric = backend_api.metrics.find(JSON.parse(response.body).dig('metric', 'id')) assert_equal "first-system-name.#{backend_api.id}", metric.attributes['system_name'] diff --git a/test/integration/buyers/service_contracts/bulk/change_plans_controller_test.rb b/test/integration/buyers/service_contracts/bulk/change_plans_controller_test.rb index 32ec71b497..2f952d6259 100644 --- a/test/integration/buyers/service_contracts/bulk/change_plans_controller_test.rb +++ b/test/integration/buyers/service_contracts/bulk/change_plans_controller_test.rb @@ -23,7 +23,7 @@ def setup action: 'create' } assert_response :unprocessable_entity - assert_template 'buyers/service_contracts/bulk/shared/errors.html' + assert_template 'buyers/service_contracts/bulk/shared/errors' end test '#new renders with the display_name in the title of the contract' do diff --git a/test/unit/cache_store_test.rb b/test/unit/cache_store_test.rb index c9ccbbd85f..c3dbad157b 100644 --- a/test/unit/cache_store_test.rb +++ b/test/unit/cache_store_test.rb @@ -27,7 +27,8 @@ class CacheStoreTest < ActionView::TestCase cache = ActiveSupport::Cache.lookup_store(*System::Application.cache_store_config) assert_equal ActiveSupport::Cache::MemoryStore, cache.class - assert_equal options, cache.options + assert cache.options[:compress] + assert_equal 5000, cache.options[:size] end test ':file_store can be set as cache store' do @@ -102,7 +103,7 @@ class CacheStoreTest < ActionView::TestCase cache = ActiveSupport::Cache.lookup_store(*System::Application.cache_store_config) assert_equal ActiveSupport::Cache::MemCacheStore, cache.class - assert_equal({ digest_class: Digest::SHA256 }, cache.options) + assert_equal Digest::SHA256, cache.options[:digest_class] end test ':mem_cache_store allows overwriting the default digest algorithm' do @@ -117,7 +118,7 @@ class CacheStoreTest < ActionView::TestCase cache = ActiveSupport::Cache.lookup_store(*System::Application.cache_store_config) assert_equal ActiveSupport::Cache::MemCacheStore, cache.class - assert_equal options, cache.options + assert_equal Digest::SHA1, cache.options[:digest_class] end test ':redis_cache_store can be set as cache store' do diff --git a/test/unit/helpers/account_helper_test.rb b/test/unit/helpers/account_helper_test.rb index ca0f2ec1ad..f3c2919e63 100644 --- a/test/unit/helpers/account_helper_test.rb +++ b/test/unit/helpers/account_helper_test.rb @@ -29,7 +29,7 @@ def current_user assert_includes link, "href=\"#{admin_buyers_account_path(developer)}\"" assert_does_not_contain link, /data-confirm=\"[^=]*in 15 days/ - assert_does_not_contain link, /data-confirm=\"[^=]*#{15.days.from_now.to_date.to_s(:long)}/ + assert_does_not_contain link, /data-confirm=\"[^=]*#{15.days.from_now.to_date.to_fs(:long)}/ assert_contains link, /data-confirm=\"[^=]*Are you sure you want to delete/ end end @@ -45,7 +45,7 @@ def current_user assert_includes link, "href=\"#{admin_buyers_account_path(provider)}\"" assert_contains link, /data-confirm=\"[^=]*in 15 days/ - assert_contains link, /data-confirm=\"[^=]*#{15.days.from_now.to_date.to_s(:long)}/ + assert_contains link, /data-confirm=\"[^=]*#{15.days.from_now.to_date.to_fs(:long)}/ assert_does_not_contain link, /data-confirm=\"[^=]*Are you sure you want to delete/ end end diff --git a/test/unit/liquid/filters/rails_helpers_test.rb b/test/unit/liquid/filters/rails_helpers_test.rb index cf2e0271d1..ca92af5257 100644 --- a/test/unit/liquid/filters/rails_helpers_test.rb +++ b/test/unit/liquid/filters/rails_helpers_test.rb @@ -34,7 +34,7 @@ def setup assert_same_elements [ "", - "" + "" ], javascript_include_tag('stats.js').split(/\n/) assert_same_elements [ @@ -114,6 +114,6 @@ class Dummy html = create_button('Title', '/path', 'disable_with' => 'deleting...', 'confirm' => 'sure?', 'class' => 'foo') - assert_equal '
', html + assert_equal '
', html end end diff --git a/test/unit/liquid/forms_test.rb b/test/unit/liquid/forms_test.rb index 586f4426da..1e9adb68a0 100644 --- a/test/unit/liquid/forms_test.rb +++ b/test/unit/liquid/forms_test.rb @@ -114,7 +114,9 @@ def get(form, name = 'object', html_attributes={}) def controller controller = ApplicationController.new - controller.stubs(:session).returns(ActionDispatch::Request.new({}).session) + store = stub('store', load_session: [1, {}], session_exists?: true) + @session = ActionDispatch::Request::Session.create(store, ActionDispatch::Request.empty, {}) + controller.stubs(:session).returns(@session) controller end diff --git a/test/unit/models_test.rb b/test/unit/models_test.rb index 9c474131c3..ad3cc8d01c 100644 --- a/test/unit/models_test.rb +++ b/test/unit/models_test.rb @@ -7,21 +7,52 @@ class ModelsTest < ActiveSupport::TestCase test 'validate length of strings for all models to do not raise an error reaching DB' do exceptions = { - 'FieldsDefinition' => %w[target], 'AuthenticationProvider' => %w[account_type], 'Feature' => %w[featurable_type scope], 'Message' => %w[state], - 'UsageLimit' => %w[period plan_type], 'Policy' => %w[identifier], 'ProxyRule' => %w[metric_system_name], 'ProxyConfig' => %w[hosts], - 'Proxy' => %w[endpoint sandbox_endpoint], 'OIDCConfiguration' => %w[oidc_configurable_type], 'Invitation' => %w[token], - 'Settings' => Switches::SWITCHES.map { |switch| "#{switch}_switch" }, - 'Invoice' => %w[pdf_file_name pdf_content_type state friendly_id fiscal_code vat_code currency creation_type], 'DeletedObject' => %w[owner_type object_type], + 'Account' => %w[credit_card_auth_code credit_card_authorize_net_payment_profile_token credit_card_partial_number], + 'AccountPlan' => %w[issuer_type], + 'Annotation' => %w[annotated_type], + 'ApplicationPlan' => %w[issuer_type], + 'AuthenticationProvider::Auth0' => %w[account_type], + 'AuthenticationProvider::Custom' => %w[account_type], + 'AuthenticationProvider::GitHub' => %w[branding_state account_type], + 'AuthenticationProvider::Keycloak' => %w[account_type], + 'AuthenticationProvider::RedhatCustomerPortal' => %w[account_type], + 'AuthenticationProvider::ServiceDiscoveryProvider' => %w[account_type], + 'AuthenticationProvider' => %w[account_type], + 'CMS::Builtin::LegalTerm' => %w[title content_type], + 'CMS::Builtin::Page' => %w[title content_type], + 'CMS::Builtin::Partial' => %w[title content_type], + 'CMS::Builtin::StaticPage' => %w[title], + 'CMS::Builtin' => %w[title], + 'CMS::EmailTemplate' => %w[content_type], + 'CMS::Partial' => %w[content_type], + 'CMS::Portlet::Base' => %w[content_type], + 'CMS::Portlet' => %w[content_type], + 'DeletedObject' => %w[owner_type object_type], + 'ExternalRssFeedPortlet' => %w[content_type], + 'Feature' => %w[featurable_type scope], + 'FeaturesPlan' => %w[plan_type], + 'FieldsDefinition' => %w[target], + 'Invitation' => %w[token], + 'Invoice' => %w[pdf_file_name pdf_content_type state friendly_id fiscal_code vat_code currency creation_type], + 'LatestForumPostsPortlet' => %w[content_type], + 'LogEntry' => %w[description], + 'Message' => %w[state], + 'Metric' => %w[owner_type], + 'Notification' => %w[event_id], + 'OIDCConfiguration' => %w[oidc_configurable_type], 'Onboarding' => %w[wizard_state bubble_api_state bubble_metric_state bubble_deployment_state bubble_mapping_state bubble_limit_state], - 'FeaturesPlan' => %w[plan_type], 'LogEntry' => %w[description], 'Notification' => %w[event_id], 'PlanMetric' => %w[plan_type], - 'Profile' => %w[logo_file_name logo_content_type state], 'UserSession' => %w[key user_agent], 'CMS::Partial' => %w[content_type], - 'CMS::EmailTemplate' => %w[content_type], 'CMS::Builtin' => %w[title], 'CMS::Builtin::StaticPage' => %w[title], 'CMS::Builtin::Page' => %w[title content_type], - 'CMS::Builtin::Partial' => %w[title content_type], 'CMS::Portlet' => %w[content_type], 'CMS::Builtin::LegalTerm' => %w[title content_type], - 'CMS::Portlet::Base' => %w[content_type], 'ExternalRssFeedPortlet' => %w[content_type], - 'LatestForumPostsPortlet' => %w[content_type], 'TableOfContentsPortlet' => %w[content_type], 'AuthenticationProvider::GitHub' => %w[branding_state account_type], - 'AuthenticationProvider::Keycloak' => %w[account_type], 'AuthenticationProvider::Auth0' => %w[account_type], 'AuthenticationProvider::Custom' => %w[account_type], - 'AuthenticationProvider::ServiceDiscoveryProvider' => %w[account_type], 'AuthenticationProvider::RedhatCustomerPortal' => %w[account_type], - 'Account' => %w[credit_card_auth_code credit_card_authorize_net_payment_profile_token credit_card_partial_number] + 'Plan' => %w[issuer_type], + 'PlanMetric' => %w[plan_type], + 'Policy' => %w[identifier], + 'Profile' => %w[logo_file_name logo_content_type state], + 'Proxy' => %w[endpoint sandbox_endpoint], + 'ProxyConfig' => %w[hosts], + 'ProxyRule' => %w[metric_system_name owner_type], + 'ServicePlan' => %w[issuer_type], + 'Settings' => Switches::SWITCHES.map { |switch| "#{switch}_switch" }, + 'TableOfContentsPortlet' => %w[content_type], + 'UsageLimit' => %w[period plan_type], + 'UserSession' => %w[key user_agent] } Rails.application.eager_load! diff --git a/test/unit/services/signup_service_test.rb b/test/unit/services/signup_service_test.rb index 03f0a91f95..3ef5d4a56c 100644 --- a/test/unit/services/signup_service_test.rb +++ b/test/unit/services/signup_service_test.rb @@ -4,7 +4,8 @@ class SignupServiceTest < ActiveSupport::TestCase def setup @provider = FactoryBot.create(:provider_account) - @session = ActionDispatch::Request.new({}).session + store = stub('store', load_session: [1, {}], session_exists?: true) + @session = ActionDispatch::Request::Session.create(store, ActionDispatch::Request.empty, {}) end def test_new diff --git a/test/unit/stats/aggregation/rule_test.rb b/test/unit/stats/aggregation/rule_test.rb index ce0f6b89ca..8a189b1103 100644 --- a/test/unit/stats/aggregation/rule_test.rb +++ b/test/unit/stats/aggregation/rule_test.rb @@ -17,7 +17,7 @@ def setup :created_at => time} rule.aggregate(data) - key = "stats/{service:#{service.backend_id}}/metric:789/day:#{time.beginning_of_cycle(:day).to_s(:compact)}" + key = "stats/{service:#{service.backend_id}}/metric:789/day:#{time.beginning_of_cycle(:day).to_fs(:compact)}" ttl = @storage.ttl(key) diff --git a/test/unit/tasks/multitenant/tenants_integrity_test.rb b/test/unit/tasks/multitenant/tenants_integrity_test.rb index 51544a7824..12d10d0ee8 100644 --- a/test/unit/tasks/multitenant/tenants_integrity_test.rb +++ b/test/unit/tasks/multitenant/tenants_integrity_test.rb @@ -5,6 +5,8 @@ module Tasks module Multitenant class TenantsIntegrityTest < ActiveSupport::TestCase + HEADER = "Inconsistent tenant_ids for:" + test "reports tenant lack of integrity with belongs_to associations" do provider = FactoryBot.create(:simple_provider) wrong_buyers = FactoryBot.create_list(:simple_buyer, 2, provider_account: provider, tenant_id: provider.id + 1) @@ -23,14 +25,18 @@ class TenantsIntegrityTest < ActiveSupport::TestCase wrong_cinstances = FactoryBot.create_list(:cinstance, 2, plan: plan, tenant_id: 0) FactoryBot.create(:cinstance, plan: plan) - expected_lines = ["Inconsistent tenant_ids for:"] + expected_lines = [] wrong_cinstances.each do |cinstance| - expected_lines << "Account[#{cinstance.user_account.id}] contracts Contract[#{cinstance.id}]" - expected_lines << "Contract[#{cinstance.id}] plan Plan[#{cinstance.plan.id}]" - expected_lines << "Cinstance[#{cinstance.id}] service Service[#{cinstance.service.id}]" + expected_lines << %W[Account[#{cinstance.user_account.id}] Contract[#{cinstance.id}]] + expected_lines << %W[Contract[#{cinstance.id}] Plan[#{cinstance.plan.id}]] + expected_lines << %W[Cinstance[#{cinstance.id}] Service[#{cinstance.service.id}]] end - Rails.logger.expects(:error).with { |msg| expected_lines.all? { msg.include?(_1) } } + Rails.logger.expects(:error).with do |msg| + assert_equal(expected_lines.size + 1, msg.lines.size) && + msg.include?(HEADER) && + expected_lines.all? { msg_includes_pair?(msg, _1) } + end execute_rake_task "multitenant/tenants.rake", "multitenant:tenants:integrity" end @@ -40,14 +46,26 @@ class TenantsIntegrityTest < ActiveSupport::TestCase feature = FactoryBot.create(:feature, featurable: plan.issuer, tenant_id: 0) plan.features << feature - expected_lines = ["Inconsistent tenant_ids for:"] - expected_lines << "Plan[#{plan.id}] features_plans FeaturesPlan[#{plan.id}, #{feature.id}]" - expected_lines << "Service[#{plan.issuer.id}] features Feature[#{feature.id}]" + expected_lines = [] + expected_lines << ["Plan[#{plan.id}]", "FeaturesPlan[#{plan.id}, #{feature.id}]"] + expected_lines << %W[Service[#{plan.issuer.id}] Feature[#{feature.id}]] - Rails.logger.expects(:error).with { |msg| expected_lines.all? { msg.include?(_1) } } + Rails.logger.expects(:error).with do |msg| + assert_equal(expected_lines.size + 1, msg.lines.size) && + msg.include?(HEADER) && + expected_lines.all? { msg_includes_pair?(msg, _1) } + end execute_rake_task "multitenant/tenants.rake", "multitenant:tenants:integrity" end + + private + + def msg_includes_pair?(msg, pair) + first = Regexp.escape(pair[0]) + second = Regexp.escape(pair[1]) + msg.match? /^#{first} [^ ]+ #{second}|#{second} [^ ]+ #{first}$/ + end end end end diff --git a/test/unit/time_formats_test.rb b/test/unit/time_formats_test.rb index 9a70f6f929..3eb187d1c1 100644 --- a/test/unit/time_formats_test.rb +++ b/test/unit/time_formats_test.rb @@ -2,10 +2,10 @@ class TimeFormatsTest < ActiveSupport::TestCase test 'compact' do - assert_equal '20091103123455', Time.utc(2009, 11, 3, 12, 34, 55).to_s(:compact) - assert_equal '200911031234', Time.utc(2009, 11, 3, 12, 34, 0).to_s(:compact) - assert_equal '2009110312', Time.utc(2009, 11, 3, 12, 0, 0).to_s(:compact) - assert_equal '20091103', Time.utc(2009, 11, 3, 0, 0, 0).to_s(:compact) - assert_equal '20091110', Time.utc(2009, 11, 10, 0, 0, 0).to_s(:compact) + assert_equal '20091103123455', Time.utc(2009, 11, 3, 12, 34, 55).to_fs(:compact) + assert_equal '200911031234', Time.utc(2009, 11, 3, 12, 34, 0).to_fs(:compact) + assert_equal '2009110312', Time.utc(2009, 11, 3, 12, 0, 0).to_fs(:compact) + assert_equal '20091103', Time.utc(2009, 11, 3, 0, 0, 0).to_fs(:compact) + assert_equal '20091110', Time.utc(2009, 11, 10, 0, 0, 0).to_fs(:compact) end end diff --git a/test/workers/billing_worker_test.rb b/test/workers/billing_worker_test.rb index 52333cb73a..770f996745 100644 --- a/test/workers/billing_worker_test.rb +++ b/test/workers/billing_worker_test.rb @@ -19,7 +19,7 @@ class BillingWorkerTest < ActiveSupport::TestCase billing_options = { only: [@provider.id], buyer_ids: [@buyer.id], now: time, skip_notifications: true } Finance::BillingStrategy.expects(:daily).with(billing_options).returns(mock_billing_success(time, @provider)) - assert BillingWorker.new.perform(@buyer.id, @provider.id, time.to_s(:iso8601)) + assert BillingWorker.new.perform(@buyer.id, @provider.id, time.to_fs(:iso8601)) end test 'creates a lock per buyer account' do @@ -30,21 +30,21 @@ class BillingWorkerTest < ActiveSupport::TestCase billing_options_2 = { only: [@provider.id], buyer_ids: [buyer_2.id], now: time, skip_notifications: true } Finance::BillingStrategy.expects(:daily).with(billing_options).returns(mock_billing_success(time, @provider)) - assert BillingWorker.new.perform(@buyer.id, @provider.id, time.to_s(:iso8601)) + assert BillingWorker.new.perform(@buyer.id, @provider.id, time.to_fs(:iso8601)) Finance::BillingStrategy.expects(:daily).with(billing_options_2).returns(mock_billing_success(time, @provider)) - assert BillingWorker.new.perform(buyer_2.id, @provider.id, time.to_s(:iso8601)) + assert BillingWorker.new.perform(buyer_2.id, @provider.id, time.to_fs(:iso8601)) - assert_not BillingWorker.new.perform(@buyer.id, @provider.id, time.to_s(:iso8601)) + assert_not BillingWorker.new.perform(@buyer.id, @provider.id, time.to_fs(:iso8601)) end test 'aborts if buyer is locked' do time = Time.utc(2017, 12, 1, 8, 0) within_thread do - assert BillingWorker.new.perform(@buyer.id, @provider.id, time.to_s(:iso8601)) + assert BillingWorker.new.perform(@buyer.id, @provider.id, time.to_fs(:iso8601)) end - refute BillingWorker.new.perform(@buyer.id, @provider.id, time.to_s(:iso8601)) + refute BillingWorker.new.perform(@buyer.id, @provider.id, time.to_fs(:iso8601)) end test 'callback' do