diff --git a/CHANGELOG.md b/CHANGELOG.md
index f7e066533..e0e3ab2be 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,12 @@
# Changelog Fab-manager
+- Updated ruby to 2.7
+- Updated rails to 6.1
+- Updated puma to 6.1
+- Updated responders to 3.0
+- Updated devise to 4.9
+- Updated sassc to 2.3
+
## v5.9.1 2023 March 22
- Fix a bug: logical sequence of invoices references has duplicates
diff --git a/Dockerfile b/Dockerfile
index 31a6369a4..c770ad17f 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,4 +1,4 @@
-FROM ruby:2.6.10-alpine
+FROM ruby:2.7.7-alpine
MAINTAINER contact@fab-manager.com
# Install upgrade system packages
diff --git a/Gemfile b/Gemfile
index 9dffe66f3..c67f0982b 100644
--- a/Gemfile
+++ b/Gemfile
@@ -3,11 +3,11 @@
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
-gem 'rails', '~> 5.2.8'
+gem 'rails', '~> 6.1'
# Used by rails 5.2 to reduce the app boot time by over 50%
gem 'bootsnap'
# Use Puma as web server
-gem 'puma', '4.3.12'
+gem 'puma', '6.1.0'
gem 'shakapacker', '6.5.5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
@@ -17,7 +17,7 @@ gem 'json', '>= 2.3.0'
gem 'jsonpath'
gem 'forgery'
-gem 'responders', '~> 2.0'
+gem 'responders', '~> 3.0'
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
@@ -62,7 +62,7 @@ gem 'pg'
gem 'pg_search'
# authentication
-gem 'devise', '>= 4.6.0'
+gem 'devise', '>= 4.9'
gem 'omniauth', '~> 1.9.2'
gem 'omniauth-oauth2'
gem 'omniauth_openid_connect'
@@ -107,9 +107,6 @@ gem 'pundit'
gem 'oj'
-gem 'actionpack-page_caching', '1.2.2'
-gem 'rails-observers'
-
gem 'chroma'
gem 'message_format'
diff --git a/Gemfile.lock b/Gemfile.lock
index 0edfe78f4..667641988 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -4,50 +4,66 @@ GEM
Ascii85 (1.0.3)
aasm (5.0.8)
concurrent-ruby (~> 1.0)
- actioncable (5.2.8.1)
- actionpack (= 5.2.8.1)
+ actioncable (6.1.7.2)
+ actionpack (= 6.1.7.2)
+ activesupport (= 6.1.7.2)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
- actionmailer (5.2.8.1)
- actionpack (= 5.2.8.1)
- actionview (= 5.2.8.1)
- activejob (= 5.2.8.1)
+ actionmailbox (6.1.7.2)
+ actionpack (= 6.1.7.2)
+ activejob (= 6.1.7.2)
+ activerecord (= 6.1.7.2)
+ activestorage (= 6.1.7.2)
+ activesupport (= 6.1.7.2)
+ mail (>= 2.7.1)
+ actionmailer (6.1.7.2)
+ actionpack (= 6.1.7.2)
+ actionview (= 6.1.7.2)
+ activejob (= 6.1.7.2)
+ activesupport (= 6.1.7.2)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
- actionpack (5.2.8.1)
- actionview (= 5.2.8.1)
- activesupport (= 5.2.8.1)
- rack (~> 2.0, >= 2.0.8)
+ actionpack (6.1.7.2)
+ actionview (= 6.1.7.2)
+ activesupport (= 6.1.7.2)
+ rack (~> 2.0, >= 2.0.9)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
- rails-html-sanitizer (~> 1.0, >= 1.0.2)
- actionpack-page_caching (1.2.2)
- actionpack (>= 5.0.0)
- actionview (5.2.8.1)
- activesupport (= 5.2.8.1)
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
+ actiontext (6.1.7.2)
+ actionpack (= 6.1.7.2)
+ activerecord (= 6.1.7.2)
+ activestorage (= 6.1.7.2)
+ activesupport (= 6.1.7.2)
+ nokogiri (>= 1.8.5)
+ actionview (6.1.7.2)
+ activesupport (= 6.1.7.2)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
- rails-html-sanitizer (~> 1.0, >= 1.0.3)
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
active_record_query_trace (1.7)
- activejob (5.2.8.1)
- activesupport (= 5.2.8.1)
+ activejob (6.1.7.2)
+ activesupport (= 6.1.7.2)
globalid (>= 0.3.6)
- activemodel (5.2.8.1)
- activesupport (= 5.2.8.1)
- activerecord (5.2.8.1)
- activemodel (= 5.2.8.1)
- activesupport (= 5.2.8.1)
- arel (>= 9.0)
- activestorage (5.2.8.1)
- actionpack (= 5.2.8.1)
- activerecord (= 5.2.8.1)
- marcel (~> 1.0.0)
- activesupport (5.2.8.1)
+ activemodel (6.1.7.2)
+ activesupport (= 6.1.7.2)
+ activerecord (6.1.7.2)
+ activemodel (= 6.1.7.2)
+ activesupport (= 6.1.7.2)
+ activestorage (6.1.7.2)
+ actionpack (= 6.1.7.2)
+ activejob (= 6.1.7.2)
+ activerecord (= 6.1.7.2)
+ activesupport (= 6.1.7.2)
+ marcel (~> 1.0)
+ mini_mime (>= 1.1.0)
+ activesupport (6.1.7.2)
concurrent-ruby (~> 1.0, >= 1.0.2)
- i18n (>= 0.7, < 2)
- minitest (~> 5.1)
- tzinfo (~> 1.1)
+ i18n (>= 1.6, < 2)
+ minitest (>= 5.1)
+ tzinfo (~> 2.0)
+ zeitwerk (~> 2.3)
acts_as_list (1.0.4)
activerecord (>= 4.2)
addressable (2.8.0)
@@ -58,7 +74,6 @@ GEM
api-pagination (4.8.2)
apipie-rails (0.5.17)
rails (>= 4.1)
- arel (9.0.0)
ast (2.4.2)
attr_required (1.0.1)
awesome_print (1.8.0)
@@ -66,7 +81,7 @@ GEM
descendants_tracker (~> 0.0.4)
ice_nine (~> 0.11.0)
thread_safe (~> 0.3, >= 0.3.1)
- bcrypt (3.1.13)
+ bcrypt (3.1.18)
bindata (2.4.10)
bindex (0.8.1)
bootsnap (1.4.6)
@@ -113,17 +128,17 @@ GEM
database_cleaner (1.8.3)
descendants_tracker (0.0.4)
thread_safe (~> 0.3, >= 0.3.1)
- devise (4.7.1)
+ devise (4.9.0)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
railties (>= 4.1.0)
responders
warden (~> 1.2.3)
docile (1.3.2)
- dotenv (2.7.5)
- dotenv-rails (2.7.5)
- dotenv (= 2.7.5)
- railties (>= 3.2, < 6.1)
+ dotenv (2.8.1)
+ dotenv-rails (2.8.1)
+ dotenv (= 2.8.1)
+ railties (>= 3.2)
elasticsearch (5.0.5)
elasticsearch-api (= 5.0.5)
elasticsearch-transport (= 5.0.5)
@@ -160,7 +175,7 @@ GEM
fugit (1.5.3)
et-orbi (~> 1, >= 1.2.7)
raabro (~> 1.4)
- globalid (1.0.1)
+ globalid (1.1.0)
activesupport (>= 5.0)
hashdiff (1.0.1)
hashery (2.1.2)
@@ -221,7 +236,7 @@ GEM
rake
mini_magick (4.10.1)
mini_mime (1.1.2)
- mini_portile2 (2.8.0)
+ mini_portile2 (2.8.1)
minitest (5.17.0)
minitest-reporters (1.4.2)
ansi
@@ -233,7 +248,7 @@ GEM
multi_xml (0.6.0)
multipart-post (2.1.1)
nio4r (2.5.8)
- nokogiri (1.13.10)
+ nokogiri (1.14.2)
mini_portile2 (~> 2.8.0)
racc (~> 1.4)
oauth2 (1.4.4)
@@ -293,12 +308,12 @@ GEM
prawn-table (0.2.2)
prawn (>= 1.3.0, < 3.0.0)
public_suffix (4.0.6)
- puma (4.3.12)
+ puma (6.1.0)
nio4r (~> 2.0)
pundit (2.1.0)
activesupport (>= 3.0.0)
raabro (1.4.0)
- racc (1.6.1)
+ racc (1.6.2)
rack (2.2.6.4)
rack-oauth2 (1.19.0)
activesupport
@@ -311,32 +326,32 @@ GEM
rack-test (2.0.2)
rack (>= 1.3)
railroady (1.5.3)
- rails (5.2.8.1)
- actioncable (= 5.2.8.1)
- actionmailer (= 5.2.8.1)
- actionpack (= 5.2.8.1)
- actionview (= 5.2.8.1)
- activejob (= 5.2.8.1)
- activemodel (= 5.2.8.1)
- activerecord (= 5.2.8.1)
- activestorage (= 5.2.8.1)
- activesupport (= 5.2.8.1)
- bundler (>= 1.3.0)
- railties (= 5.2.8.1)
+ rails (6.1.7.2)
+ actioncable (= 6.1.7.2)
+ actionmailbox (= 6.1.7.2)
+ actionmailer (= 6.1.7.2)
+ actionpack (= 6.1.7.2)
+ actiontext (= 6.1.7.2)
+ actionview (= 6.1.7.2)
+ activejob (= 6.1.7.2)
+ activemodel (= 6.1.7.2)
+ activerecord (= 6.1.7.2)
+ activestorage (= 6.1.7.2)
+ activesupport (= 6.1.7.2)
+ bundler (>= 1.15.0)
+ railties (= 6.1.7.2)
sprockets-rails (>= 2.0.0)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
rails-html-sanitizer (1.4.4)
loofah (~> 2.19, >= 2.19.1)
- rails-observers (0.1.5)
- activemodel (>= 4.0)
- railties (5.2.8.1)
- actionpack (= 5.2.8.1)
- activesupport (= 5.2.8.1)
+ railties (6.1.7.2)
+ actionpack (= 6.1.7.2)
+ activesupport (= 6.1.7.2)
method_source
- rake (>= 0.8.7)
- thor (>= 0.19.0, < 2.0)
+ rake (>= 12.2)
+ thor (~> 1.0)
rainbow (3.0.0)
rake (13.0.6)
rb-fsevent (0.10.3)
@@ -352,11 +367,11 @@ GEM
redis (>= 3, < 5)
regexp_parser (2.5.0)
repost (0.3.2)
- responders (2.4.1)
- actionpack (>= 4.2.0, < 6.0)
- railties (>= 4.2.0, < 6.0)
+ responders (3.1.0)
+ actionpack (>= 5.2)
+ railties (>= 5.2)
rexml (3.2.5)
- rolify (5.2.0)
+ rolify (5.3.0)
rubocop (1.31.2)
json (~> 2.3)
parallel (~> 1.10)
@@ -377,10 +392,10 @@ GEM
ruby-rc4 (0.1.5)
ruby-vips (2.1.4)
ffi (~> 1.12)
- rubyXL (3.4.14)
+ rubyXL (3.4.25)
nokogiri (>= 1.10.8)
rubyzip (>= 1.3.0)
- rubyzip (2.3.0)
+ rubyzip (2.3.2)
rufus-scheduler (3.8.1)
fugit (~> 1.1, >= 1.1.6)
safe_yaml (1.0.5)
@@ -424,9 +439,9 @@ GEM
spring-watcher-listen (2.0.1)
listen (>= 2.7, < 4.0)
spring (>= 1.2, < 3.0)
- sprockets (4.1.1)
+ sprockets (4.2.0)
concurrent-ruby (~> 1.0)
- rack (> 1, < 3)
+ rack (>= 2.2.4, < 4)
sprockets-rails (3.4.2)
actionpack (>= 5.2)
activesupport (>= 5.2)
@@ -452,8 +467,8 @@ GEM
camertron-eprun
cldr-plurals-runtime-rb (~> 1.0)
tzinfo
- tzinfo (1.2.10)
- thread_safe (~> 0.1)
+ tzinfo (2.0.6)
+ concurrent-ruby (~> 1.0)
tzinfo-data (1.2020.4)
tzinfo (>= 1.0.0)
unicode-display_width (1.4.1)
@@ -470,8 +485,8 @@ GEM
coercible (~> 1.0)
descendants_tracker (~> 0.0, >= 0.0.3)
equalizer (~> 0.0, >= 0.0.9)
- warden (1.2.8)
- rack (>= 2.0.6)
+ warden (1.2.9)
+ rack (>= 2.0.9)
web-console (3.7.0)
actionview (>= 5.0)
activemodel (>= 5.0)
@@ -487,13 +502,13 @@ GEM
websocket-driver (0.7.5)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
+ zeitwerk (2.6.7)
PLATFORMS
ruby
DEPENDENCIES
aasm
- actionpack-page_caching (= 1.2.2)
active_record_query_trace
acts_as_list
api-pagination
@@ -507,7 +522,7 @@ DEPENDENCIES
chroma
coveralls_reborn (~> 0.18.0)
database_cleaner
- devise (>= 4.6.0)
+ devise (>= 4.9)
dotenv-rails
elasticsearch-model (~> 5)
elasticsearch-persistence (~> 5)
@@ -539,16 +554,15 @@ DEPENDENCIES
pg_search
prawn
prawn-table
- puma (= 4.3.12)
+ puma (= 6.1.0)
pundit
railroady
- rails (~> 5.2.8)
- rails-observers
+ rails (~> 6.1)
rb-readline
recurrence
redis-session-store
repost
- responders (~> 2.0)
+ responders (~> 3.0)
rolify
rubocop (~> 1.31)
rubocop-rails
diff --git a/Procfile b/Procfile
index 64f020c5e..c32576a57 100644
--- a/Procfile
+++ b/Procfile
@@ -1,3 +1,3 @@
-web: bundle exec rails server puma -p $PORT
+web: bundle exec rails server -u puma -p $PORT
worker: bundle exec sidekiq -C ./config/sidekiq.yml
webpack: bin/webpacker-dev-server
diff --git a/app/controllers/api/abuses_controller.rb b/app/controllers/api/abuses_controller.rb
index 9c93a2d35..9a2f983ac 100644
--- a/app/controllers/api/abuses_controller.rb
+++ b/app/controllers/api/abuses_controller.rb
@@ -2,7 +2,7 @@
# API Controller for resources of type Abuse.
# Typical action is an user reporting an abuse on a project
-class API::AbusesController < API::ApiController
+class API::AbusesController < API::APIController
before_action :authenticate_user!, except: :create
before_action :set_abuse, only: %i[destroy]
diff --git a/app/controllers/api/accounting_exports_controller.rb b/app/controllers/api/accounting_exports_controller.rb
index 20dd342dd..41ddbd046 100644
--- a/app/controllers/api/accounting_exports_controller.rb
+++ b/app/controllers/api/accounting_exports_controller.rb
@@ -1,8 +1,7 @@
# frozen_string_literal: true
# API Controller for exporting accounting data to external accounting softwares
-class API::AccountingExportsController < API::ApiController
-
+class API::AccountingExportsController < API::APIController
before_action :authenticate_user!
def export
@@ -27,7 +26,7 @@ class API::AccountingExportsController < API::ApiController
render json: @export.errors, status: :unprocessable_entity
end
else
- send_file File.join(Rails.root, export.file),
+ send_file Rails.root.join(export.file),
type: 'text/csv',
disposition: 'attachment'
end
diff --git a/app/controllers/api/accounting_periods_controller.rb b/app/controllers/api/accounting_periods_controller.rb
index b9561dc94..8b31a50d7 100644
--- a/app/controllers/api/accounting_periods_controller.rb
+++ b/app/controllers/api/accounting_periods_controller.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
# API Controller for resources of AccountingPeriod
-class API::AccountingPeriodsController < API::ApiController
+class API::AccountingPeriodsController < API::APIController
before_action :authenticate_user!
before_action :set_period, only: %i[show download_archive]
diff --git a/app/controllers/api/admins_controller.rb b/app/controllers/api/admins_controller.rb
index 31a5a285f..d5d82d679 100644
--- a/app/controllers/api/admins_controller.rb
+++ b/app/controllers/api/admins_controller.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
# API Controller for resources of type User with role 'admin'.
-class API::AdminsController < API::ApiController
+class API::AdminsController < API::APIController
before_action :authenticate_user!
def index
diff --git a/app/controllers/api/age_ranges_controller.rb b/app/controllers/api/age_ranges_controller.rb
index 169f4775b..8e938bc5a 100644
--- a/app/controllers/api/age_ranges_controller.rb
+++ b/app/controllers/api/age_ranges_controller.rb
@@ -2,7 +2,7 @@
# API Controller for resources of type AgeRange
# AgeRange are used in Events
-class API::AgeRangesController < API::ApiController
+class API::AgeRangesController < API::APIController
before_action :authenticate_user!, except: [:index]
before_action :set_age_range, only: %i[show update destroy]
diff --git a/app/controllers/api/analytics_controller.rb b/app/controllers/api/analytics_controller.rb
index 12128202f..e4a2171df 100644
--- a/app/controllers/api/analytics_controller.rb
+++ b/app/controllers/api/analytics_controller.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
# API Controller for fabAnalytics
-class API::AnalyticsController < API::ApiController
+class API::AnalyticsController < API::APIController
before_action :authenticate_user!
def data
diff --git a/app/controllers/api/api_controller.rb b/app/controllers/api/api_controller.rb
index 2315de63a..47bb5ed66 100644
--- a/app/controllers/api/api_controller.rb
+++ b/app/controllers/api/api_controller.rb
@@ -1,6 +1,4 @@
# frozen_string_literal: true
-class API::ApiController < ApplicationController
-
-
+class API::APIController < ApplicationController
end
diff --git a/app/controllers/api/auth_providers_controller.rb b/app/controllers/api/auth_providers_controller.rb
index 71ea9d81b..97a5c0ceb 100644
--- a/app/controllers/api/auth_providers_controller.rb
+++ b/app/controllers/api/auth_providers_controller.rb
@@ -2,7 +2,7 @@
# API Controller for resources of type AuthProvider
# AuthProvider are used to connect users through single-sign on systems
-class API::AuthProvidersController < API::ApiController
+class API::AuthProvidersController < API::APIController
before_action :set_provider, only: %i[show update destroy]
def index
@providers = policy_scope(AuthProvider)
diff --git a/app/controllers/api/availabilities_controller.rb b/app/controllers/api/availabilities_controller.rb
index 053142214..a1f3601a5 100644
--- a/app/controllers/api/availabilities_controller.rb
+++ b/app/controllers/api/availabilities_controller.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
# API Controller for resources of type Availability
-class API::AvailabilitiesController < API::ApiController
+class API::AvailabilitiesController < API::APIController
before_action :authenticate_user!, except: [:public]
before_action :set_availability, only: %i[show update reservations lock]
before_action :set_operator_role, only: %i[machine spaces trainings]
diff --git a/app/controllers/api/cart_controller.rb b/app/controllers/api/cart_controller.rb
index 1e461f8e9..22878c815 100644
--- a/app/controllers/api/cart_controller.rb
+++ b/app/controllers/api/cart_controller.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
# API Controller to manage user's cart
-class API::CartController < API::ApiController
+class API::CartController < API::APIController
include API::OrderConcern
before_action :current_order, except: %i[create]
@@ -17,7 +17,7 @@ class API::CartController < API::ApiController
authorize @current_order, policy_class: CartPolicy
service = Cart::CreateCartItemService.new(@current_order)
@item = service.create(params)
- if @item.save({ context: @current_order.order_items })
+ if @item.save(**{ context: @current_order.order_items })
render 'api/orders/item', status: :created
else
render json: @item.errors.full_messages, status: :unprocessable_entity
diff --git a/app/controllers/api/categories_controller.rb b/app/controllers/api/categories_controller.rb
index fcc87117a..6ff53f176 100644
--- a/app/controllers/api/categories_controller.rb
+++ b/app/controllers/api/categories_controller.rb
@@ -2,7 +2,7 @@
# API Controller for resources of type Category
# Categories are used to classify Events
-class API::CategoriesController < API::ApiController
+class API::CategoriesController < API::APIController
before_action :authenticate_user!, except: [:index]
before_action :set_category, only: %i[show update destroy]
@@ -22,7 +22,6 @@ class API::CategoriesController < API::ApiController
end
end
-
def update
authorize Category
if @category.update(category_params)
diff --git a/app/controllers/api/checkout_controller.rb b/app/controllers/api/checkout_controller.rb
index 1cd0142d8..54f9c876a 100644
--- a/app/controllers/api/checkout_controller.rb
+++ b/app/controllers/api/checkout_controller.rb
@@ -4,7 +4,7 @@ require 'stripe/helper'
require 'pay_zen/helper'
# API Controller for cart checkout
-class API::CheckoutController < API::ApiController
+class API::CheckoutController < API::APIController
include ::API::OrderConcern
before_action :authenticate_user!
before_action :current_order
diff --git a/app/controllers/api/components_controller.rb b/app/controllers/api/components_controller.rb
index 39a8f2b07..07274ee92 100644
--- a/app/controllers/api/components_controller.rb
+++ b/app/controllers/api/components_controller.rb
@@ -2,7 +2,7 @@
# API Controller for resources of type Component
# Components are used in Projects
-class API::ComponentsController < API::ApiController
+class API::ComponentsController < API::APIController
before_action :authenticate_user!, except: %i[index show]
before_action :set_component, only: %i[show update destroy]
diff --git a/app/controllers/api/coupons_controller.rb b/app/controllers/api/coupons_controller.rb
index 616248c96..e7a0faa59 100644
--- a/app/controllers/api/coupons_controller.rb
+++ b/app/controllers/api/coupons_controller.rb
@@ -2,7 +2,7 @@
# API Controller for resources of type Coupon
# Coupons are used in payments
-class API::CouponsController < API::ApiController
+class API::CouponsController < API::APIController
include ApplicationHelper
before_action :authenticate_user!, except: %i[validate]
diff --git a/app/controllers/api/credits_controller.rb b/app/controllers/api/credits_controller.rb
index e435f4881..73f547fcf 100644
--- a/app/controllers/api/credits_controller.rb
+++ b/app/controllers/api/credits_controller.rb
@@ -2,7 +2,7 @@
# API Controller for resources of type Credit
# Credits are used to give free reservations to users
-class API::CreditsController < API::ApiController
+class API::CreditsController < API::APIController
before_action :authenticate_user!
before_action :set_credit, only: %i[show update destroy]
@@ -15,6 +15,8 @@ class API::CreditsController < API::ApiController
end
end
+ def show; end
+
def create
authorize Credit
@credit = Credit.new(credit_params)
diff --git a/app/controllers/api/custom_assets_controller.rb b/app/controllers/api/custom_assets_controller.rb
index 44fd7c87c..6024fa25f 100644
--- a/app/controllers/api/custom_assets_controller.rb
+++ b/app/controllers/api/custom_assets_controller.rb
@@ -2,9 +2,9 @@
# API Controller for resources of type CustomAsset
# CustomAssets are used in settings
-class API::CustomAssetsController < API::ApiController
- before_action :authenticate_user!, only: %i[index update create destroy]
- before_action :set_custom_asset, only: %i[show update destroy]
+class API::CustomAssetsController < API::APIController
+ before_action :authenticate_user!, only: %i[update create]
+ before_action :set_custom_asset, only: %i[show update]
# PUT /api/custom_assets/1/
def update
@@ -40,5 +40,4 @@ class API::CustomAssetsController < API::ApiController
def custom_asset_params
params.required(:custom_asset).permit(:name, custom_asset_file_attributes: [:attachment])
end
-
end
diff --git a/app/controllers/api/event_themes_controller.rb b/app/controllers/api/event_themes_controller.rb
index 91411508c..8db5d5299 100644
--- a/app/controllers/api/event_themes_controller.rb
+++ b/app/controllers/api/event_themes_controller.rb
@@ -2,7 +2,7 @@
# API Controller for resources of type EventTheme
# EventTheme are used to classify Events
-class API::EventThemesController < API::ApiController
+class API::EventThemesController < API::APIController
before_action :authenticate_user!, except: [:index]
before_action :set_event_theme, only: %i[show update destroy]
@@ -22,7 +22,6 @@ class API::EventThemesController < API::ApiController
end
end
-
def update
authorize EventTheme
if @event_theme.update(event_theme_params)
diff --git a/app/controllers/api/events_controller.rb b/app/controllers/api/events_controller.rb
index d73fc5546..ce4b42bd9 100644
--- a/app/controllers/api/events_controller.rb
+++ b/app/controllers/api/events_controller.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
# API Controller for resources of type Event
-class API::EventsController < API::ApiController
+class API::EventsController < API::APIController
before_action :set_event, only: %i[show update destroy]
def index
diff --git a/app/controllers/api/exports_controller.rb b/app/controllers/api/exports_controller.rb
index 55e0062a2..f75c8467f 100644
--- a/app/controllers/api/exports_controller.rb
+++ b/app/controllers/api/exports_controller.rb
@@ -2,7 +2,7 @@
# API Controller for resources of type Export
# Export are used to download data tables in offline files
-class API::ExportsController < API::ApiController
+class API::ExportsController < API::APIController
before_action :authenticate_user!
before_action :set_export, only: [:download]
diff --git a/app/controllers/api/files_controller.rb b/app/controllers/api/files_controller.rb
index 70c274146..4f9367b34 100644
--- a/app/controllers/api/files_controller.rb
+++ b/app/controllers/api/files_controller.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
# API Controller for handling special actions on files
-class API::FilesController < API::ApiController
+class API::FilesController < API::APIController
before_action :authenticate_user!
# test the mime type of the uploaded file
diff --git a/app/controllers/api/groups_controller.rb b/app/controllers/api/groups_controller.rb
index 7276f54e7..07af9e5fc 100644
--- a/app/controllers/api/groups_controller.rb
+++ b/app/controllers/api/groups_controller.rb
@@ -2,7 +2,7 @@
# API Controller for resources of type Group
# Groups are used for categorizing Users
-class API::GroupsController < API::ApiController
+class API::GroupsController < API::APIController
before_action :authenticate_user!, except: :index
def index
diff --git a/app/controllers/api/i_calendar_controller.rb b/app/controllers/api/i_calendar_controller.rb
index 76cd5beb1..f27389e75 100644
--- a/app/controllers/api/i_calendar_controller.rb
+++ b/app/controllers/api/i_calendar_controller.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
# API Controller for resources of type iCalendar
-class API::ICalendarController < API::ApiController
+class API::ICalendarController < API::APIController
before_action :authenticate_user!, except: %i[index events]
before_action :set_i_cal, only: [:destroy]
respond_to :json
diff --git a/app/controllers/api/imports_controller.rb b/app/controllers/api/imports_controller.rb
index 40f131194..84e81eec3 100644
--- a/app/controllers/api/imports_controller.rb
+++ b/app/controllers/api/imports_controller.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
# API Controller for resources of type Import
-class API::ImportsController < API::ApiController
+class API::ImportsController < API::APIController
before_action :authenticate_user!
def show
diff --git a/app/controllers/api/invoices_controller.rb b/app/controllers/api/invoices_controller.rb
index c03ac91e9..f1097dd96 100644
--- a/app/controllers/api/invoices_controller.rb
+++ b/app/controllers/api/invoices_controller.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
# API Controller for resources of Invoice and Avoir
-class API::InvoicesController < API::ApiController
+class API::InvoicesController < API::APIController
before_action :authenticate_user!
before_action :set_invoice, only: %i[show download]
diff --git a/app/controllers/api/licences_controller.rb b/app/controllers/api/licences_controller.rb
index f32de94a6..632ccd869 100644
--- a/app/controllers/api/licences_controller.rb
+++ b/app/controllers/api/licences_controller.rb
@@ -2,7 +2,7 @@
# API Controller for resources of type Licence
# Licenses are used in Projects
-class API::LicencesController < API::ApiController
+class API::LicencesController < API::APIController
before_action :authenticate_user!, except: %i[index show]
before_action :set_licence, only: %i[show update destroy]
diff --git a/app/controllers/api/machine_categories_controller.rb b/app/controllers/api/machine_categories_controller.rb
index ae9193a8e..178a85655 100644
--- a/app/controllers/api/machine_categories_controller.rb
+++ b/app/controllers/api/machine_categories_controller.rb
@@ -2,7 +2,7 @@
# API Controller for resources of type Machine Category
# Categories are used to classify Machine
-class API::MachineCategoriesController < API::ApiController
+class API::MachineCategoriesController < API::APIController
before_action :authenticate_user!, except: [:index]
before_action :set_machine_category, only: %i[show update destroy]
diff --git a/app/controllers/api/machines_controller.rb b/app/controllers/api/machines_controller.rb
index 4084bfab7..678a60713 100644
--- a/app/controllers/api/machines_controller.rb
+++ b/app/controllers/api/machines_controller.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
# API Controller for resources of type Machine
-class API::MachinesController < API::ApiController
+class API::MachinesController < API::APIController
before_action :authenticate_user!, except: %i[index show]
before_action :set_machine, only: %i[update destroy]
respond_to :json
diff --git a/app/controllers/api/members_controller.rb b/app/controllers/api/members_controller.rb
index 4837dca32..c98edcc6e 100644
--- a/app/controllers/api/members_controller.rb
+++ b/app/controllers/api/members_controller.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
# API Controller for resources of type User with role 'member'
-class API::MembersController < API::ApiController
+class API::MembersController < API::APIController
before_action :authenticate_user!, except: [:last_subscribed]
before_action :set_member, only: %i[update destroy merge complete_tour update_role validate]
before_action :set_operator, only: %i[show update create merge validate]
diff --git a/app/controllers/api/notification_preferences_controller.rb b/app/controllers/api/notification_preferences_controller.rb
index 0137726d5..e27967b75 100644
--- a/app/controllers/api/notification_preferences_controller.rb
+++ b/app/controllers/api/notification_preferences_controller.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
# API Controller for resources of type Notification Preferences
-class API::NotificationPreferencesController < API::ApiController
+class API::NotificationPreferencesController < API::APIController
before_action :authenticate_user!
def index
diff --git a/app/controllers/api/notification_types_controller.rb b/app/controllers/api/notification_types_controller.rb
index e4fbcc102..6d4b8b3fd 100644
--- a/app/controllers/api/notification_types_controller.rb
+++ b/app/controllers/api/notification_types_controller.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
# API Controller for resources of type Notification Types
-class API::NotificationTypesController < API::ApiController
+class API::NotificationTypesController < API::APIController
before_action :authenticate_user!
def index
diff --git a/app/controllers/api/notifications_controller.rb b/app/controllers/api/notifications_controller.rb
index 606cb4914..82fc87583 100644
--- a/app/controllers/api/notifications_controller.rb
+++ b/app/controllers/api/notifications_controller.rb
@@ -2,7 +2,7 @@
# API Controller for resources of type Notification
# Notifications are scoped by user
-class API::NotificationsController < API::ApiController
+class API::NotificationsController < API::APIController
before_action :authenticate_user!
before_action :set_notification, only: :update
diff --git a/app/controllers/api/open_api_clients_controller.rb b/app/controllers/api/open_api_clients_controller.rb
index 27edc269f..1de54b1e7 100644
--- a/app/controllers/api/open_api_clients_controller.rb
+++ b/app/controllers/api/open_api_clients_controller.rb
@@ -2,7 +2,7 @@
# API Controller for resources of type OpenAPI::Client
# OpenAPI::Clients are used to allow access to the public API
-class API::OpenAPIClientsController < API::ApiController
+class API::OpenAPIClientsController < API::APIController
before_action :authenticate_user!
def index
@@ -40,7 +40,7 @@ class API::OpenAPIClientsController < API::ApiController
@client = OpenAPI::Client.find(params[:id])
authorize @client
@client.destroy
- head 204
+ head :no_content
end
private
diff --git a/app/controllers/api/openlab_projects_controller.rb b/app/controllers/api/openlab_projects_controller.rb
index 1a19508e4..5522ce495 100644
--- a/app/controllers/api/openlab_projects_controller.rb
+++ b/app/controllers/api/openlab_projects_controller.rb
@@ -2,7 +2,7 @@
# API Controller for resources of type Openlab::Projects
# Openlab::Projects are Projects shared between different instances
-class API::OpenlabProjectsController < API::ApiController
+class API::OpenlabProjectsController < API::APIController
before_action :init_openlab
def index
diff --git a/app/controllers/api/orders_controller.rb b/app/controllers/api/orders_controller.rb
index ff453e8df..6e77e397c 100644
--- a/app/controllers/api/orders_controller.rb
+++ b/app/controllers/api/orders_controller.rb
@@ -2,7 +2,7 @@
# API Controller for resources of type Order
# Orders are used in store
-class API::OrdersController < API::ApiController
+class API::OrdersController < API::APIController
before_action :authenticate_user!, except: %i[withdrawal_instructions]
before_action :set_order, only: %i[show update destroy withdrawal_instructions]
diff --git a/app/controllers/api/payment_schedules_controller.rb b/app/controllers/api/payment_schedules_controller.rb
index 21968918c..ae5169f70 100644
--- a/app/controllers/api/payment_schedules_controller.rb
+++ b/app/controllers/api/payment_schedules_controller.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
# API Controller for resources of PaymentSchedule
-class API::PaymentSchedulesController < API::ApiController
+class API::PaymentSchedulesController < API::APIController
before_action :authenticate_user!
before_action :set_payment_schedule, only: %i[download cancel update]
before_action :set_payment_schedule_item, only: %i[show_item cash_check confirm_transfer refresh_item pay_item]
diff --git a/app/controllers/api/payments_controller.rb b/app/controllers/api/payments_controller.rb
index 7a878ee86..16e5c596a 100644
--- a/app/controllers/api/payments_controller.rb
+++ b/app/controllers/api/payments_controller.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
# Abstract API Controller to be extended by each payment gateway/mean, for handling the payments processes in the front-end
-class API::PaymentsController < API::ApiController
+class API::PaymentsController < API::APIController
before_action :authenticate_user!
# This method must be overridden by the the gateways controllers that inherits API::PaymentsControllers
diff --git a/app/controllers/api/plan_categories_controller.rb b/app/controllers/api/plan_categories_controller.rb
index 407bfd0e6..4c4dd6464 100644
--- a/app/controllers/api/plan_categories_controller.rb
+++ b/app/controllers/api/plan_categories_controller.rb
@@ -2,7 +2,7 @@
# API Controller for resources of type PlanCategory
# PlanCategory are used to sort plans
-class API::PlanCategoriesController < API::ApiController
+class API::PlanCategoriesController < API::APIController
before_action :authenticate_user!, except: :index
before_action :set_category, only: %i[show update destroy]
diff --git a/app/controllers/api/plans_controller.rb b/app/controllers/api/plans_controller.rb
index 52d786cd5..6c92a73bb 100644
--- a/app/controllers/api/plans_controller.rb
+++ b/app/controllers/api/plans_controller.rb
@@ -3,7 +3,7 @@
# API Controller for resources of type Plan and PartnerPlan.
# Plan are used to define subscription's characteristics.
# PartnerPlan is a special kind of plan which send notifications to an external user
-class API::PlansController < API::ApiController
+class API::PlansController < API::APIController
include ApplicationHelper
before_action :authenticate_user!, except: %i[index durations]
diff --git a/app/controllers/api/prepaid_packs_controller.rb b/app/controllers/api/prepaid_packs_controller.rb
index 8b02c6196..7ec8bb1a6 100644
--- a/app/controllers/api/prepaid_packs_controller.rb
+++ b/app/controllers/api/prepaid_packs_controller.rb
@@ -2,7 +2,7 @@
# API Controller for resources of type PrepaidPack
# PrepaidPacks are used to provide discounts to users that bought many hours at once
-class API::PrepaidPacksController < API::ApiController
+class API::PrepaidPacksController < API::APIController
include ApplicationHelper
before_action :authenticate_user!, except: :index
diff --git a/app/controllers/api/price_categories_controller.rb b/app/controllers/api/price_categories_controller.rb
index 9d91c4f53..96bb17102 100644
--- a/app/controllers/api/price_categories_controller.rb
+++ b/app/controllers/api/price_categories_controller.rb
@@ -2,7 +2,7 @@
# API Controller for resources of type PriceCategory
# PriceCategories are used in Events
-class API::PriceCategoriesController < API::ApiController
+class API::PriceCategoriesController < API::APIController
before_action :authenticate_user!, only: %i[update show create destroy]
before_action :set_price_category, only: %i[show update destroy]
diff --git a/app/controllers/api/prices_controller.rb b/app/controllers/api/prices_controller.rb
index 5c2d219e1..b77593ca9 100644
--- a/app/controllers/api/prices_controller.rb
+++ b/app/controllers/api/prices_controller.rb
@@ -2,7 +2,7 @@
# API Controller for resources of type Price
# Prices are used in reservations (Machine, Space)
-class API::PricesController < API::ApiController
+class API::PricesController < API::APIController
include ApplicationHelper
before_action :authenticate_user!
diff --git a/app/controllers/api/pricing_controller.rb b/app/controllers/api/pricing_controller.rb
index 78b13bf61..522b553f6 100644
--- a/app/controllers/api/pricing_controller.rb
+++ b/app/controllers/api/pricing_controller.rb
@@ -3,7 +3,7 @@
# @deprecated
# DEPRECATED: Please use API::PriceController instead.
# API Controller for managing Plans prices
-class API::PricingController < API::ApiController
+class API::PricingController < API::APIController
include ApplicationHelper
before_action :authenticate_user!, except: %i[index update]
diff --git a/app/controllers/api/product_categories_controller.rb b/app/controllers/api/product_categories_controller.rb
index dc9ce614b..e3b2ec8d7 100644
--- a/app/controllers/api/product_categories_controller.rb
+++ b/app/controllers/api/product_categories_controller.rb
@@ -2,7 +2,7 @@
# API Controller for resources of type ProductCategory
# ProductCategories are used to group Products
-class API::ProductCategoriesController < API::ApiController
+class API::ProductCategoriesController < API::APIController
before_action :authenticate_user!, except: :index
before_action :set_product_category, only: %i[update destroy position]
diff --git a/app/controllers/api/products_controller.rb b/app/controllers/api/products_controller.rb
index ae8411993..b4f438352 100644
--- a/app/controllers/api/products_controller.rb
+++ b/app/controllers/api/products_controller.rb
@@ -2,7 +2,7 @@
# API Controller for resources of type Product
# Products are used in store
-class API::ProductsController < API::ApiController
+class API::ProductsController < API::APIController
before_action :authenticate_user!, except: %i[index show]
before_action :set_product, only: %i[update clone destroy]
diff --git a/app/controllers/api/profile_custom_fields_controller.rb b/app/controllers/api/profile_custom_fields_controller.rb
index e0a902863..0e3326e40 100644
--- a/app/controllers/api/profile_custom_fields_controller.rb
+++ b/app/controllers/api/profile_custom_fields_controller.rb
@@ -2,7 +2,7 @@
# API Controller for resources of type ProfileCustomField
# ProfileCustomFields are fields configured by an admin, added to the user's profile
-class API::ProfileCustomFieldsController < API::ApiController
+class API::ProfileCustomFieldsController < API::APIController
before_action :authenticate_user!, except: :index
before_action :set_profile_custom_field, only: %i[show update destroy]
diff --git a/app/controllers/api/projects_controller.rb b/app/controllers/api/projects_controller.rb
index 15db7f801..dc1cf7699 100644
--- a/app/controllers/api/projects_controller.rb
+++ b/app/controllers/api/projects_controller.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
# API Controller for resources of type Project
-class API::ProjectsController < API::ApiController
+class API::ProjectsController < API::APIController
before_action :authenticate_user!, except: %i[index show last_published search]
before_action :set_project, only: %i[update destroy]
respond_to :json
diff --git a/app/controllers/api/reservations_controller.rb b/app/controllers/api/reservations_controller.rb
index 42cab8487..3bfe28d08 100644
--- a/app/controllers/api/reservations_controller.rb
+++ b/app/controllers/api/reservations_controller.rb
@@ -2,7 +2,7 @@
# API Controller for resources of type Reservation
# Reservations are used for Training, Machine, Space and Event
-class API::ReservationsController < API::ApiController
+class API::ReservationsController < API::APIController
before_action :authenticate_user!
before_action :set_reservation, only: %i[show update]
respond_to :json
diff --git a/app/controllers/api/settings_controller.rb b/app/controllers/api/settings_controller.rb
index 238b6960f..b358edc51 100644
--- a/app/controllers/api/settings_controller.rb
+++ b/app/controllers/api/settings_controller.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
# API Controller for resources of type Setting
-class API::SettingsController < API::ApiController
+class API::SettingsController < API::APIController
before_action :authenticate_user!, only: %i[update bulk_update reset]
def index
@@ -47,7 +47,7 @@ class API::SettingsController < API::ApiController
end
@settings.push db_setting
- may_rollback(params[:transactional]) if db_setting.errors.keys.count.positive?
+ may_rollback(params[:transactional]) if db_setting.errors.attribute_names.count.positive?
end
end
SettingService.run_after_update(updated_settings)
diff --git a/app/controllers/api/slots_reservations_controller.rb b/app/controllers/api/slots_reservations_controller.rb
index 9ee95cbca..2fcda5e83 100644
--- a/app/controllers/api/slots_reservations_controller.rb
+++ b/app/controllers/api/slots_reservations_controller.rb
@@ -3,7 +3,7 @@
# API Controller for resources of type Slot
# Slots are used to cut Availabilities into reservable slots. The duration of these slots is configured per
# availability by Availability.slot_duration, or otherwise globally by Setting.get('slot_duration')
-class API::SlotsReservationsController < API::ApiController
+class API::SlotsReservationsController < API::APIController
before_action :authenticate_user!
before_action :set_slots_reservation, only: %i[update cancel]
respond_to :json
diff --git a/app/controllers/api/spaces_controller.rb b/app/controllers/api/spaces_controller.rb
index f155e1d81..5690b399d 100644
--- a/app/controllers/api/spaces_controller.rb
+++ b/app/controllers/api/spaces_controller.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
# API Controller for resources of type Space
-class API::SpacesController < API::ApiController
+class API::SpacesController < API::APIController
before_action :authenticate_user!, except: %i[index show]
before_action :set_space, only: %i[update destroy]
respond_to :json
diff --git a/app/controllers/api/statistics_controller.rb b/app/controllers/api/statistics_controller.rb
index ac2d2bd4a..1f8c96d56 100644
--- a/app/controllers/api/statistics_controller.rb
+++ b/app/controllers/api/statistics_controller.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
# API Controller for various statistical resources (gateway to elasticsearch DB)
-class API::StatisticsController < API::ApiController
+class API::StatisticsController < API::APIController
before_action :authenticate_user!
def index
diff --git a/app/controllers/api/stylesheets_controller.rb b/app/controllers/api/stylesheets_controller.rb
index acc8b0b03..22b4e1f9c 100644
--- a/app/controllers/api/stylesheets_controller.rb
+++ b/app/controllers/api/stylesheets_controller.rb
@@ -2,9 +2,7 @@
# API Controller for resources of type Stylesheet
# Stylesheets are used to customize the appearance of Fab-manager
-class API::StylesheetsController < API::ApiController
- caches_page :show # magic happens here
-
+class API::StylesheetsController < API::APIController
def show
@stylesheet = Stylesheet.find(params[:id])
end
diff --git a/app/controllers/api/subscriptions_controller.rb b/app/controllers/api/subscriptions_controller.rb
index 05cf0de53..07e4a0310 100644
--- a/app/controllers/api/subscriptions_controller.rb
+++ b/app/controllers/api/subscriptions_controller.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
# API Controller for resources of type Subscription
-class API::SubscriptionsController < API::ApiController
+class API::SubscriptionsController < API::APIController
before_action :set_subscription, only: %i[show payment_details cancel]
before_action :authenticate_user!
diff --git a/app/controllers/api/supporting_document_files_controller.rb b/app/controllers/api/supporting_document_files_controller.rb
index c40d7ac69..34868aacb 100644
--- a/app/controllers/api/supporting_document_files_controller.rb
+++ b/app/controllers/api/supporting_document_files_controller.rb
@@ -2,7 +2,7 @@
# API Controller for resources of type SupportingDocumentFile
# SupportingDocumentFiles are used in settings
-class API::SupportingDocumentFilesController < API::ApiController
+class API::SupportingDocumentFilesController < API::APIController
before_action :authenticate_user!
before_action :set_supporting_document_file, only: %i[show update download]
diff --git a/app/controllers/api/supporting_document_refusals_controller.rb b/app/controllers/api/supporting_document_refusals_controller.rb
index a8aea3b7f..1da9cabe4 100644
--- a/app/controllers/api/supporting_document_refusals_controller.rb
+++ b/app/controllers/api/supporting_document_refusals_controller.rb
@@ -2,7 +2,7 @@
# API Controller for resources of type SupportingDocumentRefusal
# SupportingDocumentRefusal are used by admin refuse user's proof of identity file
-class API::SupportingDocumentRefusalsController < API::ApiController
+class API::SupportingDocumentRefusalsController < API::APIController
before_action :authenticate_user!
def index
diff --git a/app/controllers/api/supporting_document_types_controller.rb b/app/controllers/api/supporting_document_types_controller.rb
index c299f8a78..68a57569a 100644
--- a/app/controllers/api/supporting_document_types_controller.rb
+++ b/app/controllers/api/supporting_document_types_controller.rb
@@ -2,7 +2,7 @@
# API Controller for resources of type SupportingDocumentType
# ProofOfIdentityTypes are used to provide admin config proof of identity type by group
-class API::SupportingDocumentTypesController < API::ApiController
+class API::SupportingDocumentTypesController < API::APIController
before_action :authenticate_user!, except: :index
before_action :set_supporting_document_type, only: %i[show update destroy]
diff --git a/app/controllers/api/tags_controller.rb b/app/controllers/api/tags_controller.rb
index 24f1a4549..6beaa010a 100644
--- a/app/controllers/api/tags_controller.rb
+++ b/app/controllers/api/tags_controller.rb
@@ -2,8 +2,7 @@
# API Controller for resources of type Tag
# Tags are used to restrict access to Availabilities
-class API::TagsController < API::ApiController
-
+class API::TagsController < API::APIController
before_action :authenticate_user!, except: %i[index show]
before_action :set_tag, only: %i[show update destroy]
diff --git a/app/controllers/api/themes_controller.rb b/app/controllers/api/themes_controller.rb
index 1c1fa479f..66894b036 100644
--- a/app/controllers/api/themes_controller.rb
+++ b/app/controllers/api/themes_controller.rb
@@ -2,7 +2,7 @@
# API Controller for resources of type Theme
# Themes are used in Projects
-class API::ThemesController < API::ApiController
+class API::ThemesController < API::APIController
before_action :authenticate_user!, except: %i[index show]
before_action :set_theme, only: %i[show update destroy]
diff --git a/app/controllers/api/trainings_controller.rb b/app/controllers/api/trainings_controller.rb
index 37d518c03..286ef7bf8 100644
--- a/app/controllers/api/trainings_controller.rb
+++ b/app/controllers/api/trainings_controller.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
# API Controller for resources of type Training
-class API::TrainingsController < API::ApiController
+class API::TrainingsController < API::APIController
include ApplicationHelper
before_action :authenticate_user!, except: %i[index show]
diff --git a/app/controllers/api/trainings_pricings_controller.rb b/app/controllers/api/trainings_pricings_controller.rb
index 47f0e39f2..f0865a646 100644
--- a/app/controllers/api/trainings_pricings_controller.rb
+++ b/app/controllers/api/trainings_pricings_controller.rb
@@ -3,7 +3,7 @@
# @deprecated
# DEPRECATED: Please use API::PriceController instead.
# API Controller for managing Training prices
-class API::TrainingsPricingsController < API::ApiController
+class API::TrainingsPricingsController < API::APIController
include ApplicationHelper
before_action :authenticate_user!
diff --git a/app/controllers/api/translations_controller.rb b/app/controllers/api/translations_controller.rb
index cca3f47e4..dd74c167d 100644
--- a/app/controllers/api/translations_controller.rb
+++ b/app/controllers/api/translations_controller.rb
@@ -1,12 +1,12 @@
# frozen_string_literal: true
# API Controller for managing front-end translations
-class API::TranslationsController < API::ApiController
+class API::TranslationsController < API::APIController
before_action :set_locale
def show
translations = I18n.t params[:state]
- if translations.class.name == String.name && translations.start_with?('translation missing')
+ if translations.instance_of?(String) && translations.start_with?('translation missing')
render json: { error: translations }, status: :unprocessable_entity
else
path = params[:state]
@@ -20,5 +20,4 @@ class API::TranslationsController < API::ApiController
def set_locale
I18n.locale = params[:locale] || I18n.default_locale
end
-
end
diff --git a/app/controllers/api/user_packs_controller.rb b/app/controllers/api/user_packs_controller.rb
index 4c00014ef..0764347ad 100644
--- a/app/controllers/api/user_packs_controller.rb
+++ b/app/controllers/api/user_packs_controller.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
# API Controller for resources of type StatisticProfilePrepaidPack
-class API::UserPacksController < API::ApiController
+class API::UserPacksController < API::APIController
before_action :authenticate_user!
def index
diff --git a/app/controllers/api/users_controller.rb b/app/controllers/api/users_controller.rb
index 0b1a61e67..6bd035f60 100644
--- a/app/controllers/api/users_controller.rb
+++ b/app/controllers/api/users_controller.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
# API Controller for resources of type Users with role :partner or :manager
-class API::UsersController < API::ApiController
+class API::UsersController < API::APIController
before_action :authenticate_user!
before_action :set_user, only: %i[destroy]
diff --git a/app/controllers/api/version_controller.rb b/app/controllers/api/version_controller.rb
index 9c44c7c9c..ae2a71e64 100644
--- a/app/controllers/api/version_controller.rb
+++ b/app/controllers/api/version_controller.rb
@@ -3,7 +3,7 @@
require 'version'
# API Controller to get the Fab-manager version
-class API::VersionController < API::ApiController
+class API::VersionController < API::APIController
before_action :authenticate_user!
def show
diff --git a/app/controllers/api/wallet_controller.rb b/app/controllers/api/wallet_controller.rb
index 19eedffea..a4f486db5 100644
--- a/app/controllers/api/wallet_controller.rb
+++ b/app/controllers/api/wallet_controller.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
# API Controller for resources of type Wallet
-class API::WalletController < API::ApiController
+class API::WalletController < API::APIController
before_action :authenticate_user!
def by_user
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 5ee5c20fc..997d59490 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -7,7 +7,6 @@ class ApplicationController < ActionController::Base
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
after_action :set_csrf_cookie
- cache_sweeper :stylesheet_sweeper
respond_to :html, :json
@@ -42,7 +41,7 @@ class ApplicationController < ActionController::Base
{
profile_attributes: %i[phone last_name first_name interest software_mastered],
invoicing_profile_attributes: [
- organization_attributes: [:name, address_attributes: [:address]],
+ organization_attributes: [:name, { address_attributes: [:address] }],
user_profile_custom_fields_attributes: %i[profile_custom_field_id value],
address_attributes: [:address]
],
@@ -60,7 +59,7 @@ class ApplicationController < ActionController::Base
end
def permission_denied
- head 403
+ head :forbidden
end
# Set the configured locale for each action (API call)
diff --git a/app/controllers/open_api/v1/accounting_controller.rb b/app/controllers/open_api/v1/accounting_controller.rb
index 7690108ac..c92a654ce 100644
--- a/app/controllers/open_api/v1/accounting_controller.rb
+++ b/app/controllers/open_api/v1/accounting_controller.rb
@@ -4,9 +4,9 @@ require_relative 'concerns/accountings_filters_concern'
# authorized 3rd party softwares can fetch the accounting lines through the OpenAPI
class OpenAPI::V1::AccountingController < OpenAPI::V1::BaseController
- extend OpenAPI::ApiDoc
+ extend OpenAPI::APIDoc
include Rails::Pagination
- include AccountingsFiltersConcern
+ include OpenAPI::V1::Concerns::AccountingsFiltersConcern
expose_doc
def index
diff --git a/app/controllers/open_api/v1/bookable_machines_controller.rb b/app/controllers/open_api/v1/bookable_machines_controller.rb
index b8ed876eb..0ada7ac1a 100644
--- a/app/controllers/open_api/v1/bookable_machines_controller.rb
+++ b/app/controllers/open_api/v1/bookable_machines_controller.rb
@@ -2,7 +2,7 @@
# authorized 3rd party softwares can list the bookable machines through the OpenAPI
class OpenAPI::V1::BookableMachinesController < OpenAPI::V1::BaseController
- extend OpenAPI::ApiDoc
+ extend OpenAPI::APIDoc
expose_doc
def index
diff --git a/app/controllers/open_api/v1/concerns/accountings_filters_concern.rb b/app/controllers/open_api/v1/concerns/accountings_filters_concern.rb
index 2c5d4930b..3cafbc25c 100644
--- a/app/controllers/open_api/v1/concerns/accountings_filters_concern.rb
+++ b/app/controllers/open_api/v1/concerns/accountings_filters_concern.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
# Filter the list of accounting lines by the given parameters
-module AccountingsFiltersConcern
+module OpenAPI::V1::Concerns::AccountingsFiltersConcern
extend ActiveSupport::Concern
included do
diff --git a/app/controllers/open_api/v1/concerns/reservations_filters_concern.rb b/app/controllers/open_api/v1/concerns/reservations_filters_concern.rb
index f011aec0b..d6bd9e23e 100644
--- a/app/controllers/open_api/v1/concerns/reservations_filters_concern.rb
+++ b/app/controllers/open_api/v1/concerns/reservations_filters_concern.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
# Filter the list of reservations by the given parameters
-module ReservationsFiltersConcern
+module OpenAPI::V1::Concerns::ReservationsFiltersConcern
extend ActiveSupport::Concern
included do
diff --git a/app/controllers/open_api/v1/concerns/subscriptions_filters_concern.rb b/app/controllers/open_api/v1/concerns/subscriptions_filters_concern.rb
index 56972f351..ba55144b8 100644
--- a/app/controllers/open_api/v1/concerns/subscriptions_filters_concern.rb
+++ b/app/controllers/open_api/v1/concerns/subscriptions_filters_concern.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
# Filter the list of subscriptions by the given parameters
-module SubscriptionsFiltersConcern
+module OpenAPI::V1::Concerns::SubscriptionsFiltersConcern
extend ActiveSupport::Concern
included do
diff --git a/app/controllers/open_api/v1/events_controller.rb b/app/controllers/open_api/v1/events_controller.rb
index 3f4c61a12..85e32b697 100644
--- a/app/controllers/open_api/v1/events_controller.rb
+++ b/app/controllers/open_api/v1/events_controller.rb
@@ -2,7 +2,7 @@
# authorized 3rd party softwares can manage the events through the OpenAPI
class OpenAPI::V1::EventsController < OpenAPI::V1::BaseController
- extend OpenAPI::ApiDoc
+ extend OpenAPI::APIDoc
include Rails::Pagination
expose_doc
diff --git a/app/controllers/open_api/v1/invoices_controller.rb b/app/controllers/open_api/v1/invoices_controller.rb
index e2adec7de..c7d77c2c2 100644
--- a/app/controllers/open_api/v1/invoices_controller.rb
+++ b/app/controllers/open_api/v1/invoices_controller.rb
@@ -2,7 +2,7 @@
# OpenAPI controller for the invoices
class OpenAPI::V1::InvoicesController < OpenAPI::V1::BaseController
- extend OpenAPI::ApiDoc
+ extend OpenAPI::APIDoc
include Rails::Pagination
expose_doc
diff --git a/app/controllers/open_api/v1/machines_controller.rb b/app/controllers/open_api/v1/machines_controller.rb
index 9d11a01cb..b64dd5645 100644
--- a/app/controllers/open_api/v1/machines_controller.rb
+++ b/app/controllers/open_api/v1/machines_controller.rb
@@ -2,7 +2,7 @@
# authorized 3rd party softwares can manage the machines through the OpenAPI
class OpenAPI::V1::MachinesController < OpenAPI::V1::BaseController
- extend OpenAPI::ApiDoc
+ extend OpenAPI::APIDoc
expose_doc
before_action :set_machine, only: %i[show update destroy]
diff --git a/app/controllers/open_api/v1/plan_categories_controller.rb b/app/controllers/open_api/v1/plan_categories_controller.rb
index 1bd6ef554..186151c9c 100644
--- a/app/controllers/open_api/v1/plan_categories_controller.rb
+++ b/app/controllers/open_api/v1/plan_categories_controller.rb
@@ -2,7 +2,7 @@
# authorized 3rd party softwares can fetch data about plan categories through the OpenAPI
class OpenAPI::V1::PlanCategoriesController < OpenAPI::V1::BaseController
- extend OpenAPI::ApiDoc
+ extend OpenAPI::APIDoc
expose_doc
def index
diff --git a/app/controllers/open_api/v1/plans_controller.rb b/app/controllers/open_api/v1/plans_controller.rb
index fb915e0fa..afd4547c2 100644
--- a/app/controllers/open_api/v1/plans_controller.rb
+++ b/app/controllers/open_api/v1/plans_controller.rb
@@ -2,7 +2,7 @@
# authorized 3rd party softwares can fetch data about plans through the OpenAPI
class OpenAPI::V1::PlansController < OpenAPI::V1::BaseController
- extend OpenAPI::ApiDoc
+ extend OpenAPI::APIDoc
expose_doc
before_action :set_plan, only: %i[show]
diff --git a/app/controllers/open_api/v1/prices_controller.rb b/app/controllers/open_api/v1/prices_controller.rb
index b5652bb81..faa9ec944 100644
--- a/app/controllers/open_api/v1/prices_controller.rb
+++ b/app/controllers/open_api/v1/prices_controller.rb
@@ -2,7 +2,7 @@
# public API controller for resources of type Price
class OpenAPI::V1::PricesController < OpenAPI::V1::BaseController
- extend OpenAPI::ApiDoc
+ extend OpenAPI::APIDoc
include Rails::Pagination
expose_doc
diff --git a/app/controllers/open_api/v1/reservations_controller.rb b/app/controllers/open_api/v1/reservations_controller.rb
index 14c8690c7..0bd0c3417 100644
--- a/app/controllers/open_api/v1/reservations_controller.rb
+++ b/app/controllers/open_api/v1/reservations_controller.rb
@@ -4,9 +4,9 @@ require_relative 'concerns/reservations_filters_concern'
# public API controller for resources of type Reservation
class OpenAPI::V1::ReservationsController < OpenAPI::V1::BaseController
- extend OpenAPI::ApiDoc
+ extend OpenAPI::APIDoc
include Rails::Pagination
- include ReservationsFiltersConcern
+ include OpenAPI::V1::Concerns::ReservationsFiltersConcern
expose_doc
def index
diff --git a/app/controllers/open_api/v1/spaces_controller.rb b/app/controllers/open_api/v1/spaces_controller.rb
index 18dcf9dd8..86ac756ae 100644
--- a/app/controllers/open_api/v1/spaces_controller.rb
+++ b/app/controllers/open_api/v1/spaces_controller.rb
@@ -2,7 +2,7 @@
# authorized 3rd party softwares can fetch data about spaces through the OpenAPI
class OpenAPI::V1::SpacesController < OpenAPI::V1::BaseController
- extend OpenAPI::ApiDoc
+ extend OpenAPI::APIDoc
expose_doc
before_action :set_space, only: %i[show]
diff --git a/app/controllers/open_api/v1/subscriptions_controller.rb b/app/controllers/open_api/v1/subscriptions_controller.rb
index bc32d0259..72edfca8c 100644
--- a/app/controllers/open_api/v1/subscriptions_controller.rb
+++ b/app/controllers/open_api/v1/subscriptions_controller.rb
@@ -4,9 +4,9 @@ require_relative 'concerns/subscriptions_filters_concern'
# authorized 3rd party softwares can fetch the subscriptions through the OpenAPI
class OpenAPI::V1::SubscriptionsController < OpenAPI::V1::BaseController
- extend OpenAPI::ApiDoc
+ extend OpenAPI::APIDoc
include Rails::Pagination
- include SubscriptionsFiltersConcern
+ include OpenAPI::V1::Concerns::SubscriptionsFiltersConcern
expose_doc
def index
diff --git a/app/controllers/open_api/v1/trainings_controller.rb b/app/controllers/open_api/v1/trainings_controller.rb
index 277c99626..0b16a8449 100644
--- a/app/controllers/open_api/v1/trainings_controller.rb
+++ b/app/controllers/open_api/v1/trainings_controller.rb
@@ -2,7 +2,7 @@
# public API controller for resources of type Training
class OpenAPI::V1::TrainingsController < OpenAPI::V1::BaseController
- extend OpenAPI::ApiDoc
+ extend OpenAPI::APIDoc
expose_doc
def index
diff --git a/app/controllers/open_api/v1/user_trainings_controller.rb b/app/controllers/open_api/v1/user_trainings_controller.rb
index 902eea7d0..4b7287407 100644
--- a/app/controllers/open_api/v1/user_trainings_controller.rb
+++ b/app/controllers/open_api/v1/user_trainings_controller.rb
@@ -2,7 +2,7 @@
# public API controller for user's trainings
class OpenAPI::V1::UserTrainingsController < OpenAPI::V1::BaseController
- extend OpenAPI::ApiDoc
+ extend OpenAPI::APIDoc
include Rails::Pagination
expose_doc
diff --git a/app/controllers/open_api/v1/users_controller.rb b/app/controllers/open_api/v1/users_controller.rb
index c52109dfc..91713096d 100644
--- a/app/controllers/open_api/v1/users_controller.rb
+++ b/app/controllers/open_api/v1/users_controller.rb
@@ -2,7 +2,7 @@
# public API controller for users
class OpenAPI::V1::UsersController < OpenAPI::V1::BaseController
- extend OpenAPI::ApiDoc
+ extend OpenAPI::APIDoc
include Rails::Pagination
expose_doc
diff --git a/app/doc/open_api/api_doc.rb b/app/doc/open_api/api_doc.rb
index cb7dabe97..f08b3d1d0 100644
--- a/app/doc/open_api/api_doc.rb
+++ b/app/doc/open_api/api_doc.rb
@@ -4,11 +4,11 @@
#
# Controller extension with common API documentation shortcuts
#
-module OpenAPI::ApiDoc
+module OpenAPI::APIDoc
# Apipie doesn't allow to append anything to esisting
# description. It raises an error on double definition.
#
- def append_desc(desc = "")
+ def append_desc(desc = '')
_apipie_dsl_data[:description] << desc << "\n"
end
@@ -20,7 +20,7 @@ module OpenAPI::ApiDoc
#
def to_markdown_code(code)
code.split("\n").map do |line|
- (" " * 4) + line
+ (' ' * 4) + line
end.join("\n")
end
@@ -33,9 +33,8 @@ module OpenAPI::ApiDoc
# @param schemas [Array]
#
def include_response_schema(*schemas)
- root = Rails.root.join('app/doc/responses')
_apipie_dsl_data[:description] = _apipie_dsl_data[:description].strip_heredoc
- append_desc("## Response schema")
+ append_desc('## Response schema')
schemas.each do |relative_path|
append_desc MarkdownJsonSchema.read(relative_path)
diff --git a/app/doc/open_api/application_doc.rb b/app/doc/open_api/application_doc.rb
index ff21bd2a5..17958ce04 100644
--- a/app/doc/open_api/application_doc.rb
+++ b/app/doc/open_api/application_doc.rb
@@ -19,7 +19,7 @@
# end
#
class OpenAPI::ApplicationDoc
- extend OpenAPI::ApiDoc
+ extend OpenAPI::APIDoc
class << self
# Stores provided resource description
@@ -53,7 +53,7 @@ class OpenAPI::ApplicationDoc
# @return [Hash]
#
def docs
- @_docs ||= {}
+ @docs ||= {}
end
def define_param_group(param_group_name, &block)
@@ -61,7 +61,7 @@ class OpenAPI::ApplicationDoc
end
def param_groups
- @_param_groups ||= {}
+ @param_groups ||= {}
end
# Applies all defined DSL to provided controller class
diff --git a/app/models/advanced_accounting.rb b/app/models/advanced_accounting.rb
index f68537b16..f475925f9 100644
--- a/app/models/advanced_accounting.rb
+++ b/app/models/advanced_accounting.rb
@@ -3,12 +3,12 @@
# AdvancedAccounting enables the various objects to have detailed accounting settings
class AdvancedAccounting < ApplicationRecord
belongs_to :accountable, polymorphic: true
- belongs_to :machine, foreign_type: 'Machine', foreign_key: 'accountable_id', inverse_of: :advanced_accounting
- belongs_to :training, foreign_type: 'Training', foreign_key: 'accountable_id', inverse_of: :advanced_accounting
- belongs_to :space, foreign_type: 'Space', foreign_key: 'accountable_id', inverse_of: :advanced_accounting
- belongs_to :event, foreign_type: 'Event', foreign_key: 'accountable_id', inverse_of: :advanced_accounting
- belongs_to :product, foreign_type: 'Product', foreign_key: 'accountable_id', inverse_of: :advanced_accounting
- belongs_to :plan, foreign_type: 'Plan', foreign_key: 'accountable_id', inverse_of: :advanced_accounting
+ belongs_to :machine, foreign_key: 'accountable_id', inverse_of: :advanced_accounting
+ belongs_to :training, foreign_key: 'accountable_id', inverse_of: :advanced_accounting
+ belongs_to :space, foreign_key: 'accountable_id', inverse_of: :advanced_accounting
+ belongs_to :event, foreign_key: 'accountable_id', inverse_of: :advanced_accounting
+ belongs_to :product, foreign_key: 'accountable_id', inverse_of: :advanced_accounting
+ belongs_to :plan, foreign_key: 'accountable_id', inverse_of: :advanced_accounting
after_save :rebuild_accounting_lines
diff --git a/app/models/application_record.rb b/app/models/application_record.rb
index 55c1abca5..077fb4ea2 100644
--- a/app/models/application_record.rb
+++ b/app/models/application_record.rb
@@ -15,7 +15,7 @@ class ApplicationRecord < ActiveRecord::Base
def update_with_context(attributes, context)
with_transaction_returning_status do
assign_attributes(attributes)
- save(context: context)
+ save(**{ context: context })
end
end
end
diff --git a/app/models/availability.rb b/app/models/availability.rb
index e81f9c41e..80a2a01c3 100644
--- a/app/models/availability.rb
+++ b/app/models/availability.rb
@@ -190,7 +190,7 @@ class Availability < ApplicationRecord
duration = slot_duration || Setting.get('slot_duration').to_i
return unless end_at < (start_at + duration.minutes)
- errors.add(:end_at, I18n.t('availabilities.length_must_be_slot_multiple', MIN: duration))
+ errors.add(:end_at, I18n.t('availabilities.length_must_be_slot_multiple', **{ MIN: duration }))
end
def should_be_associated
diff --git a/app/models/cart_item/base_item.rb b/app/models/cart_item/base_item.rb
index 4fc5952fa..6e62d55e9 100644
--- a/app/models/cart_item/base_item.rb
+++ b/app/models/cart_item/base_item.rb
@@ -1,7 +1,5 @@
# frozen_string_literal: true
-require_relative 'cart_item'
-
# This is an abstract class implemented by classes that can be added to the shopping cart
class CartItem::BaseItem < ApplicationRecord
self.abstract_class = true
diff --git a/app/models/cart_item/cart_item.rb b/app/models/cart_item/cart_item.rb
deleted file mode 100644
index acfc5eb6a..000000000
--- a/app/models/cart_item/cart_item.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-# frozen_string_literal: true
-
-# Items that can be added to the shopping cart
-module CartItem; end
diff --git a/app/models/cart_item/coupon.rb b/app/models/cart_item/coupon.rb
index 858160b58..228959852 100644
--- a/app/models/cart_item/coupon.rb
+++ b/app/models/cart_item/coupon.rb
@@ -1,7 +1,5 @@
# frozen_string_literal: true
-require_relative 'cart_item'
-
# A discount coupon applied to the whole shopping cart
class CartItem::Coupon < ApplicationRecord
self.table_name = 'cart_item_coupons'
diff --git a/app/models/cart_item/event_reservation.rb b/app/models/cart_item/event_reservation.rb
index c2dd29824..9ae7be11a 100644
--- a/app/models/cart_item/event_reservation.rb
+++ b/app/models/cart_item/event_reservation.rb
@@ -10,7 +10,7 @@ class CartItem::EventReservation < CartItem::Reservation
accepts_nested_attributes_for :cart_item_event_reservation_tickets
has_many :cart_item_reservation_slots, class_name: 'CartItem::ReservationSlot', dependent: :destroy, inverse_of: :cart_item,
- foreign_key: 'cart_item_id', foreign_type: 'cart_item_type'
+ foreign_type: 'cart_item_type', as: :cart_item
accepts_nested_attributes_for :cart_item_reservation_slots
belongs_to :operator_profile, class_name: 'InvoicingProfile'
@@ -22,6 +22,14 @@ class CartItem::EventReservation < CartItem::Reservation
event
end
+ def reservable_id
+ event_id
+ end
+
+ def reservable_type
+ 'Event'
+ end
+
def price
amount = reservable.amount * normal_tickets
is_privileged = operator.privileged? && operator.id != customer.id
diff --git a/app/models/cart_item/event_reservation_ticket.rb b/app/models/cart_item/event_reservation_ticket.rb
index 94a921bad..c86a7189b 100644
--- a/app/models/cart_item/event_reservation_ticket.rb
+++ b/app/models/cart_item/event_reservation_ticket.rb
@@ -1,7 +1,5 @@
# frozen_string_literal: true
-require_relative 'cart_item'
-
# A relation table between a pending event reservation and a special price for this event
class CartItem::EventReservationTicket < ApplicationRecord
self.table_name = 'cart_item_event_reservation_tickets'
diff --git a/app/models/cart_item/free_extension.rb b/app/models/cart_item/free_extension.rb
index ab2905b4b..8f4145a4f 100644
--- a/app/models/cart_item/free_extension.rb
+++ b/app/models/cart_item/free_extension.rb
@@ -25,7 +25,7 @@ class CartItem::FreeExtension < CartItem::BaseItem
end
def name
- I18n.t('cart_items.free_extension', DATE: I18n.l(new_expiration_date))
+ I18n.t('cart_items.free_extension', **{ DATE: I18n.l(new_expiration_date) })
end
def to_object
diff --git a/app/models/cart_item/machine_reservation.rb b/app/models/cart_item/machine_reservation.rb
index 9fccf8911..6550dcee9 100644
--- a/app/models/cart_item/machine_reservation.rb
+++ b/app/models/cart_item/machine_reservation.rb
@@ -3,7 +3,7 @@
# A machine reservation added to the shopping cart
class CartItem::MachineReservation < CartItem::Reservation
has_many :cart_item_reservation_slots, class_name: 'CartItem::ReservationSlot', dependent: :destroy, inverse_of: :cart_item,
- foreign_key: 'cart_item_id', foreign_type: 'cart_item_type'
+ foreign_type: 'cart_item_type', as: :cart_item
accepts_nested_attributes_for :cart_item_reservation_slots
belongs_to :operator_profile, class_name: 'InvoicingProfile'
diff --git a/app/models/cart_item/payment_schedule.rb b/app/models/cart_item/payment_schedule.rb
index bc989408f..fbcead696 100644
--- a/app/models/cart_item/payment_schedule.rb
+++ b/app/models/cart_item/payment_schedule.rb
@@ -1,7 +1,5 @@
# frozen_string_literal: true
-require_relative 'cart_item'
-
# A payment schedule applied to plan in the shopping cart
class CartItem::PaymentSchedule < ApplicationRecord
self.table_name = 'cart_item_payment_schedules'
diff --git a/app/models/cart_item/prepaid_pack.rb b/app/models/cart_item/prepaid_pack.rb
index aa57a666a..57bcebe03 100644
--- a/app/models/cart_item/prepaid_pack.rb
+++ b/app/models/cart_item/prepaid_pack.rb
@@ -41,7 +41,7 @@ class CartItem::PrepaidPack < CartItem::BaseItem
return false
end
if pack.group_id != customer.group_id
- errors.add(:group, I18n.t('cart_item_validation.pack_group', { GROUP: pack.group.name }))
+ errors.add(:group, I18n.t('cart_item_validation.pack_group', **{ GROUP: pack.group.name }))
return false
end
true
diff --git a/app/models/cart_item/reservation.rb b/app/models/cart_item/reservation.rb
index f7f38455e..c70f67918 100644
--- a/app/models/cart_item/reservation.rb
+++ b/app/models/cart_item/reservation.rb
@@ -64,7 +64,7 @@ class CartItem::Reservation < CartItem::BaseItem
plan = pending_subscription&.plan || customer&.subscribed_plan
unless ReservationLimitService.authorized?(plan, customer, self, all_items)
- errors.add(:reservation, I18n.t('cart_item_validation.limit_reached', {
+ errors.add(:reservation, I18n.t('cart_item_validation.limit_reached', **{
HOURS: ReservationLimitService.limit(plan, reservable).limit,
RESERVABLE: reservable.name
}))
@@ -273,7 +273,7 @@ class CartItem::Reservation < CartItem::BaseItem
end
if slot.start_at < reservation_deadline_minutes.minutes.since && !operator.privileged?
- errors.add(:slot, I18n.t('cart_item_validation.deadline', { MINUTES: reservation_deadline_minutes }))
+ errors.add(:slot, I18n.t('cart_item_validation.deadline', **{ MINUTES: reservation_deadline_minutes }))
return false
end
diff --git a/app/models/cart_item/reservation_slot.rb b/app/models/cart_item/reservation_slot.rb
index b1aa6a91d..147775334 100644
--- a/app/models/cart_item/reservation_slot.rb
+++ b/app/models/cart_item/reservation_slot.rb
@@ -1,20 +1,18 @@
# frozen_string_literal: true
-require_relative 'cart_item'
-
# A relation table between a pending reservation and a slot
class CartItem::ReservationSlot < ApplicationRecord
self.table_name = 'cart_item_reservation_slots'
belongs_to :cart_item, polymorphic: true
- belongs_to :cart_item_machine_reservation, foreign_type: 'CartItem::MachineReservation', foreign_key: 'cart_item_id',
- inverse_of: :cart_item_reservation_slots, class_name: 'CartItem::MachineReservation'
- belongs_to :cart_item_space_reservation, foreign_type: 'CartItem::SpaceReservation', foreign_key: 'cart_item_id',
- inverse_of: :cart_item_reservation_slots, class_name: 'CartItem::SpaceReservation'
- belongs_to :cart_item_training_reservation, foreign_type: 'CartItem::TrainingReservation', foreign_key: 'cart_item_id',
- inverse_of: :cart_item_reservation_slots, class_name: 'CartItem::TrainingReservation'
- belongs_to :cart_item_event_reservation, foreign_type: 'CartItem::EventReservation', foreign_key: 'cart_item_id',
- inverse_of: :cart_item_reservation_slots, class_name: 'CartItem::EventReservation'
+ belongs_to :cart_item_machine_reservation, foreign_key: 'cart_item_id', class_name: 'CartItem::MachineReservation',
+ inverse_of: :cart_item_reservation_slots
+ belongs_to :cart_item_space_reservation, foreign_key: 'cart_item_id', class_name: 'CartItem::SpaceReservation',
+ inverse_of: :cart_item_reservation_slots
+ belongs_to :cart_item_training_reservation, foreign_key: 'cart_item_id', class_name: 'CartItem::TrainingReservation',
+ inverse_of: :cart_item_reservation_slots
+ belongs_to :cart_item_event_reservation, foreign_key: 'cart_item_id', class_name: 'CartItem::EventReservation',
+ inverse_of: :cart_item_reservation_slots
belongs_to :slot
belongs_to :slots_reservation
diff --git a/app/models/cart_item/space_reservation.rb b/app/models/cart_item/space_reservation.rb
index aa513c3b8..138a4c17c 100644
--- a/app/models/cart_item/space_reservation.rb
+++ b/app/models/cart_item/space_reservation.rb
@@ -3,7 +3,7 @@
# A space reservation added to the shopping cart
class CartItem::SpaceReservation < CartItem::Reservation
has_many :cart_item_reservation_slots, class_name: 'CartItem::ReservationSlot', dependent: :destroy, inverse_of: :cart_item,
- foreign_key: 'cart_item_id', foreign_type: 'cart_item_type'
+ foreign_type: 'cart_item_type', as: :cart_item
accepts_nested_attributes_for :cart_item_reservation_slots
belongs_to :operator_profile, class_name: 'InvoicingProfile'
diff --git a/app/models/cart_item/subscription.rb b/app/models/cart_item/subscription.rb
index 50b297e9e..845b8e024 100644
--- a/app/models/cart_item/subscription.rb
+++ b/app/models/cart_item/subscription.rb
@@ -38,7 +38,7 @@ class CartItem::Subscription < CartItem::BaseItem
return false
end
if plan.group_id != customer.group_id
- errors.add(:group, I18n.t('cart_item_validation.plan_group', { GROUP: plan.group.name }))
+ errors.add(:group, I18n.t('cart_item_validation.plan_group', **{ GROUP: plan.group.name }))
return false
end
true
diff --git a/app/models/cart_item/training_reservation.rb b/app/models/cart_item/training_reservation.rb
index aff64b3a6..4dd19a2ef 100644
--- a/app/models/cart_item/training_reservation.rb
+++ b/app/models/cart_item/training_reservation.rb
@@ -3,7 +3,7 @@
# A training reservation added to the shopping cart
class CartItem::TrainingReservation < CartItem::Reservation
has_many :cart_item_reservation_slots, class_name: 'CartItem::ReservationSlot', dependent: :destroy, inverse_of: :cart_item,
- foreign_key: 'cart_item_id', foreign_type: 'cart_item_type'
+ foreign_type: 'cart_item_type', as: :cart_item
accepts_nested_attributes_for :cart_item_reservation_slots
belongs_to :operator_profile, class_name: 'InvoicingProfile'
diff --git a/app/models/concerns/i_calendar_concern.rb b/app/models/concerns/i_calendar_concern.rb
index aa0253853..1c10a2235 100644
--- a/app/models/concerns/i_calendar_concern.rb
+++ b/app/models/concerns/i_calendar_concern.rb
@@ -56,14 +56,14 @@ module ICalendarConcern
def description(group_slots)
case reservable_type
when 'Machine', 'Space'
- I18n.t('reservation_ics.description_slot', COUNT: group_slots.count, ITEM: reservable.name)
+ I18n.t('reservation_ics.description_slot', **{ COUNT: group_slots.count, ITEM: reservable.name })
when 'Training'
- I18n.t('reservation_ics.description_training', TYPE: reservable.name)
+ I18n.t('reservation_ics.description_training', **{ TYPE: reservable.name })
when 'Event'
- I18n.t('reservation_ics.description_event', NUMBER: nb_reserve_places + (tickets.map(&:booked).reduce(:+) || 0))
+ I18n.t('reservation_ics.description_event', **{ NUMBER: nb_reserve_places + (tickets.map(&:booked).reduce(:+) || 0) })
else
Rails.logger.warn "Unexpected reservable type #{reservable_type}"
- I18n.t('reservation_ics.description_slot', COUNT: group_slots.count, ITEM: reservable_type)
+ I18n.t('reservation_ics.description_slot', **{ COUNT: group_slots.count, ITEM: reservable_type })
end
end
end
diff --git a/app/models/invoice.rb b/app/models/invoice.rb
index 75e7ad3f8..0bcd63829 100644
--- a/app/models/invoice.rb
+++ b/app/models/invoice.rb
@@ -59,7 +59,7 @@ class Invoice < PaymentDocument
# for debug & used by rake task "fablab:maintenance:regenerate_invoices"
def regenerate_invoice_pdf
- pdf = ::PDF::Invoice.new(self).render
+ pdf = ::Pdf::Invoice.new(self).render
File.binwrite(file, pdf)
end
diff --git a/app/models/machine.rb b/app/models/machine.rb
index a3f81cfa1..029ebfdfe 100644
--- a/app/models/machine.rb
+++ b/app/models/machine.rb
@@ -38,11 +38,11 @@ class Machine < ApplicationRecord
accepts_nested_attributes_for :advanced_accounting, allow_destroy: true
has_many :cart_item_machine_reservations, class_name: 'CartItem::MachineReservation', dependent: :destroy, inverse_of: :reservable,
- foreign_type: 'reservable_type', foreign_key: 'reservable_id'
+ foreign_type: 'reservable_type', as: :reservable
belongs_to :machine_category
- has_many :plan_limitations, dependent: :destroy, inverse_of: :machine, foreign_type: 'limitable_type', foreign_key: 'limitable_id'
+ has_many :plan_limitations, dependent: :destroy, inverse_of: :machine, foreign_type: 'limitable_type', as: :limitable
after_create :create_statistic_subtype
after_create :create_machine_prices
diff --git a/app/models/machine_category.rb b/app/models/machine_category.rb
index 47c670640..9913844aa 100644
--- a/app/models/machine_category.rb
+++ b/app/models/machine_category.rb
@@ -4,5 +4,5 @@
class MachineCategory < ApplicationRecord
has_many :machines, dependent: :nullify
accepts_nested_attributes_for :machines, allow_destroy: true
- has_many :plan_limitations, dependent: :destroy, inverse_of: :machine_category, foreign_type: 'limitable_type', foreign_key: 'limitable_id'
+ has_many :plan_limitations, dependent: :destroy, inverse_of: :machine_category, foreign_type: 'limitable_type', as: :limitable
end
diff --git a/app/models/order_item.rb b/app/models/order_item.rb
index 6948bcbec..6609dccf1 100644
--- a/app/models/order_item.rb
+++ b/app/models/order_item.rb
@@ -4,7 +4,7 @@
class OrderItem < ApplicationRecord
belongs_to :order
belongs_to :orderable, polymorphic: true
- belongs_to :product, foreign_type: 'Product', foreign_key: 'orderable_id', inverse_of: :order_items
+ belongs_to :product, foreign_key: 'orderable_id', inverse_of: :order_items
validates :orderable, :order_id, :amount, presence: true
end
diff --git a/app/models/payment_gateway_object.rb b/app/models/payment_gateway_object.rb
index 24862f031..cc9b812b1 100644
--- a/app/models/payment_gateway_object.rb
+++ b/app/models/payment_gateway_object.rb
@@ -5,17 +5,17 @@ require 'payment/item_builder'
# A link between an object in the local database and another object in the remote payment gateway database
class PaymentGatewayObject < ApplicationRecord
belongs_to :item, polymorphic: true
- belongs_to :invoice, foreign_type: 'Invoice', foreign_key: 'item_id', inverse_of: :payment_gateway_object
- belongs_to :invoice_item, foreign_type: 'InvoiceItem', foreign_key: 'item_id', inverse_of: :payment_gateway_object
- belongs_to :subscription, foreign_type: 'Subscription', foreign_key: 'item_id', inverse_of: :payment_gateway_object
- belongs_to :payment_schedule, foreign_type: 'PaymentSchedule', foreign_key: 'item_id', inverse_of: :payment_gateway_object
- belongs_to :payment_schedule_item, foreign_type: 'PaymentScheduleItem', foreign_key: 'item_id', inverse_of: :payment_gateway_object
- belongs_to :user, foreign_type: 'User', foreign_key: 'item_id', inverse_of: :payment_gateway_object
- belongs_to :plan, foreign_type: 'Plan', foreign_key: 'item_id', inverse_of: :payment_gateway_object
- belongs_to :machine, foreign_type: 'Machine', foreign_key: 'item_id', inverse_of: :payment_gateway_object
- belongs_to :space, foreign_type: 'Space', foreign_key: 'item_id', inverse_of: :payment_gateway_object
- belongs_to :training, foreign_type: 'Training', foreign_key: 'item_id', inverse_of: :payment_gateway_object
- belongs_to :order, foreign_type: 'Order', foreign_key: 'item_id', inverse_of: :payment_gateway_object
+ belongs_to :invoice, foreign_key: 'item_id', inverse_of: :payment_gateway_object
+ belongs_to :invoice_item, foreign_key: 'item_id', inverse_of: :payment_gateway_object
+ belongs_to :subscription, foreign_key: 'item_id', inverse_of: :payment_gateway_object
+ belongs_to :payment_schedule, foreign_key: 'item_id', inverse_of: :payment_gateway_object
+ belongs_to :payment_schedule_item, foreign_key: 'item_id', inverse_of: :payment_gateway_object
+ belongs_to :user, foreign_key: 'item_id', inverse_of: :payment_gateway_object
+ belongs_to :plan, foreign_key: 'item_id', inverse_of: :payment_gateway_object
+ belongs_to :machine, foreign_key: 'item_id', inverse_of: :payment_gateway_object
+ belongs_to :space, foreign_key: 'item_id', inverse_of: :payment_gateway_object
+ belongs_to :training, foreign_key: 'item_id', inverse_of: :payment_gateway_object
+ belongs_to :order, foreign_key: 'item_id', inverse_of: :payment_gateway_object
belongs_to :payment_gateway_object # some objects may require a reference to another object for remote recovery
diff --git a/app/models/payment_schedule.rb b/app/models/payment_schedule.rb
index b6096fa80..b5c2d1044 100644
--- a/app/models/payment_schedule.rb
+++ b/app/models/payment_schedule.rb
@@ -69,7 +69,7 @@ class PaymentSchedule < PaymentDocument
# for debug & used by rake task "fablab:maintenance:regenerate_schedules"
def regenerate_pdf
- pdf = ::PDF::PaymentSchedule.new(self).render
+ pdf = ::Pdf::PaymentSchedule.new(self).render
File.binwrite(file, pdf)
end
diff --git a/app/models/payment_schedule_object.rb b/app/models/payment_schedule_object.rb
index 9036897b1..76e4d6fa0 100644
--- a/app/models/payment_schedule_object.rb
+++ b/app/models/payment_schedule_object.rb
@@ -3,10 +3,9 @@
# Links an object bought and a payment schedule used to pay this object
class PaymentScheduleObject < Footprintable
belongs_to :object, polymorphic: true
- belongs_to :reservation, foreign_type: 'Reservation', foreign_key: 'object_id', inverse_of: :payment_schedule_object
- belongs_to :subscription, foreign_type: 'Subscription', foreign_key: 'object_id', inverse_of: :payment_schedule_object
- belongs_to :statistic_profile_prepaid_pack, foreign_type: 'StatisticProfilePrepaidPack', foreign_key: 'object_id',
- inverse_of: :payment_schedule_object
+ belongs_to :reservation, foreign_key: 'object_id', inverse_of: :payment_schedule_object
+ belongs_to :subscription, foreign_key: 'object_id', inverse_of: :payment_schedule_object
+ belongs_to :statistic_profile_prepaid_pack, foreign_key: 'object_id', inverse_of: :payment_schedule_object
belongs_to :payment_schedule
after_create :chain_record
diff --git a/app/models/plan.rb b/app/models/plan.rb
index 0a508f8e2..a2aa4df3f 100644
--- a/app/models/plan.rb
+++ b/app/models/plan.rb
@@ -90,7 +90,7 @@ class Plan < ApplicationRecord
def human_readable_duration
i18n_key = "duration.#{interval}"
- I18n.t(i18n_key, count: interval_count).to_s
+ I18n.t(i18n_key, **{ count: interval_count }).to_s
end
def human_readable_name(opts = {})
diff --git a/app/models/plan_limitation.rb b/app/models/plan_limitation.rb
index 9bdabecbf..ae30ee215 100644
--- a/app/models/plan_limitation.rb
+++ b/app/models/plan_limitation.rb
@@ -5,8 +5,8 @@ class PlanLimitation < ApplicationRecord
belongs_to :plan
belongs_to :limitable, polymorphic: true
- belongs_to :machine, foreign_type: 'Machine', foreign_key: 'limitable_id', inverse_of: :plan_limitations
- belongs_to :machine_category, foreign_type: 'MachineCategory', foreign_key: 'limitable_id', inverse_of: :plan_limitations
+ belongs_to :machine, foreign_key: 'limitable_id', inverse_of: :plan_limitations
+ belongs_to :machine_category, foreign_key: 'limitable_id', inverse_of: :plan_limitations
validates :limitable_id, :limitable_type, :limit, :plan_id, presence: true
validates :limitable_id, uniqueness: { scope: %i[limitable_type plan_id] }
diff --git a/app/models/prepaid_pack.rb b/app/models/prepaid_pack.rb
index 16d752b36..88bf2d4e0 100644
--- a/app/models/prepaid_pack.rb
+++ b/app/models/prepaid_pack.rb
@@ -8,8 +8,8 @@
# The number of hours in a pack is stored in minutes.
class PrepaidPack < ApplicationRecord
belongs_to :priceable, polymorphic: true
- belongs_to :machine, foreign_type: 'Machine', foreign_key: 'priceable_id', inverse_of: :prepaid_packs
- belongs_to :space, foreign_type: 'Space', foreign_key: 'priceable_id', inverse_of: :prepaid_packs
+ belongs_to :machine, foreign_key: 'priceable_id', inverse_of: :prepaid_packs
+ belongs_to :space, foreign_key: 'priceable_id', inverse_of: :prepaid_packs
belongs_to :group
diff --git a/app/models/space.rb b/app/models/space.rb
index 399b99d30..765eef8a0 100644
--- a/app/models/space.rb
+++ b/app/models/space.rb
@@ -32,7 +32,7 @@ class Space < ApplicationRecord
accepts_nested_attributes_for :advanced_accounting, allow_destroy: true
has_many :cart_item_space_reservations, class_name: 'CartItem::SpaceReservation', dependent: :destroy, inverse_of: :reservable,
- foreign_type: 'reservable_type', foreign_key: 'reservable_id'
+ foreign_type: 'reservable_type', as: :reservable
after_create :create_statistic_subtype
after_create :create_space_prices
diff --git a/app/models/training.rb b/app/models/training.rb
index af34840c3..315e633db 100644
--- a/app/models/training.rb
+++ b/app/models/training.rb
@@ -33,7 +33,7 @@ class Training < ApplicationRecord
accepts_nested_attributes_for :advanced_accounting, allow_destroy: true
has_many :cart_item_training_reservations, class_name: 'CartItem::TrainingReservation', dependent: :destroy, inverse_of: :reservable,
- foreign_type: 'reservable_type', foreign_key: 'reservable_id'
+ foreign_type: 'reservable_type', as: :reservable
after_create :create_statistic_subtype
after_create :create_trainings_pricings
diff --git a/app/models/user.rb b/app/models/user.rb
index 5f114ae6b..8568a444a 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -176,15 +176,6 @@ class User < ApplicationRecord
add_role(:member) if roles.blank?
end
- def cached_has_role?(role)
- roles = Rails.cache.fetch(
- roles_for: { object_id: object_id },
- expires_in: 1.day,
- race_condition_ttl: 2.seconds
- ) { roles.map(&:name) }
- roles.include?(role.to_s)
- end
-
def cgu_must_accept
errors.add(:cgu, I18n.t('activerecord.errors.messages.empty')) if cgu == '0'
end
diff --git a/app/pdfs/pdf/invoice.rb b/app/pdfs/pdf/invoice.rb
index 493346fdd..110d1520f 100644
--- a/app/pdfs/pdf/invoice.rb
+++ b/app/pdfs/pdf/invoice.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
# Generate a downloadable PDF file for the recorded invoice
-class PDF::Invoice < Prawn::Document
+class Pdf::Invoice < Prawn::Document
require 'stringio'
include ActionView::Helpers::NumberHelper
include ApplicationHelper
@@ -38,19 +38,19 @@ class PDF::Invoice < Prawn::Document
font('Open-Sans', size: 10) do
# general information
if invoice.is_a?(Avoir)
- text I18n.t('invoices.refund_invoice_reference', REF: invoice.reference), leading: 3
+ text I18n.t('invoices.refund_invoice_reference', **{ REF: invoice.reference }), leading: 3
else
- text I18n.t('invoices.invoice_reference', REF: invoice.reference), leading: 3
+ text I18n.t('invoices.invoice_reference', **{ REF: invoice.reference }), leading: 3
end
- text I18n.t('invoices.code', CODE: Setting.get('invoice_code-value')), leading: 3 if Setting.get('invoice_code-active')
+ text I18n.t('invoices.code', **{ CODE: Setting.get('invoice_code-value') }), leading: 3 if Setting.get('invoice_code-active')
if invoice.main_item&.object_type != WalletTransaction.name
order_number = invoice.main_item&.object_type == OrderItem.name ? invoice.main_item&.object&.order&.reference : invoice.order_number
- text I18n.t('invoices.order_number', NUMBER: order_number), leading: 3
+ text I18n.t('invoices.order_number', **{ NUMBER: order_number }), leading: 3
end
if invoice.is_a?(Avoir)
- text I18n.t('invoices.refund_invoice_issued_on_DATE', DATE: I18n.l(invoice.avoir_date.to_date))
+ text I18n.t('invoices.refund_invoice_issued_on_DATE', **{ DATE: I18n.l(invoice.avoir_date.to_date) })
else
- text I18n.t('invoices.invoice_issued_on_DATE', DATE: I18n.l(invoice.created_at.to_date))
+ text I18n.t('invoices.invoice_issued_on_DATE', **{ DATE: I18n.l(invoice.created_at.to_date) })
end
# user/organization's information
@@ -120,9 +120,9 @@ class PDF::Invoice < Prawn::Document
data += [[I18n.t('invoices.total_including_all_taxes'), number_to_currency(total)]]
vat_rate_group.each do |_type, rate|
data += [[I18n.t('invoices.including_VAT_RATE',
- RATE: rate[:vat_rate],
- AMOUNT: number_to_currency(rate[:amount] / 100.00),
- NAME: Setting.get('invoice_VAT-name')),
+ **{ RATE: rate[:vat_rate],
+ AMOUNT: number_to_currency(rate[:amount] / 100.00),
+ NAME: Setting.get('invoice_VAT-name') }),
number_to_currency(rate[:total_vat] / 100.00)]]
end
data += [[I18n.t('invoices.including_total_excluding_taxes'), number_to_currency(total_ht / 100.00)]]
diff --git a/app/pdfs/pdf/payment_schedule.rb b/app/pdfs/pdf/payment_schedule.rb
index 3157da62f..a959e3af8 100644
--- a/app/pdfs/pdf/payment_schedule.rb
+++ b/app/pdfs/pdf/payment_schedule.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true
# Generate a downloadable PDF file for the recorded payment schedule
-class PDF::PaymentSchedule < Prawn::Document
+class Pdf::PaymentSchedule < Prawn::Document
require 'stringio'
include ActionView::Helpers::NumberHelper
include ApplicationHelper
@@ -37,8 +37,8 @@ class PDF::PaymentSchedule < Prawn::Document
move_down 20
font('Open-Sans', size: 10) do
# general information
- text I18n.t('payment_schedules.schedule_reference', REF: payment_schedule.reference), leading: 3
- text I18n.t('payment_schedules.schedule_issued_on_DATE', DATE: I18n.l(payment_schedule.created_at.to_date))
+ text I18n.t('payment_schedules.schedule_reference', **{ REF: payment_schedule.reference }), leading: 3
+ text I18n.t('payment_schedules.schedule_issued_on_DATE', **{ DATE: I18n.l(payment_schedule.created_at.to_date) })
# user/organization's information
if payment_schedule.invoicing_profile&.organization
@@ -67,7 +67,7 @@ class PDF::PaymentSchedule < Prawn::Document
# object
move_down 25
- text I18n.t('payment_schedules.object', ITEM: subscription_verbose(subscription, name))
+ text I18n.t('payment_schedules.object', **{ ITEM: subscription_verbose(subscription, name) })
# details table of the deadlines
move_down 20
@@ -77,7 +77,6 @@ class PDF::PaymentSchedule < Prawn::Document
# going through the payment_schedule_items
payment_schedule.payment_schedule_items.each do |item|
-
price = item.amount.to_i / 100.00
date = I18n.l(item.due_date.to_date)
@@ -101,7 +100,7 @@ class PDF::PaymentSchedule < Prawn::Document
payment_verbose = _t('payment_schedules.settlement_by_METHOD', METHOD: payment_schedule.payment_method)
if payment_schedule.wallet_amount
payment_verbose += I18n.t('payment_schedules.settlement_by_wallet',
- AMOUNT: number_to_currency(payment_schedule.wallet_amount / 100.00))
+ **{ AMOUNT: number_to_currency(payment_schedule.wallet_amount / 100.00) })
end
text payment_verbose
@@ -112,7 +111,6 @@ class PDF::PaymentSchedule < Prawn::Document
text line, style: :bold, inline_format: true
end
-
# address and legals information
move_down 40
txt = parse_html(Setting.get('invoice_legals'))
@@ -126,7 +124,7 @@ class PDF::PaymentSchedule < Prawn::Document
transparent(0.1) do
rotate(45, origin: [0, 0]) do
- image "#{Rails.root}/app/pdfs/data/watermark-#{I18n.default_locale}.png", at: [90, 150]
+ image Rails.root.join("app/pdfs/data/watermark-#{I18n.default_locale}.png"), at: [90, 150]
end
end
end
@@ -137,9 +135,9 @@ class PDF::PaymentSchedule < Prawn::Document
subscription_start_at = subscription.expired_at - subscription.plan.duration
duration_verbose = I18n.t("duration.#{subscription.plan.interval}", count: subscription.plan.interval_count)
I18n.t('payment_schedules.subscription_of_NAME_for_DURATION_starting_from_DATE',
- NAME: username,
- DURATION: duration_verbose,
- DATE: I18n.l(subscription_start_at.to_date))
+ **{ NAME: username,
+ DURATION: duration_verbose,
+ DATE: I18n.l(subscription_start_at.to_date) })
end
##
diff --git a/app/services/accounting/vat_export_service.rb b/app/services/accounting/vat_export_service.rb
index 932f99733..43abfa281 100644
--- a/app/services/accounting/vat_export_service.rb
+++ b/app/services/accounting/vat_export_service.rb
@@ -43,7 +43,7 @@ class Accounting::VatExportService
def header_row
row = ''
columns.each do |column|
- row << I18n.t("vat_export.#{column}", NAME: @vat_name) << separator
+ row << I18n.t("vat_export.#{column}", **{ NAME: @vat_name }) << separator
end
"#{row}\n"
end
diff --git a/app/services/availabilities_export_service.rb b/app/services/availabilities_export_service.rb
index 699ce2cb0..90ea3477b 100644
--- a/app/services/availabilities_export_service.rb
+++ b/app/services/availabilities_export_service.rb
@@ -10,23 +10,17 @@ require './app/helpers/application_helper'
# Retrieve all availabilities and their related objects and write the result as a table in an excel file
class AvailabilitiesExportService
-
# export all availabilities
def export_index(export)
@availabilities = Availability.all.includes(:machines, :trainings, :spaces, :event, :slots)
- ActionController::Base.prepend_view_path './app/views/'
- # place data in view_assigns
- view_assigns = { availabilities: @availabilities }
- av = ActionView::Base.new(ActionController::Base.view_paths, view_assigns)
- av.class_eval do
- # include any needed helpers (for the view)
- include ApplicationHelper
- end
-
- content = av.render template: 'exports/availabilities_index.xlsx.axlsx'
+ content = ApplicationController.render(
+ template: 'exports/availabilities_index',
+ locals: { availabilities: @availabilities },
+ handlers: [:axlsx],
+ formats: [:xlsx]
+ )
# write content to file
- File.open(export.file, 'w+b') { |f| f.write content }
+ File.binwrite(export.file, content)
end
-
end
diff --git a/app/services/invoices/item_label_service.rb b/app/services/invoices/item_label_service.rb
index ce83dc4ed..daf5f7d1b 100644
--- a/app/services/invoices/item_label_service.rb
+++ b/app/services/invoices/item_label_service.rb
@@ -30,23 +30,23 @@ class Invoices::ItemLabelService
subscription = item.object
label = if invoice.main_item&.object_type == 'OfferDay'
I18n.t('invoices.subscription_extended_for_free_from_START_to_END',
- START: I18n.l(invoice.main_item&.object&.start_at&.to_date),
- END: I18n.l(invoice.main_item&.object&.end_at&.to_date))
+ **{ START: I18n.l(invoice.main_item&.object&.start_at&.to_date),
+ END: I18n.l(invoice.main_item&.object&.end_at&.to_date) })
else
subscription_end_at = subscription.expiration_date
subscription_start_at = subscription_end_at - subscription.plan.duration
I18n.t('invoices.subscription_NAME_from_START_to_END',
- NAME: item.description,
- START: I18n.l(subscription_start_at.to_date),
- END: I18n.l(subscription_end_at.to_date))
+ **{ NAME: item.description,
+ START: I18n.l(subscription_start_at.to_date),
+ END: I18n.l(subscription_end_at.to_date) })
end
unless invoice.payment_schedule_item.nil?
dues = invoice.payment_schedule_item.payment_schedule.payment_schedule_items.order(:due_date)
label += "\n #{I18n.t('invoices.from_payment_schedule',
- NUMBER: dues.index(invoice.payment_schedule_item) + 1,
- TOTAL: dues.count,
- DATE: I18n.l(invoice.payment_schedule_item.due_date.to_date),
- SCHEDULE: invoice.payment_schedule_item.payment_schedule.reference)}"
+ **{ NUMBER: dues.index(invoice.payment_schedule_item) + 1,
+ TOTAL: dues.count,
+ DATE: I18n.l(invoice.payment_schedule_item.due_date.to_date),
+ SCHEDULE: invoice.payment_schedule_item.payment_schedule.reference })}"
end
label
end
@@ -58,12 +58,12 @@ class Invoices::ItemLabelService
case invoice.main_item&.object.try(:reservable_type)
### Machine reservation
when 'Machine'
- I18n.t('invoices.machine_reservation_DESCRIPTION', DESCRIPTION: item.description)
+ I18n.t('invoices.machine_reservation_DESCRIPTION', **{ DESCRIPTION: item.description })
when 'Space'
- I18n.t('invoices.space_reservation_DESCRIPTION', DESCRIPTION: item.description)
+ I18n.t('invoices.space_reservation_DESCRIPTION', **{ DESCRIPTION: item.description })
### Training reservation
when 'Training'
- I18n.t('invoices.training_reservation_DESCRIPTION', DESCRIPTION: item.description)
+ I18n.t('invoices.training_reservation_DESCRIPTION', **{ DESCRIPTION: item.description })
### events reservation
when 'Event'
build_event_reservation_label(invoice, item)
@@ -76,15 +76,15 @@ class Invoices::ItemLabelService
# @param item [InvoiceItem]
# @return [String]
def build_event_reservation_label(invoice, item)
- label = I18n.t('invoices.event_reservation_DESCRIPTION', DESCRIPTION: item.description)
+ label = I18n.t('invoices.event_reservation_DESCRIPTION', **{ DESCRIPTION: item.description })
# details of the number of tickets
if invoice.main_item&.object&.nb_reserve_places&.positive?
- label += "\n #{I18n.t('invoices.full_price_ticket', count: invoice.main_item&.object&.nb_reserve_places)}"
+ label += "\n #{I18n.t('invoices.full_price_ticket', **{ count: invoice.main_item&.object&.nb_reserve_places })}"
end
invoice.main_item&.object&.tickets&.each do |t|
label += "\n #{I18n.t('invoices.other_rate_ticket',
- count: t.booked,
- NAME: t.event_price_category.price_category.name)}"
+ **{ count: t.booked,
+ NAME: t.event_price_category.price_category.name })}"
end
label
end
diff --git a/app/services/invoices/label_service.rb b/app/services/invoices/label_service.rb
index b5a7ab01a..9b3b07fb3 100644
--- a/app/services/invoices/label_service.rb
+++ b/app/services/invoices/label_service.rb
@@ -40,7 +40,7 @@ class Invoices::LabelService
def avoir_label(invoice)
return I18n.t('invoices.wallet_credit') if invoice.main_item&.object_type == WalletTransaction.name
- I18n.t('invoices.cancellation_of_invoice_REF', REF: invoice.invoice.reference)
+ I18n.t('invoices.cancellation_of_invoice_REF', **{ REF: invoice.invoice.reference })
end
# @param invoice [Invoice]
@@ -48,9 +48,9 @@ class Invoices::LabelService
# @return [String]
def reservation_invoice_label(invoice, username)
label = I18n.t('invoices.reservation_of_USER_on_DATE_at_TIME',
- USER: username,
- DATE: I18n.l(invoice.main_item.object.slots[0].start_at.to_date),
- TIME: I18n.l(invoice.main_item.object.slots[0].start_at, format: :hour_minute))
+ **{ USER: username,
+ DATE: I18n.l(invoice.main_item.object.slots[0].start_at.to_date),
+ TIME: I18n.l(invoice.main_item.object.slots[0].start_at, format: :hour_minute) })
invoice.invoice_items.each do |item|
next unless item.object_type == Subscription.name
@@ -67,11 +67,11 @@ class Invoices::LabelService
# @return [String]
def subscription_label(subscription, username)
subscription_start_at = subscription.expired_at - subscription.plan.duration
- duration_verbose = I18n.t("duration.#{subscription.plan.interval}", count: subscription.plan.interval_count)
+ duration_verbose = I18n.t("duration.#{subscription.plan.interval}", **{ count: subscription.plan.interval_count })
I18n.t('invoices.subscription_of_NAME_for_DURATION_starting_from_DATE',
- NAME: username,
- DURATION: duration_verbose,
- DATE: I18n.l(subscription_start_at.to_date))
+ **{ NAME: username,
+ DURATION: duration_verbose,
+ DATE: I18n.l(subscription_start_at.to_date) })
end
# @param offer_day [OfferDay]
@@ -79,9 +79,9 @@ class Invoices::LabelService
# @return [String]
def offer_day_label(offer_day, username)
I18n.t('invoices.subscription_of_NAME_extended_starting_from_STARTDATE_until_ENDDATE',
- NAME: username,
- STARTDATE: I18n.l(offer_day.start_at.to_date),
- ENDDATE: I18n.l(offer_day.end_at.to_date))
+ **{ NAME: username,
+ STARTDATE: I18n.l(offer_day.start_at.to_date),
+ ENDDATE: I18n.l(offer_day.end_at.to_date) })
end
end
end
diff --git a/app/services/invoices/payment_details_service.rb b/app/services/invoices/payment_details_service.rb
index 9d15c4d29..c1bff3162 100644
--- a/app/services/invoices/payment_details_service.rb
+++ b/app/services/invoices/payment_details_service.rb
@@ -34,17 +34,17 @@ class Invoices::PaymentDetailsService
payment_verbose = I18n.t('invoices.settlement_by_wallet') if total.zero? && wallet_amount
payment_verbose += " #{I18n.t('invoices.on_DATE_at_TIME',
- DATE: I18n.l(invoice.created_at.to_date),
- TIME: I18n.l(invoice.created_at, format: :hour_minute))}"
+ **{ DATE: I18n.l(invoice.created_at.to_date),
+ TIME: I18n.l(invoice.created_at, format: :hour_minute) })}"
if total.positive? || !invoice.wallet_amount
- payment_verbose += " #{I18n.t('invoices.for_an_amount_of_AMOUNT', AMOUNT: number_to_currency(total))}"
+ payment_verbose += " #{I18n.t('invoices.for_an_amount_of_AMOUNT', **{ AMOUNT: number_to_currency(total) })}"
end
if invoice.wallet_amount
payment_verbose += if total.positive?
" #{I18n.t('invoices.and')} #{I18n.t('invoices.by_wallet')} " \
- "#{I18n.t('invoices.for_an_amount_of_AMOUNT', AMOUNT: number_to_currency(wallet_amount))}"
+ "#{I18n.t('invoices.for_an_amount_of_AMOUNT', **{ AMOUNT: number_to_currency(wallet_amount) })}"
else
- " #{I18n.t('invoices.for_an_amount_of_AMOUNT', AMOUNT: number_to_currency(wallet_amount))}"
+ " #{I18n.t('invoices.for_an_amount_of_AMOUNT', **{ AMOUNT: number_to_currency(wallet_amount) })}"
end
end
payment_verbose
@@ -57,7 +57,7 @@ class Invoices::PaymentDetailsService
# @param total [Float]
# @return [String]
def build_avoir_details(invoice, total)
- details = "#{I18n.t('invoices.refund_on_DATE', DATE: I18n.l(invoice.avoir_date.to_date))} "
+ details = "#{I18n.t('invoices.refund_on_DATE', **{ DATE: I18n.l(invoice.avoir_date.to_date) })} "
case invoice.payment_method
when 'stripe'
details += I18n.t('invoices.by_card_online_payment')
@@ -74,7 +74,7 @@ class Invoices::PaymentDetailsService
else
Rails.logger.error "specified refunding method (#{details}) is unknown"
end
- "#{details} #{I18n.t('invoices.for_an_amount_of_AMOUNT', AMOUNT: number_to_currency(total))}"
+ "#{details} #{I18n.t('invoices.for_an_amount_of_AMOUNT', **{ AMOUNT: number_to_currency(total) })}"
end
end
end
diff --git a/app/services/invoices_service.rb b/app/services/invoices_service.rb
index 47b96900b..ac63809e6 100644
--- a/app/services/invoices_service.rb
+++ b/app/services/invoices_service.rb
@@ -129,11 +129,11 @@ class InvoicesService
"- #{I18n.l slot.end_at, format: :hour_minute}"
else
"#{I18n.t('events.from_STARTDATE_to_ENDDATE',
- STARTDATE: I18n.l(slot.start_at.to_date, format: :long),
- ENDDATE: I18n.l(slot.end_at.to_date, format: :long))} " \
+ **{ STARTDATE: I18n.l(slot.start_at.to_date, format: :long),
+ ENDDATE: I18n.l(slot.end_at.to_date, format: :long) })} " \
"#{I18n.t('events.from_STARTTIME_to_ENDTIME',
- STARTTIME: I18n.l(slot.start_at, format: :hour_minute),
- ENDTIME: I18n.l(slot.end_at, format: :hour_minute))}"
+ **{ STARTTIME: I18n.l(slot.start_at, format: :hour_minute),
+ ENDTIME: I18n.l(slot.end_at, format: :hour_minute) })}"
end
price_slot = payment_details[:elements][:slots].detect { |p_slot| p_slot[:start_at].to_time.in_time_zone == slot[:start_at] }
@@ -191,7 +191,7 @@ class InvoicesService
invoice.invoice_items.push InvoiceItem.new(
amount: payment_details[:elements][:pack],
- description: I18n.t('invoices.pack_item', COUNT: pack.prepaid_pack.minutes / 60, ITEM: pack.prepaid_pack.priceable.name),
+ description: I18n.t('invoices.pack_item', **{ COUNT: pack.prepaid_pack.minutes / 60, ITEM: pack.prepaid_pack.priceable.name }),
object: pack,
main: main
)
diff --git a/app/services/statistics_export_service.rb b/app/services/statistics_export_service.rb
index 41d08e22f..cd00258b4 100644
--- a/app/services/statistics_export_service.rb
+++ b/app/services/statistics_export_service.rb
@@ -27,16 +27,12 @@ class StatisticsExportService
@indices = StatisticIndex.all.includes(:statistic_fields, statistic_types: [:statistic_sub_types])
- ActionController::Base.prepend_view_path './app/views/'
- # place data in view_assigns
- view_assigns = { results: @results, users: @users, indices: @indices }
- av = ActionView::Base.new(ActionController::Base.view_paths, view_assigns)
- av.class_eval do
- # include any needed helpers (for the view)
- include ExcelHelper
- end
-
- content = av.render template: 'exports/statistics_global.xlsx.axlsx'
+ content = ApplicationController.render(
+ template: 'exports/statistics_global',
+ locals: { results: @results, users: @users, indices: @indices },
+ handlers: [:axlsx],
+ formats: [:xlsx]
+ )
# write content to file
File.binwrite(export.file, content)
end
@@ -65,20 +61,16 @@ class StatisticsExportService
@subtypes = @type.statistic_sub_types
@fields = @index.statistic_fields
- ActionController::Base.prepend_view_path './app/views/'
- # place data in view_assigns
- view_assigns = {results: @results, users: @users, index: @index, type: @type, subtypes: @subtypes, fields: @fields}
- av = ActionView::Base.new(ActionController::Base.view_paths, view_assigns)
- av.class_eval do
- # include any needed helpers (for the view)
- include ExcelHelper
- end
-
- content = av.render template: 'exports/statistics_current.xlsx.axlsx'
+ content = ApplicationController.render(
+ template: 'exports/statistics_current',
+ locals: { results: @results, users: @users, index: @index, type: @type, subtypes: @subtypes, fields: @fields },
+ handlers: [:axlsx],
+ formats: [:xlsx]
+ )
# write content to file
File.binwrite(export.file, content)
end
- }, __FILE__, __LINE__ - 35
+ }, __FILE__, __LINE__ - 31
end
# rubocop:enable Style/DocumentDynamicEvalDefinition
end
diff --git a/app/services/users_export_service.rb b/app/services/users_export_service.rb
index 13a96f595..5d84e7195 100644
--- a/app/services/users_export_service.rb
+++ b/app/services/users_export_service.rb
@@ -10,62 +10,48 @@ require './app/helpers/application_helper'
# There routines will generate Excel files containing data dumped from database
class UsersExportService
-
# export subscriptions
def export_subscriptions(export)
@subscriptions = Subscription.all.includes(:plan, statistic_profile: [user: [:profile]])
- ActionController::Base.prepend_view_path './app/views/'
- # place data in view_assigns
- view_assigns = { subscriptions: @subscriptions }
- av = ActionView::Base.new(ActionController::Base.view_paths, view_assigns)
- av.class_eval do
- # include any needed helpers (for the view)
- include ApplicationHelper
- end
-
- content = av.render template: 'exports/users_subscriptions.xlsx.axlsx'
+ content = ApplicationController.render(
+ template: 'exports/users_subscriptions',
+ locals: { subscriptions: @subscriptions },
+ handlers: [:axlsx],
+ formats: [:xlsx]
+ )
# write content to file
- File.open(export.file, 'w+b') { |f| f.write content }
+ File.binwrite(export.file, content)
end
# export reservations
def export_reservations(export)
@reservations = Reservation.all.includes(:slots, :reservable, statistic_profile: [user: [:profile]])
- ActionController::Base.prepend_view_path './app/views/'
- # place data in view_assigns
- view_assigns = { reservations: @reservations }
- av = ActionView::Base.new(ActionController::Base.view_paths, view_assigns)
- av.class_eval do
- # include any needed helpers (for the view)
- include ApplicationHelper
- end
-
- content = av.render template: 'exports/users_reservations.xlsx.axlsx'
+ content = ApplicationController.render(
+ template: 'exports/users_reservations',
+ locals: { reservations: @reservations },
+ handlers: [:axlsx],
+ formats: [:xlsx]
+ )
# write content to file
- File.open(export.file, 'w+b') { |f| f.write content }
+ File.binwrite(export.file, content)
end
# export members
def export_members(export)
@members = User.members
.includes(:group, :tags, :projects, :profile,
- invoicing_profile: [:invoices, :address, organization: [:address]],
- statistic_profile: [:trainings, subscriptions: [:plan]])
+ invoicing_profile: [:invoices, :address, { organization: [:address] }],
+ statistic_profile: [:trainings, { subscriptions: [:plan] }])
- ActionController::Base.prepend_view_path './app/views/'
- # place data in view_assigns
- view_assigns = { members: @members }
- av = ActionView::Base.new(ActionController::Base.view_paths, view_assigns)
- av.class_eval do
- # include any needed helpers (for the view)
- include ApplicationHelper
- end
-
- content = av.render template: 'exports/users_members.xlsx.axlsx'
+ content = ApplicationController.render(
+ template: 'exports/users_members',
+ locals: { members: @members },
+ handlers: [:axlsx],
+ formats: [:xlsx]
+ )
# write content to file
- File.open(export.file, 'w+b') { |f| f.write content }
+ File.binwrite(export.file, content)
end
-
end
diff --git a/app/sweepers/stylesheet_sweeper.rb b/app/sweepers/stylesheet_sweeper.rb
deleted file mode 100644
index 3a8c23fd6..000000000
--- a/app/sweepers/stylesheet_sweeper.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-# frozen_string_literal: true
-
-# Build a cached version of the CSS stylesheet
-class StylesheetSweeper < ActionController::Caching::Sweeper
- observe Stylesheet
-
- def after_update(record)
- expire_page(controller: 'stylesheets', action: 'show', id: record.id) if record.saved_change_to_contents?
- end
-end
diff --git a/app/validators/coupon_discount_validator.rb b/app/validators/coupon_discount_validator.rb
index 60a674804..cd2d2f503 100644
--- a/app/validators/coupon_discount_validator.rb
+++ b/app/validators/coupon_discount_validator.rb
@@ -1,15 +1,14 @@
+# frozen_string_literal: true
+
+# Validates the validity of a new or updated coupon
class CouponDiscountValidator < ActiveModel::Validator
def validate(record)
if !record.percent_off.nil?
- unless (0..100).include? record.percent_off
- record.errors[:percent_off] << I18n.t('errors.messages.percentage_out_of_range')
- end
+ record.errors.add(:percent_off, I18n.t('errors.messages.percentage_out_of_range')) unless (0..100).include? record.percent_off
elsif !record.amount_off.nil?
- unless record.amount_off > 0
- record.errors[:amount_off] << I18n.t('errors.messages.greater_than_or_equal_to', count: 0)
- end
+ record.errors.add(:amount_off, I18n.t('errors.messages.greater_than_or_equal_to', **{ count: 0 })) unless record.amount_off.positive?
else
- record.errors[:percent_off] << I18n.t('errors.messages.cannot_be_blank_at_same_time', field: 'amount_off')
+ record.errors.add(:percent_off, I18n.t('errors.messages.cannot_be_blank_at_same_time', **{ field: 'amount_off' }))
end
end
-end
\ No newline at end of file
+end
diff --git a/app/validators/database_provider_validator.rb b/app/validators/database_provider_validator.rb
index d49de8b8d..af80c52c9 100644
--- a/app/validators/database_provider_validator.rb
+++ b/app/validators/database_provider_validator.rb
@@ -5,6 +5,6 @@ class DatabaseProviderValidator < ActiveModel::Validator
def validate(record)
return if DatabaseProvider.count.zero?
- record.errors[:id] << I18n.t('authentication_providers.local_database_provider_already_exists')
+ record.errors.add(:id, I18n.t('authentication_providers.local_database_provider_already_exists'))
end
end
diff --git a/app/validators/date_range_validator.rb b/app/validators/date_range_validator.rb
index fccd59092..718de7e5f 100644
--- a/app/validators/date_range_validator.rb
+++ b/app/validators/date_range_validator.rb
@@ -7,6 +7,6 @@ class DateRangeValidator < ActiveModel::Validator
the_start = record.start_at
return if the_end.present? && the_end >= the_start
- record.errors[:end_at] << I18n.t('errors.messages.end_before_start', START: the_start)
+ record.errors.add(:end_at, I18n.t('errors.messages.end_before_start', **{ START: the_start }))
end
end
diff --git a/app/validators/duration_validator.rb b/app/validators/duration_validator.rb
index 0fd4e8520..7ad5b8a8d 100644
--- a/app/validators/duration_validator.rb
+++ b/app/validators/duration_validator.rb
@@ -7,8 +7,8 @@ class DurationValidator < ActiveModel::Validator
the_start = record.start_at
diff = (the_end - the_start).to_i
# 0.day means that (the_start == the_end), so it's a one day period
- return if diff.days >= 0.day && diff.days <= 1.year
+ return if diff.days >= 0.days && diff.days <= 1.year
- record.errors[:end_at] << I18n.t('errors.messages.invalid_duration', DAYS: diff)
+ record.errors.add(:end_at, I18n.t('errors.messages.invalid_duration', **{ DAYS: diff }))
end
end
diff --git a/app/validators/past_period_validator.rb b/app/validators/past_period_validator.rb
index 78ca9afe7..7216a55b1 100644
--- a/app/validators/past_period_validator.rb
+++ b/app/validators/past_period_validator.rb
@@ -5,8 +5,8 @@ class PastPeriodValidator < ActiveModel::Validator
def validate(record)
the_end = record.end_at
- return if the_end.present? && the_end < Date.today
+ return if the_end.present? && the_end < Time.zone.today
- record.errors[:end_at] << I18n.t('errors.messages.must_be_in_the_past')
+ record.errors.add(:end_at, I18n.t('errors.messages.must_be_in_the_past'))
end
end
diff --git a/app/validators/period_integrity_validator.rb b/app/validators/period_integrity_validator.rb
index 9f0d735f0..2bd41a28f 100644
--- a/app/validators/period_integrity_validator.rb
+++ b/app/validators/period_integrity_validator.rb
@@ -6,7 +6,7 @@ class PeriodIntegrityValidator < ActiveModel::Validator
invoices = record.invoices.includes(:invoice_items)
invoices.each do |i|
- record.errors["invoice_#{i.reference}".to_sym] << I18n.t('errors.messages.invalid_footprint') unless i.check_footprint
+ record.errors.add("invoice_#{i.reference}".to_sym, I18n.t('errors.messages.invalid_footprint')) unless i.check_footprint
end
end
end
diff --git a/app/validators/period_overlap_validator.rb b/app/validators/period_overlap_validator.rb
index 8d718c9a8..ce20e0cff 100644
--- a/app/validators/period_overlap_validator.rb
+++ b/app/validators/period_overlap_validator.rb
@@ -7,15 +7,9 @@ class PeriodOverlapValidator < ActiveModel::Validator
the_start = record.start_at
AccountingPeriod.all.each do |period|
- if the_start >= period.start_at && the_start <= period.end_at
- record.errors[:start_at] << I18n.t('errors.messages.cannot_overlap')
- end
- if the_end >= period.start_at && the_end <= period.end_at
- record.errors[:end_at] << I18n.t('errors.messages.cannot_overlap')
- end
- if period.start_at >= the_start && period.end_at <= the_end
- record.errors[:end_at] << I18n.t('errors.messages.cannot_encompass')
- end
+ record.errors.add(:start_at, I18n.t('errors.messages.cannot_overlap')) if the_start >= period.start_at && the_start <= period.end_at
+ record.errors.add(:end_at, I18n.t('errors.messages.cannot_overlap')) if the_end >= period.start_at && the_end <= period.end_at
+ record.errors.add(:end_at, I18n.t('errors.messages.cannot_encompass')) if period.start_at >= the_start && period.end_at <= the_end
end
end
end
diff --git a/app/validators/subscription_group_validator.rb b/app/validators/subscription_group_validator.rb
index 7f04545e5..a793ff6fa 100644
--- a/app/validators/subscription_group_validator.rb
+++ b/app/validators/subscription_group_validator.rb
@@ -5,6 +5,6 @@ class SubscriptionGroupValidator < ActiveModel::Validator
def validate(record)
return if record.statistic_profile&.group_id == record.plan&.group_id
- record.errors[:plan_id] << "This plan is not compatible with the current user's group"
+ record.errors.add(:plan_id, "This plan is not compatible with the current user's group")
end
end
diff --git a/app/views/api/custom_assets/show.json.jbuilder b/app/views/api/custom_assets/show.json.jbuilder
index 37012a046..182781ce9 100644
--- a/app/views/api/custom_assets/show.json.jbuilder
+++ b/app/views/api/custom_assets/show.json.jbuilder
@@ -1,12 +1,16 @@
+# frozen_string_literal: true
+
json.custom_asset do
if @custom_asset
json.extract! @custom_asset, :id, :name
- json.custom_asset_file_attributes do
- json.id @custom_asset.custom_asset_file.id
- json.attachment @custom_asset.custom_asset_file.attachment_identifier
- json.attachment_url @custom_asset.custom_asset_file.attachment_url
- end if @custom_asset.custom_asset_file
+ if @custom_asset.custom_asset_file
+ json.custom_asset_file_attributes do
+ json.id @custom_asset.custom_asset_file.id
+ json.attachment @custom_asset.custom_asset_file.attachment_identifier
+ json.attachment_url @custom_asset.custom_asset_file.attachment_url
+ end
+ end
else
json.nil!
end
-end
\ No newline at end of file
+end
diff --git a/app/views/api/stylesheets/show.css.erb b/app/views/api/stylesheets/show.css.erb
index 02c72b437..69f10f41a 100644
--- a/app/views/api/stylesheets/show.css.erb
+++ b/app/views/api/stylesheets/show.css.erb
@@ -1 +1,3 @@
-<%= @stylesheet.contents.html_safe %>
\ No newline at end of file
+<% cache @stylesheet do %>
+ <%= @stylesheet.contents.html_safe %>
+<% end %>
diff --git a/app/views/exports/availabilities_index.xlsx.axlsx b/app/views/exports/availabilities_index.xlsx.axlsx
index 7952956df..1b61baf28 100644
--- a/app/views/exports/availabilities_index.xlsx.axlsx
+++ b/app/views/exports/availabilities_index.xlsx.axlsx
@@ -15,7 +15,7 @@ wb.add_worksheet(name: ExcelService.name_safe(t('export_availabilities.machines'
sheet.add_row columns, style: header
# data rows
- @availabilities.where(available_type: 'machines').order(:start_at).each do |a|
+ availabilities.where(available_type: 'machines').order(:start_at).each do |a|
slot_duration = a.slot_duration || Setting.get('slot_duration').to_i
a.machines.each do |m|
((a.end_at - a.start_at) / slot_duration.minutes).to_i.times do |i|
@@ -55,7 +55,7 @@ wb.add_worksheet(name: ExcelService.name_safe(t('export_availabilities.trainings
sheet.add_row columns, style: header
# data rows
- @availabilities.where(available_type: 'training').order(:start_at).each do |a|
+ availabilities.where(available_type: 'training').order(:start_at).each do |a|
data = [
a.start_at.to_date,
I18n.l(a.start_at, format: '%A').capitalize,
@@ -83,7 +83,7 @@ if Setting.get('spaces_module')
sheet.add_row columns, style: header
# data rows
- @availabilities.where(available_type: 'space').order(:start_at).each do |a|
+ availabilities.where(available_type: 'space').order(:start_at).each do |a|
slot_duration = a.slot_duration || Setting.get('slot_duration').to_i
((a.end_at - a.start_at) / slot_duration.minutes).to_i.times do |i|
start_at = a.start_at + (i * slot_duration).minutes
@@ -119,7 +119,7 @@ wb.add_worksheet(name: ExcelService.name_safe(t('export_availabilities.events'))
sheet.add_row columns, :style => header
# data rows
- @availabilities.where(available_type: 'event').order(:start_at).each do |a|
+ availabilities.where(available_type: 'event').order(:start_at).each do |a|
data = [
a.start_at.to_date,
I18n.l(a.start_at, format: '%A').capitalize,
diff --git a/app/views/exports/statistics_current.xlsx.axlsx b/app/views/exports/statistics_current.xlsx.axlsx
index f009cab19..2a8d655a9 100644
--- a/app/views/exports/statistics_current.xlsx.axlsx
+++ b/app/views/exports/statistics_current.xlsx.axlsx
@@ -6,13 +6,13 @@ bold = wb.styles.add_style b: true
header = wb.styles.add_style b: true, bg_color: Stylesheet.primary.upcase.gsub('#', 'FF'), fg_color: 'FFFFFFFF'
date = wb.styles.add_style format_code: Rails.application.secrets.excel_date_format
-wb.add_worksheet(name: ExcelService.name_safe(@index.label)) do |sheet|
+wb.add_worksheet(name: ExcelService.name_safe(index.label)) do |sheet|
## heading stats for the current page
- sheet.add_row [t('export.entries'), @results['hits']['total']], style: [bold, nil], types: %i[string integer]
- sheet.add_row [t('export.revenue'), @results['aggregations']['total_ca']['value']], style: [bold, nil], types: %i[string float] if @index.ca
- sheet.add_row [t('export.average_age'), @results['aggregations']['average_age']['value']], style: [bold, nil], types: %i[string float]
- unless @type.simple
- sheet.add_row ["#{t('export.total')} #{@type.label}", @results['aggregations']['total_stat']['value']],
+ sheet.add_row [t('export.entries'), results['hits']['total']], style: [bold, nil], types: %i[string integer]
+ sheet.add_row [t('export.revenue'), results['aggregations']['total_ca']['value']], style: [bold, nil], types: %i[string float] if index.ca
+ sheet.add_row [t('export.average_age'), results['aggregations']['average_age']['value']], style: [bold, nil], types: %i[string float]
+ unless type.simple
+ sheet.add_row ["#{t('export.total')} #{type.label}", results['aggregations']['total_stat']['value']],
style: [bold, nil],
types: %i[string integer]
end
@@ -22,22 +22,22 @@ wb.add_worksheet(name: ExcelService.name_safe(@index.label)) do |sheet|
# heading labels
columns = [t('export.date'), t('export.user'), t('export.email'), t('export.phone'), t('export.gender'), t('export.age'),
t('export.type')]
- columns.push @type.label unless @type.simple
- @fields.each do |f|
+ columns.push type.label unless type.simple
+ fields.each do |f|
columns.push f.label
end
- columns.push t('export.revenue') if @index.ca
+ columns.push t('export.revenue') if index.ca
sheet.add_row columns, style: header
# data rows
- @results['hits']['hits'].each do |hit|
- user = get_item(@users, hit['_source']['userId'])
- subtype = get_item(@subtypes, hit['_source']['subType'], 'key')
- data, styles, types = statistics_line(hit, user, @type, subtype, date)
- @fields.each do |f|
+ results['hits']['hits'].each do |hit|
+ user = get_item(users, hit['_source']['userId'])
+ subtype = get_item(subtypes, hit['_source']['subType'], 'key')
+ data, styles, types = statistics_line(hit, user, type, subtype, date)
+ fields.each do |f|
format_xlsx_cell(hit['_source'][f.key], data, styles, types, source_data_type: f.data_type, date_format: date)
end
- add_ca_cell(@index, hit, data, styles, types)
+ add_ca_cell(index, hit, data, styles, types)
sheet.add_row data, style: styles, types: types
end
diff --git a/app/views/exports/statistics_global.xlsx.axlsx b/app/views/exports/statistics_global.xlsx.axlsx
index b2ffc108c..3de6c4ed5 100644
--- a/app/views/exports/statistics_global.xlsx.axlsx
+++ b/app/views/exports/statistics_global.xlsx.axlsx
@@ -5,7 +5,7 @@ wb = xlsx_package.workbook
header = wb.styles.add_style b: true, bg_color: Stylesheet.primary.upcase.gsub('#', 'FF'), fg_color: 'FFFFFFFF'
date = wb.styles.add_style format_code: Rails.application.secrets.excel_date_format
-@indices.each do |index|
+indices.each do |index|
next unless index.table
index.statistic_types.each do |type|
@@ -22,12 +22,12 @@ date = wb.styles.add_style format_code: Rails.application.secrets.excel_date_for
sheet.add_row columns, style: header
# data rows
- @results['hits']['hits'].each do |hit|
+ results['hits']['hits'].each do |hit|
# check that the current result is for the given index and type
next unless hit['_type'] == index.es_type_key && hit['_source']['type'] == type.key
# get matching objects
- user = get_item(@users, hit['_source']['userId'])
+ user = get_item(users, hit['_source']['userId'])
subtype = get_item(type.statistic_sub_types, hit['_source']['subType'], 'key')
# start to fill data and associated styles and data-types
data, styles, types = statistics_line(hit, user, type, subtype, date)
diff --git a/app/views/exports/users_members.xlsx.axlsx b/app/views/exports/users_members.xlsx.axlsx
index 877a8bf0b..f4866e267 100644
--- a/app/views/exports/users_members.xlsx.axlsx
+++ b/app/views/exports/users_members.xlsx.axlsx
@@ -39,7 +39,7 @@ wb.add_worksheet(name: ExcelService.name_safe(t('export_members.members'))) do |
sheet.add_row columns, style: header
# data rows
- @members.each do |member|
+ members.each do |member|
expiration = member&.subscription&.expired_at
data = [
member.id,
diff --git a/app/views/exports/users_reservations.xlsx.axlsx b/app/views/exports/users_reservations.xlsx.axlsx
index ca2a11b07..6566704e0 100644
--- a/app/views/exports/users_reservations.xlsx.axlsx
+++ b/app/views/exports/users_reservations.xlsx.axlsx
@@ -15,7 +15,7 @@ wb.add_worksheet(name: ExcelService.name_safe(t('export_reservations.reservation
sheet.add_row columns, style: header
# data rows
- @reservations.each do |resrv|
+ reservations.each do |resrv|
invoice = resrv.original_invoice
data = [
resrv.user&.id,
diff --git a/app/views/exports/users_subscriptions.xlsx.axlsx b/app/views/exports/users_subscriptions.xlsx.axlsx
index b8e43ac26..82273e1cb 100644
--- a/app/views/exports/users_subscriptions.xlsx.axlsx
+++ b/app/views/exports/users_subscriptions.xlsx.axlsx
@@ -15,7 +15,7 @@ wb.add_worksheet(name: ExcelService.name_safe(t('export_subscriptions.subscripti
sheet.add_row columns, style: header
# data rows
- @subscriptions.each do |sub|
+ subscriptions.each do |sub|
data = [
sub.user&.id,
sub.user&.profile&.full_name || t('export_subscriptions.deleted_user'),
diff --git a/app/workers/invoice_worker.rb b/app/workers/invoice_worker.rb
index 25901d0f8..411f40677 100644
--- a/app/workers/invoice_worker.rb
+++ b/app/workers/invoice_worker.rb
@@ -7,7 +7,7 @@ class InvoiceWorker
def perform(invoice_id)
# generate a invoice
invoice = Invoice.find invoice_id
- pdf = ::PDF::Invoice.new(invoice).render
+ pdf = ::Pdf::Invoice.new(invoice).render
# store invoice on drive
File.binwrite(invoice.file, pdf)
diff --git a/app/workers/payment_schedule_worker.rb b/app/workers/payment_schedule_worker.rb
index 5b9f325bd..bbe9b9709 100644
--- a/app/workers/payment_schedule_worker.rb
+++ b/app/workers/payment_schedule_worker.rb
@@ -8,7 +8,7 @@ class PaymentScheduleWorker
def perform(payment_schedule_id)
# generate a payment schedule document
ps = PaymentSchedule.find(payment_schedule_id)
- pdf = ::PDF::PaymentSchedule.new(ps).render
+ pdf = ::Pdf::PaymentSchedule.new(ps).render
# save the file on the disk
File.binwrite(ps.file, pdf)
diff --git a/config/application.rb b/config/application.rb
index 1a3dfda9c..546843641 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -19,69 +19,74 @@ require 'elasticsearch/persistence/model'
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
-module Fablab
- class Application < Rails::Application
- require 'fab_manager'
+# module declaration
+module FabManager; end
- # Initialize configuration defaults for originally generated Rails version.
- config.load_defaults 5.2
- # prevent this new behavior with rails >= 5.0
- # see https://edgeguides.rubyonrails.org/upgrading_ruby_on_rails.html#active-record-belongs-to-required-by-default-option
- config.active_record.belongs_to_required_by_default = false
+# Fab-Manager is the FabLab management solution. It provides a comprehensive, web-based, open-source tool to simplify your
+# administrative tasks and your marker's projects.
+class FabManager::Application < Rails::Application
+ require 'fab_manager'
- # Settings in config/environments/* take precedence over those specified here.
- # Application configuration should go into files in config/initializers
- # -- all .rb files in that directory are automatically loaded.
+ # Initialize configuration defaults for originally generated Rails version.
+ config.load_defaults 6.0
+ # prevent this new behavior with rails >= 5.0
+ # see https://edgeguides.rubyonrails.org/upgrading_ruby_on_rails.html#active-record-belongs-to-required-by-default-option
+ config.active_record.belongs_to_required_by_default = false
+ config.active_record.schema_format = :sql
- # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
- # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
- config.time_zone = Rails.application.secrets.time_zone
+ # Settings in config/environments/* take precedence over those specified here.
+ # Application configuration should go into files in config/initializers
+ # -- all .rb files in that directory are automatically loaded.
- config.to_prepare do
- Devise::Mailer.layout 'notifications_mailer'
- end
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
+ config.time_zone = Rails.application.secrets.time_zone
- config.active_job.queue_adapter = :sidekiq
+ config.to_prepare do
+ Devise::Mailer.layout 'notifications_mailer'
+ end
- config.generators do |g|
- g.orm :active_record
- g.test_framework :mini_test
- end
+ config.active_job.queue_adapter = :sidekiq
- if Rails.env.development?
- config.web_console.whitelisted_ips << '192.168.0.0/16'
- config.web_console.whitelisted_ips << '192.168.99.0/16' # docker
- config.web_console.whitelisted_ips << '10.0.2.2' # vagrant
- end
+ config.generators do |g|
+ g.orm :active_record
+ g.test_framework :mini_test
+ end
- # load locales for subdirectories
- config.i18n.load_path += Dir[Rails.root.join('config', 'locales', '**/*.yml').to_s]
+ if Rails.env.development?
+ config.web_console.whitelisted_ips << '192.168.0.0/16'
+ config.web_console.whitelisted_ips << '192.168.99.0/16' # docker
+ config.web_console.whitelisted_ips << '10.0.2.2' # vagrant
+ end
- # enable the app to find locales in plugins locales directory
- config.i18n.load_path += Dir["#{Rails.root}/plugins/*/config/locales/*.yml"]
+ # load locales for subdirectories
+ config.i18n.load_path += Dir[Rails.root.join('config/locales/**/*.yml').to_s]
- # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
- # the I18n.default_locale when a translation cannot be found).
- config.i18n.fallbacks = true
+ # enable the app to find locales in plugins locales directory
+ config.i18n.load_path += Dir[Rails.root.join('plugins/*/config/locales/*.yml').to_s]
- # enable the app to find views in plugins views directory
- Dir["#{Rails.root}/plugins/*/views"].each do |path|
- Rails.application.config.paths['app/views'] << path
- end
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
+ # the I18n.default_locale when a translation cannot be found).
+ config.i18n.fallbacks = true
- # disable ANSI color escape codes in active_record if NO_COLOR is defined.
- config.colorize_logging = ENV['NO_COLOR'] ? false : true
+ # enable the app to find views in plugins views directory
+ Dir[Rails.root.join('plugins/*/views').to_s].each do |path|
+ Rails.application.config.paths['app/views'] << path
+ end
- FabManager.activate_plugins!
+ # disable ANSI color escape codes in active_record if NO_COLOR is defined.
+ config.colorize_logging = ENV['NO_COLOR'] ? false : true
- config.action_view.sanitized_allowed_tags = %w(a acronym hr pre table b strong i em li ul ol h1 h2 h3 h4 h5 h6 blockquote br cite sub sup ins p image iframe style)
+ FabManager.activate_plugins!
- config.after_initialize do
- plugins = FabManager.plugins
- plugins&.each(&:notify_after_initialize)
+ config.action_view.sanitized_allowed_tags = %w[a acronym hr pre table b strong i em li ul ol h1 h2 h3 h4 h5 h6 blockquote br cite sub sup ins p
+ image iframe style]
- require 'version'
- Version.check
- end
+ config.after_initialize do
+ plugins = FabManager.plugins
+ plugins&.each(&:notify_after_initialize)
+
+ require 'version'
+ Version.check
end
end
diff --git a/config/environments/development.rb b/config/environments/development.rb
index 2de9cb7eb..becb8ee75 100644
--- a/config/environments/development.rb
+++ b/config/environments/development.rb
@@ -27,17 +27,13 @@ Rails.application.configure do
# Enable/disable caching. By default caching is disabled.
# Run rails dev:cache to toggle caching.
- if Rails.root.join('tmp', 'caching-dev.txt').exist?
- config.action_controller.perform_caching = true
-
- config.cache_store = :memory_store
+ if Rails.root.join('tmp/caching-dev.txt').exist?
+ config.action_controller.cache_store = :memory_store
config.public_file_server.headers = {
'Cache-Control' => "public, max-age=#{2.days.to_i}"
}
else
config.action_controller.perform_caching = false
-
- config.cache_store = :null_store
end
config.action_controller.default_url_options = {
@@ -81,5 +77,6 @@ Rails.application.configure do
config.file_watcher = ActiveSupport::EventedFileUpdateChecker
config.log_level = Rails.application.secrets.log_level || :debug
-end
+ config.hosts << ENV.fetch('DEFAULT_HOST', 'localhost')
+end
diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb
index 0afb3b735..743ce14bd 100644
--- a/config/initializers/devise.rb
+++ b/config/initializers/devise.rb
@@ -8,7 +8,7 @@ Devise.setup do |config|
# confirmation, reset password and unlock tokens in the database.
# Devise will use the `secret_key_base` on Rails 4+ applications as its `secret_key`
# by default. You can change it below and use your own secret key.
- # config.secret_key = 'f0ad7aadec8086b90c0427e734602262e5d211147f3d93b5b94b5263ffd245e9fd9fcd672dcadea1d9ee2b1bffbf2712cdb013883d66943ef5bed93a263fe11a'
+ # config.secret_key = 'f0ad7aadec8086b90c0427e734602262e5d211147f3d93b5b94b5263ffd245e9fd9fcd672dcadea1d9ee2b1bffbf2712cdb013883d66943ef5bed9'
# ==> Mailer Configuration
# Configure the class responsible to send e-mails.
@@ -94,7 +94,7 @@ Devise.setup do |config|
config.stretches = Rails.env.test? ? 1 : 10
# Setup a pepper to generate the encrypted password.
- # config.pepper = 'af74f5ee4fe6f0156f5bbb843cdde2ce883df1cc97988ee7a88e9db28c07f7bb233d98e342e13151a2d2600ab1cd4ea405c1302dfced3d962739118c61225c80'
+ # config.pepper = 'af74f5ee4fe6f0156f5bbb843cdde2ce883df1cc97988ee7a88e9db28c07f7bb233d98e342e13151a2d2600ab1cd4ea405c1302dfced3d962739118c'
# ==> Configuration for :confirmable
# A period that the user is allowed to access the website even without
@@ -227,17 +227,18 @@ Devise.setup do |config|
# Add a new OmniAuth provider. Check the wiki for more information on setting
# up on your models and hooks.
# config.omniauth :github, 'APP_ID', 'APP_SECRET', :scope => 'user,public_repo'
-
- active_provider = AuthProvider.active
- if active_provider.providable_type == OAuth2Provider.name
- require_relative '../../lib/omni_auth/oauth2'
- config.omniauth OmniAuth::Strategies::SsoOauth2Provider.name.to_sym,
- active_provider.providable.client_id,
- active_provider.providable.client_secret
- elsif active_provider.providable_type == OpenIdConnectProvider.name
- require_relative '../../lib/omni_auth/openid_connect'
- config.omniauth OmniAuth::Strategies::SsoOpenidConnectProvider.name.to_sym,
- active_provider.providable.config
+ Rails.application.reloader.to_prepare do
+ active_provider = AuthProvider.active
+ if active_provider.providable_type == OAuth2Provider.name
+ require_relative '../../lib/omni_auth/oauth2'
+ config.omniauth OmniAuth::Strategies::SsoOauth2Provider.name.to_sym,
+ active_provider.providable.client_id,
+ active_provider.providable.client_secret
+ elsif active_provider.providable_type == OpenIdConnectProvider.name
+ require_relative '../../lib/omni_auth/openid_connect'
+ config.omniauth OmniAuth::Strategies::SsoOpenidConnectProvider.name.to_sym,
+ active_provider.providable.config
+ end
end
# ==> Warden configuration
diff --git a/config/initializers/devise_mailer.rb b/config/initializers/devise_mailer.rb
index cd595d25b..b01e7deeb 100644
--- a/config/initializers/devise_mailer.rb
+++ b/config/initializers/devise_mailer.rb
@@ -1,3 +1,7 @@
-Devise::Mailer.class_eval do
- helper :application
-end
\ No newline at end of file
+# frozen_string_literal: true
+
+Rails.application.reloader.to_prepare do
+ Devise::Mailer.class_eval do
+ helper :application
+ end
+end
diff --git a/config/initializers/postgresql_database_tasks.rb b/config/initializers/postgresql_database_tasks.rb
index 4616148e7..811dd88d3 100644
--- a/config/initializers/postgresql_database_tasks.rb
+++ b/config/initializers/postgresql_database_tasks.rb
@@ -1,21 +1,17 @@
# frozen_string_literal: true
-module ActiveRecord
- module Tasks
- # The following magic allows to drop a PG database even if a connection exists
- # @see https://stackoverflow.com/a/38710021
- class PostgreSQLDatabaseTasks
- include ActiveRecord::Sanitization::ClassMethods
+# The following magic allows to drop a PG database even if a connection exists
+# @see https://stackoverflow.com/a/38710021
+class ActiveRecord::Tasks::PostgreSQLDatabaseTasks
+ include ActiveRecord::Sanitization::ClassMethods
- def drop
- establish_master_connection
- q = sanitize_sql_array [
- "select pg_terminate_backend(pg_stat_activity.pid) from pg_stat_activity where datname= ? AND state='idle';",
- configuration['database']
- ]
- connection.select_all q
- connection.drop_database configuration['database']
- end
- end
+ def drop
+ establish_master_connection
+ q = sanitize_sql_array [
+ "select pg_terminate_backend(pg_stat_activity.pid) from pg_stat_activity where datname= ? AND state='idle';",
+ configuration_hash[:database]
+ ]
+ connection.select_all q
+ connection.drop_database configuration_hash[:database]
end
end
diff --git a/db/migrate/20170227104934_migrate_slots_reservations.rb b/db/migrate/20170227104934_migrate_slots_reservations.rb
index 611972c19..4bd361075 100644
--- a/db/migrate/20170227104934_migrate_slots_reservations.rb
+++ b/db/migrate/20170227104934_migrate_slots_reservations.rb
@@ -1,15 +1,16 @@
# frozen_string_literal:true
+# From this migration, we migrate all reservation-related data from Slot to SlotReservation
class MigrateSlotsReservations < ActiveRecord::Migration[4.2]
def up
Slot.all.each do |slot|
- SlotsReservation.create!({slot_id: slot.id, reservation_id: slot.reservation_id})
+ SlotsReservation.create!({ slot_id: slot.id, reservation_id: slot.reservation_id })
end
end
def down
SlotsReservation.all.each do |sr|
- Slot.find(sr.slot_id).update_attributes(:reservation_id => sr.reservation_id)
+ Slot.find(sr.slot_id).update(reservation_id: sr.reservation_id)
end
end
end
diff --git a/db/migrate/20190521124609_migrate_profile_to_invoicing_profile.rb b/db/migrate/20190521124609_migrate_profile_to_invoicing_profile.rb
index 08823dcab..4ca1c68bb 100644
--- a/db/migrate/20190521124609_migrate_profile_to_invoicing_profile.rb
+++ b/db/migrate/20190521124609_migrate_profile_to_invoicing_profile.rb
@@ -1,5 +1,7 @@
# frozen_string_literal:true
+# From this migration, we split the user's profile into multiple tables:
+# InvoicingProfile is intended to keep invoicing data about the user after his account was deleted
class MigrateProfileToInvoicingProfile < ActiveRecord::Migration[4.2]
def up
User.all.each do |u|
@@ -12,10 +14,10 @@ class MigrateProfileToInvoicingProfile < ActiveRecord::Migration[4.2]
last_name: p.last_name,
email: u.email
)
- Address.find_by(placeable_id: p.id, placeable_type: 'Profile')&.update_attributes(
+ Address.find_by(placeable_id: p.id, placeable_type: 'Profile')&.update(
placeable: ip
)
- Organization.find_by(profile_id: p.id)&.update_attributes(
+ Organization.find_by(profile_id: p.id)&.update(
invoicing_profile_id: ip.id
)
end
@@ -24,14 +26,14 @@ class MigrateProfileToInvoicingProfile < ActiveRecord::Migration[4.2]
def down
InvoicingProfile.all.each do |ip|
profile = ip.user.profile
- profile.update_attributes(
+ profile.update(
first_name: ip.first_name,
last_name: ip.last_name
)
- Address.find_by(placeable_id: ip.id, placeable_type: 'InvoicingProfile')&.update_attributes(
+ Address.find_by(placeable_id: ip.id, placeable_type: 'InvoicingProfile')&.update(
placeable: profile
)
- Organization.find_by(invoicing_profile_id: ip.id)&.update_attributes(
+ Organization.find_by(invoicing_profile_id: ip.id)&.update(
profile_id: profile.id
)
end
diff --git a/db/migrate/20190521151142_migrate_profile_to_statistic_profile.rb b/db/migrate/20190521151142_migrate_profile_to_statistic_profile.rb
index 9a5205ed5..8621021f3 100644
--- a/db/migrate/20190521151142_migrate_profile_to_statistic_profile.rb
+++ b/db/migrate/20190521151142_migrate_profile_to_statistic_profile.rb
@@ -1,5 +1,7 @@
# frozen_string_literal:true
+# From this migration, we split the user's profile into multiple tables:
+# StatisticProfile is intended to keep anonymous statisttical data about the user after his account was deleted
class MigrateProfileToStatisticProfile < ActiveRecord::Migration[4.2]
def up
User.all.each do |u|
@@ -22,7 +24,7 @@ class MigrateProfileToStatisticProfile < ActiveRecord::Migration[4.2]
p = sp.user.profile
Rails.logger.warn "User #{sp.user_id} has no profile" and next unless p
- p.update_attributes(
+ p.update(
gender: sp.gender,
birthday: sp.birthday
)
diff --git a/db/migrate/20190523123916_migrate_wallet_to_invoicing_profile.rb b/db/migrate/20190523123916_migrate_wallet_to_invoicing_profile.rb
index 0fa3ab7f4..f205e90a7 100644
--- a/db/migrate/20190523123916_migrate_wallet_to_invoicing_profile.rb
+++ b/db/migrate/20190523123916_migrate_wallet_to_invoicing_profile.rb
@@ -1,16 +1,17 @@
# frozen_string_literal:true
+# Wallet data must be attached to InvoicingProfile because we must keep these data after the user has delete his account
class MigrateWalletToInvoicingProfile < ActiveRecord::Migration[4.2]
def up
Wallet.all.each do |w|
user = User.find(w.user_id)
- w.update_attributes(
+ w.update(
invoicing_profile_id: user.invoicing_profile.id
)
end
WalletTransaction.all.each do |wt|
user = User.find(wt.user_id)
- wt.update_attributes(
+ wt.update(
invoicing_profile_id: user.invoicing_profile.id
)
end
@@ -19,13 +20,13 @@ class MigrateWalletToInvoicingProfile < ActiveRecord::Migration[4.2]
def down
Wallet.all.each do |w|
invoicing_profile = User.find(w.invoicing_profile_id)
- w.update_attributes(
+ w.update(
user_id: invoicing_profile.user_id
)
end
WalletTransaction.all.each do |wt|
invoicing_profile = User.find(wt.invoicing_profile_id)
- wt.update_attributes(
+ wt.update(
user_id: invoicing_profile.user_id
)
end
diff --git a/db/migrate/20190523140823_migrate_history_value_to_invoicing_profile.rb b/db/migrate/20190523140823_migrate_history_value_to_invoicing_profile.rb
index 60e459d6b..99065d53e 100644
--- a/db/migrate/20190523140823_migrate_history_value_to_invoicing_profile.rb
+++ b/db/migrate/20190523140823_migrate_history_value_to_invoicing_profile.rb
@@ -1,10 +1,11 @@
# frozen_string_literal:true
+# HistoryValue must be attached to InvoicingProfile because we want to be able to blame who was responsible for a change in accounting settings
class MigrateHistoryValueToInvoicingProfile < ActiveRecord::Migration[4.2]
def up
HistoryValue.all.each do |hv|
user = User.find_by(id: hv.user_id)
- hv.update_attributes(
+ hv.update(
invoicing_profile_id: user&.invoicing_profile&.id
)
end
@@ -13,7 +14,7 @@ class MigrateHistoryValueToInvoicingProfile < ActiveRecord::Migration[4.2]
def down
HistoryValue.all.each do |hv|
invoicing_profile = User.find_by(id: hv.invoicing_profile_id)
- hv.update_attributes(
+ hv.update(
user_id: invoicing_profile&.user_id
)
end
diff --git a/db/migrate/20220328141618_create_open_id_connect_providers.rb b/db/migrate/20220328141618_create_open_id_connect_providers.rb
index a7d7c34c7..de9c33757 100644
--- a/db/migrate/20220328141618_create_open_id_connect_providers.rb
+++ b/db/migrate/20220328141618_create_open_id_connect_providers.rb
@@ -9,7 +9,6 @@ class CreateOpenIdConnectProviders < ActiveRecord::Migration[5.2]
t.string :client_auth_method
t.string :scope
t.string :response_type
- t.string :response_type
t.string :response_mode
t.string :display
t.string :prompt
diff --git a/db/schema.rb b/db/schema.rb
index 629437c52..ae0a6e4ec 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -2,11 +2,11 @@
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
-# Note that this schema.rb definition is the authoritative source for your
-# database schema. If you need to create the application database on another
-# system, you should be using db:schema:load, not running all the migrations
-# from scratch. The latter is a flawed and unsustainable approach (the more migrations
-# you'll amass, the slower it'll run and the greater likelihood for issues).
+# This file is the source Rails uses to define your schema when running `bin/rails
+# db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to
+# be faster and is potentially less error prone than running all of your
+# migrations from scratch. Old migrations may fail to apply correctly if those
+# migrations use external dependencies or application code.
#
# It's strongly recommended that you check this file into your version control system.
diff --git a/db/structure.sql b/db/structure.sql
new file mode 100644
index 000000000..3fd5e4bca
--- /dev/null
+++ b/db/structure.sql
@@ -0,0 +1,8657 @@
+SET statement_timeout = 0;
+SET lock_timeout = 0;
+SET idle_in_transaction_session_timeout = 0;
+SET client_encoding = 'UTF8';
+SET standard_conforming_strings = on;
+SELECT pg_catalog.set_config('search_path', '', false);
+SET check_function_bodies = false;
+SET xmloption = content;
+SET client_min_messages = warning;
+SET row_security = off;
+
+--
+-- Name: public; Type: SCHEMA; Schema: -; Owner: -
+--
+
+-- *not* creating schema, since initdb creates it
+
+
+--
+-- Name: fuzzystrmatch; Type: EXTENSION; Schema: -; Owner: -
+--
+
+CREATE EXTENSION IF NOT EXISTS fuzzystrmatch WITH SCHEMA public;
+
+
+--
+-- Name: EXTENSION fuzzystrmatch; Type: COMMENT; Schema: -; Owner: -
+--
+
+COMMENT ON EXTENSION fuzzystrmatch IS 'determine similarities and distance between strings';
+
+
+--
+-- Name: pg_trgm; Type: EXTENSION; Schema: -; Owner: -
+--
+
+CREATE EXTENSION IF NOT EXISTS pg_trgm WITH SCHEMA public;
+
+
+--
+-- Name: EXTENSION pg_trgm; Type: COMMENT; Schema: -; Owner: -
+--
+
+COMMENT ON EXTENSION pg_trgm IS 'text similarity measurement and index searching based on trigrams';
+
+
+--
+-- Name: unaccent; Type: EXTENSION; Schema: -; Owner: -
+--
+
+CREATE EXTENSION IF NOT EXISTS unaccent WITH SCHEMA public;
+
+
+--
+-- Name: EXTENSION unaccent; Type: COMMENT; Schema: -; Owner: -
+--
+
+COMMENT ON EXTENSION unaccent IS 'text search dictionary that removes accents';
+
+
+--
+-- Name: f_unaccent(text); Type: FUNCTION; Schema: public; Owner: -
+--
+
+CREATE FUNCTION public.f_unaccent(text) RETURNS text
+ LANGUAGE sql IMMUTABLE
+ AS $_$
+ SELECT public.unaccent('public.unaccent', $1)
+ $_$;
+
+
+--
+-- Name: fill_search_vector_for_project(); Type: FUNCTION; Schema: public; Owner: -
+--
+
+CREATE FUNCTION public.fill_search_vector_for_project() RETURNS trigger
+ LANGUAGE plpgsql
+ AS $$
+ declare
+ step_title record;
+ step_description record;
+
+ begin
+ select title into step_title from project_steps where project_id = new.id;
+ select string_agg(description, ' ') as content into step_description from project_steps where project_id = new.id;
+
+ new.search_vector :=
+ setweight(to_tsvector('pg_catalog.french', unaccent(coalesce(new.name, ''))), 'A') ||
+ setweight(to_tsvector('pg_catalog.french', unaccent(coalesce(new.tags, ''))), 'B') ||
+ setweight(to_tsvector('pg_catalog.french', unaccent(coalesce(new.description, ''))), 'D') ||
+ setweight(to_tsvector('pg_catalog.french', unaccent(coalesce(step_title.title, ''))), 'C') ||
+ setweight(to_tsvector('pg_catalog.french', unaccent(coalesce(step_description.content, ''))), 'D');
+
+ return new;
+ end
+ $$;
+
+
+--
+-- Name: pg_search_dmetaphone(text); Type: FUNCTION; Schema: public; Owner: -
+--
+
+CREATE FUNCTION public.pg_search_dmetaphone(text) RETURNS text
+ LANGUAGE sql IMMUTABLE STRICT
+ AS $_$
+ SELECT array_to_string(ARRAY(SELECT dmetaphone(unnest(regexp_split_to_array($1, E'\\s+')))), ' ')
+$_$;
+
+
+SET default_tablespace = '';
+
+--
+-- Name: abuses; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.abuses (
+ id integer NOT NULL,
+ signaled_type character varying,
+ signaled_id integer,
+ first_name character varying,
+ last_name character varying,
+ email character varying,
+ message text,
+ created_at timestamp without time zone NOT NULL,
+ updated_at timestamp without time zone NOT NULL
+);
+
+
+--
+-- Name: abuses_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.abuses_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: abuses_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.abuses_id_seq OWNED BY public.abuses.id;
+
+
+--
+-- Name: accounting_lines; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.accounting_lines (
+ id bigint NOT NULL,
+ line_type character varying,
+ journal_code character varying,
+ date timestamp without time zone,
+ account_code character varying,
+ account_label character varying,
+ analytical_code character varying,
+ invoice_id bigint,
+ invoicing_profile_id bigint,
+ debit integer,
+ credit integer,
+ currency character varying,
+ summary character varying,
+ created_at timestamp without time zone NOT NULL,
+ updated_at timestamp without time zone NOT NULL
+);
+
+
+--
+-- Name: accounting_lines_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.accounting_lines_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: accounting_lines_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.accounting_lines_id_seq OWNED BY public.accounting_lines.id;
+
+
+--
+-- Name: accounting_periods; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.accounting_periods (
+ id integer NOT NULL,
+ start_at date,
+ end_at date,
+ closed_at timestamp without time zone,
+ closed_by integer,
+ created_at timestamp without time zone NOT NULL,
+ updated_at timestamp without time zone NOT NULL,
+ period_total integer,
+ perpetual_total integer,
+ footprint character varying
+);
+
+
+--
+-- Name: accounting_periods_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.accounting_periods_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: accounting_periods_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.accounting_periods_id_seq OWNED BY public.accounting_periods.id;
+
+
+--
+-- Name: addresses; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.addresses (
+ id integer NOT NULL,
+ address character varying,
+ street_number character varying,
+ route character varying,
+ locality character varying,
+ country character varying,
+ postal_code character varying,
+ placeable_type character varying,
+ placeable_id integer,
+ created_at timestamp without time zone,
+ updated_at timestamp without time zone
+);
+
+
+--
+-- Name: addresses_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.addresses_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: addresses_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.addresses_id_seq OWNED BY public.addresses.id;
+
+
+--
+-- Name: advanced_accountings; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.advanced_accountings (
+ id bigint NOT NULL,
+ code character varying,
+ analytical_section character varying,
+ accountable_type character varying,
+ accountable_id bigint,
+ created_at timestamp without time zone NOT NULL,
+ updated_at timestamp without time zone NOT NULL
+);
+
+
+--
+-- Name: advanced_accountings_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.advanced_accountings_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: advanced_accountings_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.advanced_accountings_id_seq OWNED BY public.advanced_accountings.id;
+
+
+--
+-- Name: age_ranges; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.age_ranges (
+ id integer NOT NULL,
+ name character varying,
+ created_at timestamp without time zone NOT NULL,
+ updated_at timestamp without time zone NOT NULL,
+ slug character varying
+);
+
+
+--
+-- Name: age_ranges_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.age_ranges_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: age_ranges_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.age_ranges_id_seq OWNED BY public.age_ranges.id;
+
+
+--
+-- Name: ar_internal_metadata; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.ar_internal_metadata (
+ key character varying NOT NULL,
+ value character varying,
+ created_at timestamp(6) without time zone NOT NULL,
+ updated_at timestamp(6) without time zone NOT NULL
+);
+
+
+--
+-- Name: assets; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.assets (
+ id integer NOT NULL,
+ viewable_type character varying,
+ viewable_id integer,
+ attachment character varying,
+ type character varying,
+ created_at timestamp without time zone,
+ updated_at timestamp without time zone,
+ is_main boolean
+);
+
+
+--
+-- Name: assets_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.assets_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: assets_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.assets_id_seq OWNED BY public.assets.id;
+
+
+--
+-- Name: auth_provider_mappings; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.auth_provider_mappings (
+ id integer NOT NULL,
+ local_field character varying,
+ api_field character varying,
+ created_at timestamp without time zone NOT NULL,
+ updated_at timestamp without time zone NOT NULL,
+ local_model character varying,
+ api_endpoint character varying,
+ api_data_type character varying,
+ transformation jsonb,
+ auth_provider_id bigint
+);
+
+
+--
+-- Name: auth_provider_mappings_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.auth_provider_mappings_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: auth_provider_mappings_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.auth_provider_mappings_id_seq OWNED BY public.auth_provider_mappings.id;
+
+
+--
+-- Name: auth_providers; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.auth_providers (
+ id integer NOT NULL,
+ name character varying,
+ status character varying,
+ created_at timestamp without time zone NOT NULL,
+ updated_at timestamp without time zone NOT NULL,
+ providable_type character varying,
+ providable_id integer
+);
+
+
+--
+-- Name: auth_providers_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.auth_providers_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: auth_providers_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.auth_providers_id_seq OWNED BY public.auth_providers.id;
+
+
+--
+-- Name: availabilities; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.availabilities (
+ id integer NOT NULL,
+ start_at timestamp without time zone,
+ end_at timestamp without time zone,
+ available_type character varying,
+ created_at timestamp without time zone,
+ updated_at timestamp without time zone,
+ nb_total_places integer,
+ destroying boolean DEFAULT false,
+ lock boolean DEFAULT false,
+ is_recurrent boolean,
+ occurrence_id integer,
+ period character varying,
+ nb_periods integer,
+ end_date timestamp without time zone,
+ slot_duration integer
+);
+
+
+--
+-- Name: availabilities_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.availabilities_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: availabilities_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.availabilities_id_seq OWNED BY public.availabilities.id;
+
+
+--
+-- Name: availability_tags; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.availability_tags (
+ id integer NOT NULL,
+ availability_id integer,
+ tag_id integer,
+ created_at timestamp without time zone NOT NULL,
+ updated_at timestamp without time zone NOT NULL
+);
+
+
+--
+-- Name: availability_tags_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.availability_tags_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: availability_tags_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.availability_tags_id_seq OWNED BY public.availability_tags.id;
+
+
+--
+-- Name: cart_item_coupons; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.cart_item_coupons (
+ id bigint NOT NULL,
+ coupon_id bigint,
+ customer_profile_id bigint,
+ operator_profile_id bigint,
+ created_at timestamp without time zone NOT NULL,
+ updated_at timestamp without time zone NOT NULL
+);
+
+
+--
+-- Name: cart_item_coupons_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.cart_item_coupons_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: cart_item_coupons_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.cart_item_coupons_id_seq OWNED BY public.cart_item_coupons.id;
+
+
+--
+-- Name: cart_item_event_reservation_tickets; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.cart_item_event_reservation_tickets (
+ id bigint NOT NULL,
+ booked integer,
+ event_price_category_id bigint,
+ cart_item_event_reservation_id bigint,
+ created_at timestamp without time zone NOT NULL,
+ updated_at timestamp without time zone NOT NULL
+);
+
+
+--
+-- Name: cart_item_event_reservation_tickets_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.cart_item_event_reservation_tickets_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: cart_item_event_reservation_tickets_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.cart_item_event_reservation_tickets_id_seq OWNED BY public.cart_item_event_reservation_tickets.id;
+
+
+--
+-- Name: cart_item_event_reservations; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.cart_item_event_reservations (
+ id bigint NOT NULL,
+ normal_tickets integer,
+ event_id bigint,
+ operator_profile_id bigint,
+ customer_profile_id bigint,
+ created_at timestamp without time zone NOT NULL,
+ updated_at timestamp without time zone NOT NULL
+);
+
+
+--
+-- Name: cart_item_event_reservations_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.cart_item_event_reservations_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: cart_item_event_reservations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.cart_item_event_reservations_id_seq OWNED BY public.cart_item_event_reservations.id;
+
+
+--
+-- Name: cart_item_free_extensions; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.cart_item_free_extensions (
+ id bigint NOT NULL,
+ subscription_id bigint,
+ new_expiration_date timestamp without time zone,
+ customer_profile_id bigint,
+ created_at timestamp without time zone NOT NULL,
+ updated_at timestamp without time zone NOT NULL
+);
+
+
+--
+-- Name: cart_item_free_extensions_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.cart_item_free_extensions_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: cart_item_free_extensions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.cart_item_free_extensions_id_seq OWNED BY public.cart_item_free_extensions.id;
+
+
+--
+-- Name: cart_item_payment_schedules; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.cart_item_payment_schedules (
+ id bigint NOT NULL,
+ plan_id bigint,
+ coupon_id bigint,
+ requested boolean,
+ start_at timestamp without time zone,
+ customer_profile_id bigint,
+ created_at timestamp without time zone NOT NULL,
+ updated_at timestamp without time zone NOT NULL
+);
+
+
+--
+-- Name: cart_item_payment_schedules_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.cart_item_payment_schedules_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: cart_item_payment_schedules_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.cart_item_payment_schedules_id_seq OWNED BY public.cart_item_payment_schedules.id;
+
+
+--
+-- Name: cart_item_prepaid_packs; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.cart_item_prepaid_packs (
+ id bigint NOT NULL,
+ prepaid_pack_id bigint,
+ customer_profile_id bigint,
+ created_at timestamp without time zone NOT NULL,
+ updated_at timestamp without time zone NOT NULL
+);
+
+
+--
+-- Name: cart_item_prepaid_packs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.cart_item_prepaid_packs_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: cart_item_prepaid_packs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.cart_item_prepaid_packs_id_seq OWNED BY public.cart_item_prepaid_packs.id;
+
+
+--
+-- Name: cart_item_reservation_slots; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.cart_item_reservation_slots (
+ id bigint NOT NULL,
+ cart_item_type character varying,
+ cart_item_id bigint,
+ slot_id bigint,
+ slots_reservation_id bigint,
+ offered boolean DEFAULT false,
+ created_at timestamp without time zone NOT NULL,
+ updated_at timestamp without time zone NOT NULL
+);
+
+
+--
+-- Name: cart_item_reservation_slots_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.cart_item_reservation_slots_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: cart_item_reservation_slots_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.cart_item_reservation_slots_id_seq OWNED BY public.cart_item_reservation_slots.id;
+
+
+--
+-- Name: cart_item_reservations; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.cart_item_reservations (
+ id bigint NOT NULL,
+ reservable_type character varying,
+ reservable_id bigint,
+ plan_id bigint,
+ new_subscription boolean,
+ customer_profile_id bigint,
+ operator_profile_id bigint,
+ type character varying,
+ created_at timestamp without time zone NOT NULL,
+ updated_at timestamp without time zone NOT NULL
+);
+
+
+--
+-- Name: cart_item_reservations_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.cart_item_reservations_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: cart_item_reservations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.cart_item_reservations_id_seq OWNED BY public.cart_item_reservations.id;
+
+
+--
+-- Name: cart_item_subscriptions; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.cart_item_subscriptions (
+ id bigint NOT NULL,
+ plan_id bigint,
+ start_at timestamp without time zone,
+ customer_profile_id bigint,
+ created_at timestamp without time zone NOT NULL,
+ updated_at timestamp without time zone NOT NULL
+);
+
+
+--
+-- Name: cart_item_subscriptions_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.cart_item_subscriptions_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: cart_item_subscriptions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.cart_item_subscriptions_id_seq OWNED BY public.cart_item_subscriptions.id;
+
+
+--
+-- Name: categories; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.categories (
+ id integer NOT NULL,
+ name character varying,
+ created_at timestamp without time zone,
+ updated_at timestamp without time zone,
+ slug character varying
+);
+
+
+--
+-- Name: categories_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.categories_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: categories_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.categories_id_seq OWNED BY public.categories.id;
+
+
+--
+-- Name: components; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.components (
+ id integer NOT NULL,
+ name character varying NOT NULL
+);
+
+
+--
+-- Name: components_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.components_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: components_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.components_id_seq OWNED BY public.components.id;
+
+
+--
+-- Name: coupons; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.coupons (
+ id integer NOT NULL,
+ name character varying,
+ code character varying,
+ percent_off integer,
+ valid_until timestamp without time zone,
+ max_usages integer,
+ active boolean,
+ created_at timestamp without time zone NOT NULL,
+ updated_at timestamp without time zone NOT NULL,
+ validity_per_user character varying,
+ amount_off integer
+);
+
+
+--
+-- Name: coupons_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.coupons_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: coupons_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.coupons_id_seq OWNED BY public.coupons.id;
+
+
+--
+-- Name: credits; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.credits (
+ id integer NOT NULL,
+ creditable_type character varying,
+ creditable_id integer,
+ plan_id integer,
+ hours integer,
+ created_at timestamp without time zone,
+ updated_at timestamp without time zone
+);
+
+
+--
+-- Name: credits_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.credits_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: credits_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.credits_id_seq OWNED BY public.credits.id;
+
+
+--
+-- Name: custom_assets; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.custom_assets (
+ id integer NOT NULL,
+ name character varying,
+ created_at timestamp without time zone NOT NULL,
+ updated_at timestamp without time zone NOT NULL
+);
+
+
+--
+-- Name: custom_assets_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.custom_assets_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: custom_assets_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.custom_assets_id_seq OWNED BY public.custom_assets.id;
+
+
+--
+-- Name: database_providers; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.database_providers (
+ id integer NOT NULL,
+ created_at timestamp without time zone NOT NULL,
+ updated_at timestamp without time zone NOT NULL
+);
+
+
+--
+-- Name: database_providers_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.database_providers_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: database_providers_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.database_providers_id_seq OWNED BY public.database_providers.id;
+
+
+--
+-- Name: event_price_categories; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.event_price_categories (
+ id integer NOT NULL,
+ event_id integer,
+ price_category_id integer,
+ amount integer,
+ created_at timestamp without time zone NOT NULL,
+ updated_at timestamp without time zone NOT NULL
+);
+
+
+--
+-- Name: event_price_categories_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.event_price_categories_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: event_price_categories_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.event_price_categories_id_seq OWNED BY public.event_price_categories.id;
+
+
+--
+-- Name: event_themes; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.event_themes (
+ id integer NOT NULL,
+ name character varying,
+ created_at timestamp without time zone NOT NULL,
+ updated_at timestamp without time zone NOT NULL,
+ slug character varying
+);
+
+
+--
+-- Name: event_themes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.event_themes_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: event_themes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.event_themes_id_seq OWNED BY public.event_themes.id;
+
+
+--
+-- Name: events; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.events (
+ id integer NOT NULL,
+ title character varying,
+ description text,
+ created_at timestamp without time zone,
+ updated_at timestamp without time zone,
+ availability_id integer,
+ amount integer,
+ nb_total_places integer,
+ nb_free_places integer,
+ recurrence_id integer,
+ age_range_id integer,
+ category_id integer,
+ deleted_at timestamp without time zone
+);
+
+
+--
+-- Name: events_event_themes; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.events_event_themes (
+ id integer NOT NULL,
+ event_id integer,
+ event_theme_id integer
+);
+
+
+--
+-- Name: events_event_themes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.events_event_themes_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: events_event_themes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.events_event_themes_id_seq OWNED BY public.events_event_themes.id;
+
+
+--
+-- Name: events_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.events_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: events_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.events_id_seq OWNED BY public.events.id;
+
+
+--
+-- Name: exports; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.exports (
+ id integer NOT NULL,
+ category character varying,
+ export_type character varying,
+ query character varying,
+ created_at timestamp without time zone NOT NULL,
+ updated_at timestamp without time zone NOT NULL,
+ user_id integer,
+ key character varying,
+ extension character varying DEFAULT 'xlsx'::character varying
+);
+
+
+--
+-- Name: exports_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.exports_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: exports_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.exports_id_seq OWNED BY public.exports.id;
+
+
+--
+-- Name: footprint_debugs; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.footprint_debugs (
+ id bigint NOT NULL,
+ footprint character varying,
+ data character varying,
+ klass character varying,
+ created_at timestamp without time zone NOT NULL,
+ updated_at timestamp without time zone NOT NULL
+);
+
+
+--
+-- Name: footprint_debugs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.footprint_debugs_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: footprint_debugs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.footprint_debugs_id_seq OWNED BY public.footprint_debugs.id;
+
+
+--
+-- Name: friendly_id_slugs; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.friendly_id_slugs (
+ id integer NOT NULL,
+ slug character varying NOT NULL,
+ sluggable_id integer NOT NULL,
+ sluggable_type character varying(50),
+ scope character varying,
+ created_at timestamp without time zone
+);
+
+
+--
+-- Name: friendly_id_slugs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.friendly_id_slugs_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: friendly_id_slugs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.friendly_id_slugs_id_seq OWNED BY public.friendly_id_slugs.id;
+
+
+--
+-- Name: groups; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.groups (
+ id integer NOT NULL,
+ name character varying,
+ created_at timestamp without time zone,
+ updated_at timestamp without time zone,
+ slug character varying,
+ disabled boolean
+);
+
+
+--
+-- Name: groups_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.groups_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: groups_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.groups_id_seq OWNED BY public.groups.id;
+
+
+--
+-- Name: history_values; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.history_values (
+ id integer NOT NULL,
+ setting_id integer,
+ value character varying,
+ created_at timestamp without time zone NOT NULL,
+ updated_at timestamp without time zone NOT NULL,
+ footprint character varying,
+ invoicing_profile_id integer
+);
+
+
+--
+-- Name: history_values_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.history_values_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: history_values_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.history_values_id_seq OWNED BY public.history_values.id;
+
+
+--
+-- Name: i_calendar_events; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.i_calendar_events (
+ id integer NOT NULL,
+ uid character varying,
+ dtstart timestamp without time zone,
+ dtend timestamp without time zone,
+ summary character varying,
+ description character varying,
+ attendee character varying,
+ i_calendar_id integer,
+ created_at timestamp without time zone NOT NULL,
+ updated_at timestamp without time zone NOT NULL
+);
+
+
+--
+-- Name: i_calendar_events_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.i_calendar_events_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: i_calendar_events_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.i_calendar_events_id_seq OWNED BY public.i_calendar_events.id;
+
+
+--
+-- Name: i_calendars; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.i_calendars (
+ id integer NOT NULL,
+ url character varying,
+ name character varying,
+ color character varying,
+ text_color character varying,
+ text_hidden boolean,
+ created_at timestamp without time zone NOT NULL,
+ updated_at timestamp without time zone NOT NULL
+);
+
+
+--
+-- Name: i_calendars_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.i_calendars_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: i_calendars_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.i_calendars_id_seq OWNED BY public.i_calendars.id;
+
+
+--
+-- Name: imports; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.imports (
+ id integer NOT NULL,
+ user_id integer,
+ attachment character varying,
+ update_field character varying,
+ category character varying,
+ results text,
+ created_at timestamp without time zone NOT NULL,
+ updated_at timestamp without time zone NOT NULL
+);
+
+
+--
+-- Name: imports_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.imports_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: imports_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.imports_id_seq OWNED BY public.imports.id;
+
+
+--
+-- Name: invoice_items; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.invoice_items (
+ id integer NOT NULL,
+ invoice_id integer,
+ amount integer,
+ created_at timestamp without time zone,
+ updated_at timestamp without time zone,
+ description text,
+ invoice_item_id integer,
+ footprint character varying,
+ object_type character varying NOT NULL,
+ object_id bigint NOT NULL,
+ main boolean
+);
+
+
+--
+-- Name: invoice_items_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.invoice_items_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: invoice_items_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.invoice_items_id_seq OWNED BY public.invoice_items.id;
+
+
+--
+-- Name: invoices; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.invoices (
+ id integer NOT NULL,
+ total integer,
+ created_at timestamp without time zone,
+ updated_at timestamp without time zone,
+ reference character varying,
+ payment_method character varying,
+ avoir_date timestamp without time zone,
+ invoice_id integer,
+ type character varying,
+ subscription_to_expire boolean,
+ description text,
+ wallet_amount integer,
+ wallet_transaction_id integer,
+ coupon_id integer,
+ footprint character varying,
+ environment character varying,
+ invoicing_profile_id integer,
+ operator_profile_id integer,
+ statistic_profile_id integer
+);
+
+
+--
+-- Name: invoices_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.invoices_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: invoices_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.invoices_id_seq OWNED BY public.invoices.id;
+
+
+--
+-- Name: invoicing_profiles; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.invoicing_profiles (
+ id integer NOT NULL,
+ user_id integer,
+ first_name character varying,
+ last_name character varying,
+ email character varying,
+ created_at timestamp without time zone NOT NULL,
+ updated_at timestamp without time zone NOT NULL,
+ external_id character varying
+);
+
+
+--
+-- Name: invoicing_profiles_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.invoicing_profiles_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: invoicing_profiles_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.invoicing_profiles_id_seq OWNED BY public.invoicing_profiles.id;
+
+
+--
+-- Name: licences; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.licences (
+ id integer NOT NULL,
+ name character varying NOT NULL,
+ description text
+);
+
+
+--
+-- Name: licences_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.licences_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: licences_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.licences_id_seq OWNED BY public.licences.id;
+
+
+--
+-- Name: machine_categories; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.machine_categories (
+ id bigint NOT NULL,
+ name character varying,
+ created_at timestamp without time zone NOT NULL,
+ updated_at timestamp without time zone NOT NULL
+);
+
+
+--
+-- Name: machine_categories_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.machine_categories_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: machine_categories_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.machine_categories_id_seq OWNED BY public.machine_categories.id;
+
+
+--
+-- Name: machines; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.machines (
+ id integer NOT NULL,
+ name character varying NOT NULL,
+ description text,
+ spec text,
+ created_at timestamp without time zone,
+ updated_at timestamp without time zone,
+ slug character varying,
+ disabled boolean,
+ deleted_at timestamp without time zone,
+ machine_category_id bigint,
+ reservable boolean DEFAULT true
+);
+
+
+--
+-- Name: machines_availabilities; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.machines_availabilities (
+ id integer NOT NULL,
+ machine_id integer,
+ availability_id integer
+);
+
+
+--
+-- Name: machines_availabilities_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.machines_availabilities_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: machines_availabilities_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.machines_availabilities_id_seq OWNED BY public.machines_availabilities.id;
+
+
+--
+-- Name: machines_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.machines_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: machines_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.machines_id_seq OWNED BY public.machines.id;
+
+
+--
+-- Name: machines_products; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.machines_products (
+ product_id bigint NOT NULL,
+ machine_id bigint NOT NULL
+);
+
+
+--
+-- Name: notification_preferences; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.notification_preferences (
+ id bigint NOT NULL,
+ user_id bigint NOT NULL,
+ notification_type_id bigint NOT NULL,
+ in_system boolean DEFAULT true,
+ email boolean DEFAULT true,
+ created_at timestamp without time zone NOT NULL,
+ updated_at timestamp without time zone NOT NULL
+);
+
+
+--
+-- Name: notification_preferences_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.notification_preferences_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: notification_preferences_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.notification_preferences_id_seq OWNED BY public.notification_preferences.id;
+
+
+--
+-- Name: notification_types; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.notification_types (
+ id bigint NOT NULL,
+ name character varying NOT NULL,
+ category character varying NOT NULL,
+ is_configurable boolean NOT NULL,
+ created_at timestamp without time zone NOT NULL,
+ updated_at timestamp without time zone NOT NULL
+);
+
+
+--
+-- Name: notification_types_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.notification_types_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: notification_types_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.notification_types_id_seq OWNED BY public.notification_types.id;
+
+
+--
+-- Name: notifications; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.notifications (
+ id integer NOT NULL,
+ receiver_id integer,
+ attached_object_type character varying,
+ attached_object_id integer,
+ notification_type_id integer,
+ is_read boolean DEFAULT false,
+ created_at timestamp without time zone,
+ updated_at timestamp without time zone,
+ receiver_type character varying,
+ is_send boolean DEFAULT false,
+ meta_data jsonb DEFAULT '"{}"'::jsonb
+);
+
+
+--
+-- Name: notifications_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.notifications_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: notifications_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.notifications_id_seq OWNED BY public.notifications.id;
+
+
+--
+-- Name: o_auth2_providers; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.o_auth2_providers (
+ id integer NOT NULL,
+ base_url character varying,
+ token_endpoint character varying,
+ authorization_endpoint character varying,
+ client_id character varying,
+ client_secret character varying,
+ created_at timestamp without time zone NOT NULL,
+ updated_at timestamp without time zone NOT NULL,
+ profile_url character varying,
+ scopes character varying
+);
+
+
+--
+-- Name: o_auth2_providers_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.o_auth2_providers_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: o_auth2_providers_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.o_auth2_providers_id_seq OWNED BY public.o_auth2_providers.id;
+
+
+--
+-- Name: offer_days; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.offer_days (
+ id integer NOT NULL,
+ subscription_id integer,
+ start_at timestamp without time zone,
+ end_at timestamp without time zone,
+ created_at timestamp without time zone,
+ updated_at timestamp without time zone
+);
+
+
+--
+-- Name: offer_days_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.offer_days_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: offer_days_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.offer_days_id_seq OWNED BY public.offer_days.id;
+
+
+--
+-- Name: open_api_clients; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.open_api_clients (
+ id integer NOT NULL,
+ name character varying,
+ calls_count integer DEFAULT 0,
+ token character varying,
+ created_at timestamp without time zone NOT NULL,
+ updated_at timestamp without time zone NOT NULL
+);
+
+
+--
+-- Name: open_api_clients_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.open_api_clients_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: open_api_clients_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.open_api_clients_id_seq OWNED BY public.open_api_clients.id;
+
+
+--
+-- Name: open_id_connect_providers; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.open_id_connect_providers (
+ id bigint NOT NULL,
+ issuer character varying,
+ discovery boolean,
+ client_auth_method character varying,
+ scope character varying[],
+ response_type character varying,
+ response_mode character varying,
+ display character varying,
+ prompt character varying,
+ send_scope_to_token_endpoint boolean,
+ post_logout_redirect_uri character varying,
+ uid_field character varying,
+ client__identifier character varying,
+ client__secret character varying,
+ client__redirect_uri character varying,
+ client__scheme character varying,
+ client__host character varying,
+ client__port character varying,
+ client__authorization_endpoint character varying,
+ client__token_endpoint character varying,
+ client__userinfo_endpoint character varying,
+ client__jwks_uri character varying,
+ client__end_session_endpoint character varying,
+ profile_url character varying,
+ created_at timestamp without time zone NOT NULL,
+ updated_at timestamp without time zone NOT NULL
+);
+
+
+--
+-- Name: open_id_connect_providers_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.open_id_connect_providers_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: open_id_connect_providers_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.open_id_connect_providers_id_seq OWNED BY public.open_id_connect_providers.id;
+
+
+--
+-- Name: order_activities; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.order_activities (
+ id bigint NOT NULL,
+ order_id bigint,
+ operator_profile_id bigint,
+ activity_type character varying,
+ note text,
+ created_at timestamp without time zone NOT NULL,
+ updated_at timestamp without time zone NOT NULL
+);
+
+
+--
+-- Name: order_activities_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.order_activities_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: order_activities_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.order_activities_id_seq OWNED BY public.order_activities.id;
+
+
+--
+-- Name: order_items; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.order_items (
+ id bigint NOT NULL,
+ order_id bigint,
+ orderable_type character varying,
+ orderable_id bigint,
+ amount integer,
+ quantity integer,
+ is_offered boolean,
+ created_at timestamp without time zone NOT NULL,
+ updated_at timestamp without time zone NOT NULL
+);
+
+
+--
+-- Name: order_items_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.order_items_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: order_items_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.order_items_id_seq OWNED BY public.order_items.id;
+
+
+--
+-- Name: orders; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.orders (
+ id bigint NOT NULL,
+ statistic_profile_id bigint,
+ operator_profile_id integer,
+ token character varying,
+ reference character varying,
+ state character varying,
+ total integer,
+ created_at timestamp without time zone NOT NULL,
+ updated_at timestamp without time zone NOT NULL,
+ wallet_amount integer,
+ wallet_transaction_id integer,
+ payment_method character varying,
+ footprint character varying,
+ environment character varying,
+ coupon_id bigint,
+ paid_total integer,
+ invoice_id bigint
+);
+
+
+--
+-- Name: orders_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.orders_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: orders_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.orders_id_seq OWNED BY public.orders.id;
+
+
+--
+-- Name: organizations; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.organizations (
+ id integer NOT NULL,
+ name character varying,
+ created_at timestamp without time zone NOT NULL,
+ updated_at timestamp without time zone NOT NULL,
+ invoicing_profile_id integer
+);
+
+
+--
+-- Name: organizations_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.organizations_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: organizations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.organizations_id_seq OWNED BY public.organizations.id;
+
+
+--
+-- Name: payment_gateway_objects; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.payment_gateway_objects (
+ id bigint NOT NULL,
+ gateway_object_id character varying,
+ gateway_object_type character varying,
+ item_type character varying,
+ item_id bigint,
+ payment_gateway_object_id bigint
+);
+
+
+--
+-- Name: payment_gateway_objects_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.payment_gateway_objects_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: payment_gateway_objects_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.payment_gateway_objects_id_seq OWNED BY public.payment_gateway_objects.id;
+
+
+--
+-- Name: payment_schedule_items; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.payment_schedule_items (
+ id bigint NOT NULL,
+ amount integer,
+ due_date timestamp without time zone,
+ state character varying DEFAULT 'new'::character varying,
+ details jsonb DEFAULT '"{}"'::jsonb,
+ payment_method character varying,
+ client_secret character varying,
+ payment_schedule_id bigint,
+ invoice_id bigint,
+ footprint character varying,
+ created_at timestamp without time zone NOT NULL,
+ updated_at timestamp without time zone NOT NULL
+);
+
+
+--
+-- Name: payment_schedule_items_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.payment_schedule_items_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: payment_schedule_items_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.payment_schedule_items_id_seq OWNED BY public.payment_schedule_items.id;
+
+
+--
+-- Name: payment_schedule_objects; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.payment_schedule_objects (
+ id bigint NOT NULL,
+ object_type character varying,
+ object_id bigint,
+ payment_schedule_id bigint,
+ main boolean,
+ footprint character varying,
+ created_at timestamp without time zone NOT NULL,
+ updated_at timestamp without time zone NOT NULL
+);
+
+
+--
+-- Name: payment_schedule_objects_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.payment_schedule_objects_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: payment_schedule_objects_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.payment_schedule_objects_id_seq OWNED BY public.payment_schedule_objects.id;
+
+
+--
+-- Name: payment_schedules; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.payment_schedules (
+ id bigint NOT NULL,
+ total integer,
+ reference character varying,
+ payment_method character varying,
+ wallet_amount integer,
+ wallet_transaction_id bigint,
+ coupon_id bigint,
+ footprint character varying,
+ environment character varying,
+ invoicing_profile_id bigint,
+ statistic_profile_id bigint,
+ operator_profile_id bigint,
+ created_at timestamp without time zone NOT NULL,
+ updated_at timestamp without time zone NOT NULL,
+ start_at timestamp without time zone
+);
+
+
+--
+-- Name: payment_schedules_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.payment_schedules_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: payment_schedules_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.payment_schedules_id_seq OWNED BY public.payment_schedules.id;
+
+
+--
+-- Name: plan_categories; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.plan_categories (
+ id bigint NOT NULL,
+ name character varying,
+ weight integer,
+ created_at timestamp without time zone NOT NULL,
+ updated_at timestamp without time zone NOT NULL,
+ description text
+);
+
+
+--
+-- Name: plan_categories_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.plan_categories_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: plan_categories_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.plan_categories_id_seq OWNED BY public.plan_categories.id;
+
+
+--
+-- Name: plan_limitations; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.plan_limitations (
+ id bigint NOT NULL,
+ plan_id bigint NOT NULL,
+ limitable_type character varying NOT NULL,
+ limitable_id bigint NOT NULL,
+ "limit" integer DEFAULT 0 NOT NULL,
+ created_at timestamp without time zone NOT NULL,
+ updated_at timestamp without time zone NOT NULL
+);
+
+
+--
+-- Name: plan_limitations_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.plan_limitations_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: plan_limitations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.plan_limitations_id_seq OWNED BY public.plan_limitations.id;
+
+
+--
+-- Name: plans; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.plans (
+ id integer NOT NULL,
+ name character varying,
+ amount integer,
+ "interval" character varying,
+ group_id integer,
+ stp_plan_id character varying,
+ created_at timestamp without time zone,
+ updated_at timestamp without time zone,
+ training_credit_nb integer DEFAULT 0,
+ is_rolling boolean,
+ description text,
+ type character varying,
+ base_name character varying,
+ ui_weight integer DEFAULT 0,
+ interval_count integer DEFAULT 1,
+ slug character varying,
+ disabled boolean,
+ monthly_payment boolean,
+ plan_category_id bigint,
+ limiting boolean,
+ machines_visibility integer
+);
+
+
+--
+-- Name: plans_availabilities; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.plans_availabilities (
+ id integer NOT NULL,
+ plan_id integer,
+ availability_id integer
+);
+
+
+--
+-- Name: plans_availabilities_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.plans_availabilities_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: plans_availabilities_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.plans_availabilities_id_seq OWNED BY public.plans_availabilities.id;
+
+
+--
+-- Name: plans_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.plans_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: plans_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.plans_id_seq OWNED BY public.plans.id;
+
+
+--
+-- Name: prepaid_pack_reservations; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.prepaid_pack_reservations (
+ id bigint NOT NULL,
+ statistic_profile_prepaid_pack_id bigint,
+ reservation_id bigint,
+ consumed_minutes integer,
+ created_at timestamp without time zone NOT NULL,
+ updated_at timestamp without time zone NOT NULL
+);
+
+
+--
+-- Name: prepaid_pack_reservations_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.prepaid_pack_reservations_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: prepaid_pack_reservations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.prepaid_pack_reservations_id_seq OWNED BY public.prepaid_pack_reservations.id;
+
+
+--
+-- Name: prepaid_packs; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.prepaid_packs (
+ id bigint NOT NULL,
+ priceable_type character varying,
+ priceable_id bigint,
+ group_id bigint,
+ amount integer,
+ minutes integer,
+ validity_interval character varying,
+ validity_count integer,
+ disabled boolean,
+ created_at timestamp without time zone NOT NULL,
+ updated_at timestamp without time zone NOT NULL
+);
+
+
+--
+-- Name: prepaid_packs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.prepaid_packs_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: prepaid_packs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.prepaid_packs_id_seq OWNED BY public.prepaid_packs.id;
+
+
+--
+-- Name: price_categories; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.price_categories (
+ id integer NOT NULL,
+ name character varying,
+ conditions text,
+ created_at timestamp without time zone NOT NULL,
+ updated_at timestamp without time zone NOT NULL
+);
+
+
+--
+-- Name: price_categories_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.price_categories_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: price_categories_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.price_categories_id_seq OWNED BY public.price_categories.id;
+
+
+--
+-- Name: prices; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.prices (
+ id integer NOT NULL,
+ group_id integer,
+ plan_id integer,
+ priceable_type character varying,
+ priceable_id integer,
+ amount integer,
+ created_at timestamp without time zone NOT NULL,
+ updated_at timestamp without time zone NOT NULL,
+ duration integer DEFAULT 60
+);
+
+
+--
+-- Name: prices_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.prices_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: prices_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.prices_id_seq OWNED BY public.prices.id;
+
+
+--
+-- Name: product_categories; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.product_categories (
+ id bigint NOT NULL,
+ name character varying,
+ slug character varying,
+ parent_id integer,
+ "position" integer,
+ created_at timestamp without time zone NOT NULL,
+ updated_at timestamp without time zone NOT NULL
+);
+
+
+--
+-- Name: product_categories_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.product_categories_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: product_categories_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.product_categories_id_seq OWNED BY public.product_categories.id;
+
+
+--
+-- Name: product_stock_movements; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.product_stock_movements (
+ id bigint NOT NULL,
+ product_id bigint,
+ quantity integer,
+ reason character varying,
+ stock_type character varying,
+ remaining_stock integer,
+ date timestamp without time zone,
+ created_at timestamp without time zone NOT NULL,
+ updated_at timestamp without time zone NOT NULL,
+ order_item_id integer
+);
+
+
+--
+-- Name: product_stock_movements_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.product_stock_movements_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: product_stock_movements_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.product_stock_movements_id_seq OWNED BY public.product_stock_movements.id;
+
+
+--
+-- Name: products; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.products (
+ id bigint NOT NULL,
+ name character varying,
+ slug character varying,
+ sku character varying,
+ description text,
+ is_active boolean DEFAULT false,
+ product_category_id bigint,
+ amount integer,
+ quantity_min integer,
+ stock jsonb DEFAULT '{"external": 0, "internal": 0}'::jsonb,
+ low_stock_alert boolean DEFAULT false,
+ low_stock_threshold integer,
+ created_at timestamp without time zone NOT NULL,
+ updated_at timestamp without time zone NOT NULL
+);
+
+
+--
+-- Name: products_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.products_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: products_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.products_id_seq OWNED BY public.products.id;
+
+
+--
+-- Name: profile_custom_fields; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.profile_custom_fields (
+ id bigint NOT NULL,
+ label character varying,
+ required boolean DEFAULT false,
+ actived boolean DEFAULT false,
+ created_at timestamp without time zone NOT NULL,
+ updated_at timestamp without time zone NOT NULL
+);
+
+
+--
+-- Name: profile_custom_fields_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.profile_custom_fields_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: profile_custom_fields_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.profile_custom_fields_id_seq OWNED BY public.profile_custom_fields.id;
+
+
+--
+-- Name: profiles; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.profiles (
+ id integer NOT NULL,
+ user_id integer,
+ first_name character varying,
+ last_name character varying,
+ phone character varying,
+ interest text,
+ software_mastered text,
+ created_at timestamp without time zone,
+ updated_at timestamp without time zone,
+ facebook character varying,
+ twitter character varying,
+ google_plus character varying,
+ viadeo character varying,
+ linkedin character varying,
+ instagram character varying,
+ youtube character varying,
+ vimeo character varying,
+ dailymotion character varying,
+ github character varying,
+ echosciences character varying,
+ website character varying,
+ pinterest character varying,
+ lastfm character varying,
+ flickr character varying,
+ job character varying,
+ tours character varying,
+ note text
+);
+
+
+--
+-- Name: profiles_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.profiles_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: profiles_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.profiles_id_seq OWNED BY public.profiles.id;
+
+
+--
+-- Name: project_steps; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.project_steps (
+ id integer NOT NULL,
+ description text,
+ project_id integer,
+ created_at timestamp without time zone,
+ updated_at timestamp without time zone,
+ title character varying,
+ step_nb integer
+);
+
+
+--
+-- Name: project_steps_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.project_steps_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: project_steps_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.project_steps_id_seq OWNED BY public.project_steps.id;
+
+
+--
+-- Name: project_users; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.project_users (
+ id integer NOT NULL,
+ project_id integer,
+ user_id integer,
+ created_at timestamp without time zone,
+ updated_at timestamp without time zone,
+ is_valid boolean DEFAULT false,
+ valid_token character varying
+);
+
+
+--
+-- Name: project_users_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.project_users_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: project_users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.project_users_id_seq OWNED BY public.project_users.id;
+
+
+--
+-- Name: projects; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.projects (
+ id integer NOT NULL,
+ name character varying,
+ description text,
+ created_at timestamp without time zone,
+ updated_at timestamp without time zone,
+ tags text,
+ licence_id integer,
+ state character varying,
+ slug character varying,
+ published_at timestamp without time zone,
+ author_statistic_profile_id integer,
+ search_vector tsvector,
+ status_id bigint
+);
+
+
+--
+-- Name: projects_components; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.projects_components (
+ id integer NOT NULL,
+ project_id integer,
+ component_id integer
+);
+
+
+--
+-- Name: projects_components_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.projects_components_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: projects_components_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.projects_components_id_seq OWNED BY public.projects_components.id;
+
+
+--
+-- Name: projects_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.projects_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: projects_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.projects_id_seq OWNED BY public.projects.id;
+
+
+--
+-- Name: projects_machines; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.projects_machines (
+ id integer NOT NULL,
+ project_id integer,
+ machine_id integer
+);
+
+
+--
+-- Name: projects_machines_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.projects_machines_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: projects_machines_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.projects_machines_id_seq OWNED BY public.projects_machines.id;
+
+
+--
+-- Name: projects_spaces; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.projects_spaces (
+ id integer NOT NULL,
+ project_id integer,
+ space_id integer
+);
+
+
+--
+-- Name: projects_spaces_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.projects_spaces_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: projects_spaces_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.projects_spaces_id_seq OWNED BY public.projects_spaces.id;
+
+
+--
+-- Name: projects_themes; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.projects_themes (
+ id integer NOT NULL,
+ project_id integer,
+ theme_id integer
+);
+
+
+--
+-- Name: projects_themes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.projects_themes_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: projects_themes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.projects_themes_id_seq OWNED BY public.projects_themes.id;
+
+
+--
+-- Name: reservations; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.reservations (
+ id integer NOT NULL,
+ message text,
+ created_at timestamp without time zone,
+ updated_at timestamp without time zone,
+ reservable_type character varying,
+ reservable_id integer,
+ nb_reserve_places integer,
+ statistic_profile_id integer
+);
+
+
+--
+-- Name: reservations_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.reservations_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: reservations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.reservations_id_seq OWNED BY public.reservations.id;
+
+
+--
+-- Name: roles; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.roles (
+ id integer NOT NULL,
+ name character varying,
+ resource_type character varying,
+ resource_id integer,
+ created_at timestamp without time zone,
+ updated_at timestamp without time zone
+);
+
+
+--
+-- Name: roles_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.roles_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: roles_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.roles_id_seq OWNED BY public.roles.id;
+
+
+--
+-- Name: schema_migrations; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.schema_migrations (
+ version character varying NOT NULL
+);
+
+
+--
+-- Name: settings; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.settings (
+ id integer NOT NULL,
+ name character varying NOT NULL,
+ created_at timestamp without time zone NOT NULL,
+ updated_at timestamp without time zone NOT NULL
+);
+
+
+--
+-- Name: settings_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.settings_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: settings_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.settings_id_seq OWNED BY public.settings.id;
+
+
+--
+-- Name: slots; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.slots (
+ id integer NOT NULL,
+ start_at timestamp without time zone,
+ end_at timestamp without time zone,
+ created_at timestamp without time zone,
+ updated_at timestamp without time zone,
+ availability_id integer NOT NULL,
+ places jsonb DEFAULT '[]'::jsonb NOT NULL
+);
+
+
+--
+-- Name: slots_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.slots_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: slots_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.slots_id_seq OWNED BY public.slots.id;
+
+
+--
+-- Name: slots_reservations; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.slots_reservations (
+ id integer NOT NULL,
+ slot_id integer NOT NULL,
+ reservation_id integer NOT NULL,
+ ex_start_at timestamp without time zone,
+ ex_end_at timestamp without time zone,
+ canceled_at timestamp without time zone,
+ offered boolean DEFAULT false
+);
+
+
+--
+-- Name: slots_reservations_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.slots_reservations_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: slots_reservations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.slots_reservations_id_seq OWNED BY public.slots_reservations.id;
+
+
+--
+-- Name: spaces; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.spaces (
+ id integer NOT NULL,
+ name character varying,
+ default_places integer,
+ description text,
+ slug character varying,
+ created_at timestamp without time zone NOT NULL,
+ updated_at timestamp without time zone NOT NULL,
+ characteristics text,
+ disabled boolean,
+ deleted_at timestamp without time zone
+);
+
+
+--
+-- Name: spaces_availabilities; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.spaces_availabilities (
+ id integer NOT NULL,
+ space_id integer,
+ availability_id integer,
+ created_at timestamp without time zone NOT NULL,
+ updated_at timestamp without time zone NOT NULL
+);
+
+
+--
+-- Name: spaces_availabilities_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.spaces_availabilities_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: spaces_availabilities_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.spaces_availabilities_id_seq OWNED BY public.spaces_availabilities.id;
+
+
+--
+-- Name: spaces_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.spaces_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: spaces_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.spaces_id_seq OWNED BY public.spaces.id;
+
+
+--
+-- Name: statistic_custom_aggregations; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.statistic_custom_aggregations (
+ id integer NOT NULL,
+ query text,
+ statistic_type_id integer,
+ created_at timestamp without time zone NOT NULL,
+ updated_at timestamp without time zone NOT NULL,
+ field character varying,
+ es_index character varying,
+ es_type character varying
+);
+
+
+--
+-- Name: statistic_custom_aggregations_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.statistic_custom_aggregations_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: statistic_custom_aggregations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.statistic_custom_aggregations_id_seq OWNED BY public.statistic_custom_aggregations.id;
+
+
+--
+-- Name: statistic_fields; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.statistic_fields (
+ id integer NOT NULL,
+ statistic_index_id integer,
+ key character varying,
+ label character varying,
+ created_at timestamp without time zone,
+ updated_at timestamp without time zone,
+ data_type character varying
+);
+
+
+--
+-- Name: statistic_fields_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.statistic_fields_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: statistic_fields_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.statistic_fields_id_seq OWNED BY public.statistic_fields.id;
+
+
+--
+-- Name: statistic_graphs; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.statistic_graphs (
+ id integer NOT NULL,
+ statistic_index_id integer,
+ chart_type character varying,
+ "limit" integer,
+ created_at timestamp without time zone,
+ updated_at timestamp without time zone
+);
+
+
+--
+-- Name: statistic_graphs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.statistic_graphs_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: statistic_graphs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.statistic_graphs_id_seq OWNED BY public.statistic_graphs.id;
+
+
+--
+-- Name: statistic_indices; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.statistic_indices (
+ id integer NOT NULL,
+ es_type_key character varying,
+ label character varying,
+ created_at timestamp without time zone,
+ updated_at timestamp without time zone,
+ "table" boolean DEFAULT true,
+ ca boolean DEFAULT true
+);
+
+
+--
+-- Name: statistic_indices_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.statistic_indices_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: statistic_indices_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.statistic_indices_id_seq OWNED BY public.statistic_indices.id;
+
+
+--
+-- Name: statistic_profile_prepaid_packs; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.statistic_profile_prepaid_packs (
+ id bigint NOT NULL,
+ prepaid_pack_id bigint,
+ statistic_profile_id bigint,
+ minutes_used integer DEFAULT 0,
+ expires_at timestamp without time zone,
+ created_at timestamp without time zone NOT NULL,
+ updated_at timestamp without time zone NOT NULL
+);
+
+
+--
+-- Name: statistic_profile_prepaid_packs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.statistic_profile_prepaid_packs_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: statistic_profile_prepaid_packs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.statistic_profile_prepaid_packs_id_seq OWNED BY public.statistic_profile_prepaid_packs.id;
+
+
+--
+-- Name: statistic_profile_trainings; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.statistic_profile_trainings (
+ id integer NOT NULL,
+ statistic_profile_id integer,
+ training_id integer,
+ created_at timestamp without time zone NOT NULL,
+ updated_at timestamp without time zone NOT NULL
+);
+
+
+--
+-- Name: statistic_profile_trainings_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.statistic_profile_trainings_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: statistic_profile_trainings_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.statistic_profile_trainings_id_seq OWNED BY public.statistic_profile_trainings.id;
+
+
+--
+-- Name: statistic_profiles; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.statistic_profiles (
+ id integer NOT NULL,
+ gender boolean,
+ birthday date,
+ group_id integer,
+ user_id integer,
+ role_id integer,
+ created_at timestamp without time zone,
+ updated_at timestamp without time zone
+);
+
+
+--
+-- Name: statistic_profiles_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.statistic_profiles_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: statistic_profiles_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.statistic_profiles_id_seq OWNED BY public.statistic_profiles.id;
+
+
+--
+-- Name: statistic_sub_types; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.statistic_sub_types (
+ id integer NOT NULL,
+ key character varying,
+ label character varying,
+ created_at timestamp without time zone,
+ updated_at timestamp without time zone
+);
+
+
+--
+-- Name: statistic_sub_types_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.statistic_sub_types_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: statistic_sub_types_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.statistic_sub_types_id_seq OWNED BY public.statistic_sub_types.id;
+
+
+--
+-- Name: statistic_type_sub_types; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.statistic_type_sub_types (
+ id integer NOT NULL,
+ statistic_type_id integer,
+ statistic_sub_type_id integer,
+ created_at timestamp without time zone,
+ updated_at timestamp without time zone
+);
+
+
+--
+-- Name: statistic_type_sub_types_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.statistic_type_sub_types_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: statistic_type_sub_types_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.statistic_type_sub_types_id_seq OWNED BY public.statistic_type_sub_types.id;
+
+
+--
+-- Name: statistic_types; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.statistic_types (
+ id integer NOT NULL,
+ statistic_index_id integer,
+ key character varying,
+ label character varying,
+ graph boolean,
+ created_at timestamp without time zone,
+ updated_at timestamp without time zone,
+ simple boolean
+);
+
+
+--
+-- Name: statistic_types_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.statistic_types_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: statistic_types_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.statistic_types_id_seq OWNED BY public.statistic_types.id;
+
+
+--
+-- Name: statuses; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.statuses (
+ id bigint NOT NULL,
+ name character varying,
+ created_at timestamp without time zone NOT NULL,
+ updated_at timestamp without time zone NOT NULL
+);
+
+
+--
+-- Name: statuses_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.statuses_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: statuses_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.statuses_id_seq OWNED BY public.statuses.id;
+
+
+--
+-- Name: stylesheets; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.stylesheets (
+ id integer NOT NULL,
+ contents text,
+ created_at timestamp without time zone NOT NULL,
+ updated_at timestamp without time zone NOT NULL,
+ name character varying
+);
+
+
+--
+-- Name: stylesheets_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.stylesheets_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: stylesheets_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.stylesheets_id_seq OWNED BY public.stylesheets.id;
+
+
+--
+-- Name: subscriptions; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.subscriptions (
+ id integer NOT NULL,
+ plan_id integer,
+ created_at timestamp without time zone,
+ updated_at timestamp without time zone,
+ expiration_date timestamp without time zone,
+ canceled_at timestamp without time zone,
+ statistic_profile_id integer,
+ start_at timestamp without time zone
+);
+
+
+--
+-- Name: subscriptions_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.subscriptions_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: subscriptions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.subscriptions_id_seq OWNED BY public.subscriptions.id;
+
+
+--
+-- Name: supporting_document_files; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.supporting_document_files (
+ id bigint NOT NULL,
+ supporting_document_type_id bigint,
+ user_id bigint,
+ attachment character varying,
+ created_at timestamp without time zone NOT NULL,
+ updated_at timestamp without time zone NOT NULL
+);
+
+
+--
+-- Name: supporting_document_files_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.supporting_document_files_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: supporting_document_files_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.supporting_document_files_id_seq OWNED BY public.supporting_document_files.id;
+
+
+--
+-- Name: supporting_document_refusals; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.supporting_document_refusals (
+ id bigint NOT NULL,
+ user_id bigint,
+ operator_id integer,
+ message text,
+ created_at timestamp without time zone NOT NULL,
+ updated_at timestamp without time zone NOT NULL
+);
+
+
+--
+-- Name: supporting_document_refusals_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.supporting_document_refusals_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: supporting_document_refusals_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.supporting_document_refusals_id_seq OWNED BY public.supporting_document_refusals.id;
+
+
+--
+-- Name: supporting_document_refusals_types; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.supporting_document_refusals_types (
+ supporting_document_type_id bigint NOT NULL,
+ supporting_document_refusal_id bigint NOT NULL
+);
+
+
+--
+-- Name: supporting_document_types; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.supporting_document_types (
+ id bigint NOT NULL,
+ name character varying,
+ created_at timestamp without time zone NOT NULL,
+ updated_at timestamp without time zone NOT NULL
+);
+
+
+--
+-- Name: supporting_document_types_groups; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.supporting_document_types_groups (
+ id bigint NOT NULL,
+ supporting_document_type_id bigint,
+ group_id bigint,
+ created_at timestamp without time zone NOT NULL,
+ updated_at timestamp without time zone NOT NULL
+);
+
+
+--
+-- Name: supporting_document_types_groups_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.supporting_document_types_groups_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: supporting_document_types_groups_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.supporting_document_types_groups_id_seq OWNED BY public.supporting_document_types_groups.id;
+
+
+--
+-- Name: supporting_document_types_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.supporting_document_types_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: supporting_document_types_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.supporting_document_types_id_seq OWNED BY public.supporting_document_types.id;
+
+
+--
+-- Name: tags; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.tags (
+ id integer NOT NULL,
+ name character varying,
+ created_at timestamp without time zone NOT NULL,
+ updated_at timestamp without time zone NOT NULL
+);
+
+
+--
+-- Name: tags_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.tags_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: tags_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.tags_id_seq OWNED BY public.tags.id;
+
+
+--
+-- Name: themes; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.themes (
+ id integer NOT NULL,
+ name character varying NOT NULL
+);
+
+
+--
+-- Name: themes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.themes_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: themes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.themes_id_seq OWNED BY public.themes.id;
+
+
+--
+-- Name: tickets; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.tickets (
+ id integer NOT NULL,
+ reservation_id integer,
+ event_price_category_id integer,
+ booked integer,
+ created_at timestamp without time zone NOT NULL,
+ updated_at timestamp without time zone NOT NULL
+);
+
+
+--
+-- Name: tickets_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.tickets_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: tickets_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.tickets_id_seq OWNED BY public.tickets.id;
+
+
+--
+-- Name: trainings; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.trainings (
+ id integer NOT NULL,
+ name character varying,
+ created_at timestamp without time zone,
+ updated_at timestamp without time zone,
+ nb_total_places integer,
+ slug character varying,
+ description text,
+ public_page boolean DEFAULT true,
+ disabled boolean,
+ auto_cancel boolean,
+ auto_cancel_threshold integer,
+ auto_cancel_deadline integer,
+ "authorization" boolean,
+ authorization_period integer,
+ invalidation boolean,
+ invalidation_period integer
+);
+
+
+--
+-- Name: trainings_availabilities; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.trainings_availabilities (
+ id integer NOT NULL,
+ training_id integer,
+ availability_id integer,
+ created_at timestamp without time zone,
+ updated_at timestamp without time zone
+);
+
+
+--
+-- Name: trainings_availabilities_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.trainings_availabilities_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: trainings_availabilities_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.trainings_availabilities_id_seq OWNED BY public.trainings_availabilities.id;
+
+
+--
+-- Name: trainings_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.trainings_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: trainings_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.trainings_id_seq OWNED BY public.trainings.id;
+
+
+--
+-- Name: trainings_machines; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.trainings_machines (
+ id integer NOT NULL,
+ training_id integer,
+ machine_id integer
+);
+
+
+--
+-- Name: trainings_machines_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.trainings_machines_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: trainings_machines_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.trainings_machines_id_seq OWNED BY public.trainings_machines.id;
+
+
+--
+-- Name: trainings_pricings; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.trainings_pricings (
+ id integer NOT NULL,
+ group_id integer,
+ amount integer,
+ created_at timestamp without time zone,
+ updated_at timestamp without time zone,
+ training_id integer
+);
+
+
+--
+-- Name: trainings_pricings_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.trainings_pricings_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: trainings_pricings_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.trainings_pricings_id_seq OWNED BY public.trainings_pricings.id;
+
+
+--
+-- Name: user_profile_custom_fields; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.user_profile_custom_fields (
+ id bigint NOT NULL,
+ invoicing_profile_id bigint,
+ profile_custom_field_id bigint,
+ value character varying,
+ created_at timestamp without time zone NOT NULL,
+ updated_at timestamp without time zone NOT NULL
+);
+
+
+--
+-- Name: user_profile_custom_fields_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.user_profile_custom_fields_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: user_profile_custom_fields_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.user_profile_custom_fields_id_seq OWNED BY public.user_profile_custom_fields.id;
+
+
+--
+-- Name: user_tags; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.user_tags (
+ id integer NOT NULL,
+ user_id integer,
+ tag_id integer,
+ created_at timestamp without time zone NOT NULL,
+ updated_at timestamp without time zone NOT NULL
+);
+
+
+--
+-- Name: user_tags_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.user_tags_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: user_tags_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.user_tags_id_seq OWNED BY public.user_tags.id;
+
+
+--
+-- Name: users; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.users (
+ id integer NOT NULL,
+ email character varying DEFAULT ''::character varying NOT NULL,
+ encrypted_password character varying DEFAULT ''::character varying NOT NULL,
+ reset_password_token character varying,
+ reset_password_sent_at timestamp without time zone,
+ remember_created_at timestamp without time zone,
+ sign_in_count integer DEFAULT 0 NOT NULL,
+ current_sign_in_at timestamp without time zone,
+ last_sign_in_at timestamp without time zone,
+ confirmation_token character varying,
+ confirmed_at timestamp without time zone,
+ confirmation_sent_at timestamp without time zone,
+ unconfirmed_email character varying,
+ failed_attempts integer DEFAULT 0 NOT NULL,
+ unlock_token character varying,
+ locked_at timestamp without time zone,
+ created_at timestamp without time zone,
+ updated_at timestamp without time zone,
+ is_allow_contact boolean DEFAULT true,
+ group_id integer,
+ username character varying,
+ slug character varying,
+ is_active boolean DEFAULT true,
+ provider character varying,
+ uid character varying,
+ auth_token character varying,
+ merged_at timestamp without time zone,
+ is_allow_newsletter boolean,
+ current_sign_in_ip inet,
+ last_sign_in_ip inet,
+ mapped_from_sso character varying,
+ validated_at timestamp without time zone
+);
+
+
+--
+-- Name: users_credits; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.users_credits (
+ id integer NOT NULL,
+ user_id integer,
+ credit_id integer,
+ hours_used integer,
+ created_at timestamp without time zone,
+ updated_at timestamp without time zone
+);
+
+
+--
+-- Name: users_credits_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.users_credits_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: users_credits_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.users_credits_id_seq OWNED BY public.users_credits.id;
+
+
+--
+-- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.users_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.users_id_seq OWNED BY public.users.id;
+
+
+--
+-- Name: users_roles; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.users_roles (
+ user_id integer,
+ role_id integer
+);
+
+
+--
+-- Name: wallet_transactions; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.wallet_transactions (
+ id integer NOT NULL,
+ wallet_id integer,
+ transaction_type character varying,
+ amount integer,
+ created_at timestamp without time zone NOT NULL,
+ updated_at timestamp without time zone NOT NULL,
+ invoicing_profile_id integer
+);
+
+
+--
+-- Name: wallet_transactions_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.wallet_transactions_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: wallet_transactions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.wallet_transactions_id_seq OWNED BY public.wallet_transactions.id;
+
+
+--
+-- Name: wallets; Type: TABLE; Schema: public; Owner: -
+--
+
+CREATE TABLE public.wallets (
+ id integer NOT NULL,
+ amount integer DEFAULT 0,
+ created_at timestamp without time zone NOT NULL,
+ updated_at timestamp without time zone NOT NULL,
+ invoicing_profile_id integer
+);
+
+
+--
+-- Name: wallets_id_seq; Type: SEQUENCE; Schema: public; Owner: -
+--
+
+CREATE SEQUENCE public.wallets_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+
+--
+-- Name: wallets_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
+--
+
+ALTER SEQUENCE public.wallets_id_seq OWNED BY public.wallets.id;
+
+
+--
+-- Name: abuses id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.abuses ALTER COLUMN id SET DEFAULT nextval('public.abuses_id_seq'::regclass);
+
+
+--
+-- Name: accounting_lines id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.accounting_lines ALTER COLUMN id SET DEFAULT nextval('public.accounting_lines_id_seq'::regclass);
+
+
+--
+-- Name: accounting_periods id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.accounting_periods ALTER COLUMN id SET DEFAULT nextval('public.accounting_periods_id_seq'::regclass);
+
+
+--
+-- Name: addresses id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.addresses ALTER COLUMN id SET DEFAULT nextval('public.addresses_id_seq'::regclass);
+
+
+--
+-- Name: advanced_accountings id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.advanced_accountings ALTER COLUMN id SET DEFAULT nextval('public.advanced_accountings_id_seq'::regclass);
+
+
+--
+-- Name: age_ranges id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.age_ranges ALTER COLUMN id SET DEFAULT nextval('public.age_ranges_id_seq'::regclass);
+
+
+--
+-- Name: assets id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.assets ALTER COLUMN id SET DEFAULT nextval('public.assets_id_seq'::regclass);
+
+
+--
+-- Name: auth_provider_mappings id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.auth_provider_mappings ALTER COLUMN id SET DEFAULT nextval('public.auth_provider_mappings_id_seq'::regclass);
+
+
+--
+-- Name: auth_providers id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.auth_providers ALTER COLUMN id SET DEFAULT nextval('public.auth_providers_id_seq'::regclass);
+
+
+--
+-- Name: availabilities id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.availabilities ALTER COLUMN id SET DEFAULT nextval('public.availabilities_id_seq'::regclass);
+
+
+--
+-- Name: availability_tags id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.availability_tags ALTER COLUMN id SET DEFAULT nextval('public.availability_tags_id_seq'::regclass);
+
+
+--
+-- Name: cart_item_coupons id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.cart_item_coupons ALTER COLUMN id SET DEFAULT nextval('public.cart_item_coupons_id_seq'::regclass);
+
+
+--
+-- Name: cart_item_event_reservation_tickets id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.cart_item_event_reservation_tickets ALTER COLUMN id SET DEFAULT nextval('public.cart_item_event_reservation_tickets_id_seq'::regclass);
+
+
+--
+-- Name: cart_item_event_reservations id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.cart_item_event_reservations ALTER COLUMN id SET DEFAULT nextval('public.cart_item_event_reservations_id_seq'::regclass);
+
+
+--
+-- Name: cart_item_free_extensions id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.cart_item_free_extensions ALTER COLUMN id SET DEFAULT nextval('public.cart_item_free_extensions_id_seq'::regclass);
+
+
+--
+-- Name: cart_item_payment_schedules id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.cart_item_payment_schedules ALTER COLUMN id SET DEFAULT nextval('public.cart_item_payment_schedules_id_seq'::regclass);
+
+
+--
+-- Name: cart_item_prepaid_packs id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.cart_item_prepaid_packs ALTER COLUMN id SET DEFAULT nextval('public.cart_item_prepaid_packs_id_seq'::regclass);
+
+
+--
+-- Name: cart_item_reservation_slots id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.cart_item_reservation_slots ALTER COLUMN id SET DEFAULT nextval('public.cart_item_reservation_slots_id_seq'::regclass);
+
+
+--
+-- Name: cart_item_reservations id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.cart_item_reservations ALTER COLUMN id SET DEFAULT nextval('public.cart_item_reservations_id_seq'::regclass);
+
+
+--
+-- Name: cart_item_subscriptions id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.cart_item_subscriptions ALTER COLUMN id SET DEFAULT nextval('public.cart_item_subscriptions_id_seq'::regclass);
+
+
+--
+-- Name: categories id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.categories ALTER COLUMN id SET DEFAULT nextval('public.categories_id_seq'::regclass);
+
+
+--
+-- Name: components id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.components ALTER COLUMN id SET DEFAULT nextval('public.components_id_seq'::regclass);
+
+
+--
+-- Name: coupons id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.coupons ALTER COLUMN id SET DEFAULT nextval('public.coupons_id_seq'::regclass);
+
+
+--
+-- Name: credits id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.credits ALTER COLUMN id SET DEFAULT nextval('public.credits_id_seq'::regclass);
+
+
+--
+-- Name: custom_assets id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.custom_assets ALTER COLUMN id SET DEFAULT nextval('public.custom_assets_id_seq'::regclass);
+
+
+--
+-- Name: database_providers id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.database_providers ALTER COLUMN id SET DEFAULT nextval('public.database_providers_id_seq'::regclass);
+
+
+--
+-- Name: event_price_categories id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.event_price_categories ALTER COLUMN id SET DEFAULT nextval('public.event_price_categories_id_seq'::regclass);
+
+
+--
+-- Name: event_themes id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.event_themes ALTER COLUMN id SET DEFAULT nextval('public.event_themes_id_seq'::regclass);
+
+
+--
+-- Name: events id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.events ALTER COLUMN id SET DEFAULT nextval('public.events_id_seq'::regclass);
+
+
+--
+-- Name: events_event_themes id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.events_event_themes ALTER COLUMN id SET DEFAULT nextval('public.events_event_themes_id_seq'::regclass);
+
+
+--
+-- Name: exports id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.exports ALTER COLUMN id SET DEFAULT nextval('public.exports_id_seq'::regclass);
+
+
+--
+-- Name: footprint_debugs id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.footprint_debugs ALTER COLUMN id SET DEFAULT nextval('public.footprint_debugs_id_seq'::regclass);
+
+
+--
+-- Name: friendly_id_slugs id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.friendly_id_slugs ALTER COLUMN id SET DEFAULT nextval('public.friendly_id_slugs_id_seq'::regclass);
+
+
+--
+-- Name: groups id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.groups ALTER COLUMN id SET DEFAULT nextval('public.groups_id_seq'::regclass);
+
+
+--
+-- Name: history_values id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.history_values ALTER COLUMN id SET DEFAULT nextval('public.history_values_id_seq'::regclass);
+
+
+--
+-- Name: i_calendar_events id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.i_calendar_events ALTER COLUMN id SET DEFAULT nextval('public.i_calendar_events_id_seq'::regclass);
+
+
+--
+-- Name: i_calendars id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.i_calendars ALTER COLUMN id SET DEFAULT nextval('public.i_calendars_id_seq'::regclass);
+
+
+--
+-- Name: imports id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.imports ALTER COLUMN id SET DEFAULT nextval('public.imports_id_seq'::regclass);
+
+
+--
+-- Name: invoice_items id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.invoice_items ALTER COLUMN id SET DEFAULT nextval('public.invoice_items_id_seq'::regclass);
+
+
+--
+-- Name: invoices id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.invoices ALTER COLUMN id SET DEFAULT nextval('public.invoices_id_seq'::regclass);
+
+
+--
+-- Name: invoicing_profiles id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.invoicing_profiles ALTER COLUMN id SET DEFAULT nextval('public.invoicing_profiles_id_seq'::regclass);
+
+
+--
+-- Name: licences id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.licences ALTER COLUMN id SET DEFAULT nextval('public.licences_id_seq'::regclass);
+
+
+--
+-- Name: machine_categories id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.machine_categories ALTER COLUMN id SET DEFAULT nextval('public.machine_categories_id_seq'::regclass);
+
+
+--
+-- Name: machines id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.machines ALTER COLUMN id SET DEFAULT nextval('public.machines_id_seq'::regclass);
+
+
+--
+-- Name: machines_availabilities id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.machines_availabilities ALTER COLUMN id SET DEFAULT nextval('public.machines_availabilities_id_seq'::regclass);
+
+
+--
+-- Name: notification_preferences id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.notification_preferences ALTER COLUMN id SET DEFAULT nextval('public.notification_preferences_id_seq'::regclass);
+
+
+--
+-- Name: notification_types id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.notification_types ALTER COLUMN id SET DEFAULT nextval('public.notification_types_id_seq'::regclass);
+
+
+--
+-- Name: notifications id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.notifications ALTER COLUMN id SET DEFAULT nextval('public.notifications_id_seq'::regclass);
+
+
+--
+-- Name: o_auth2_providers id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.o_auth2_providers ALTER COLUMN id SET DEFAULT nextval('public.o_auth2_providers_id_seq'::regclass);
+
+
+--
+-- Name: offer_days id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.offer_days ALTER COLUMN id SET DEFAULT nextval('public.offer_days_id_seq'::regclass);
+
+
+--
+-- Name: open_api_clients id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.open_api_clients ALTER COLUMN id SET DEFAULT nextval('public.open_api_clients_id_seq'::regclass);
+
+
+--
+-- Name: open_id_connect_providers id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.open_id_connect_providers ALTER COLUMN id SET DEFAULT nextval('public.open_id_connect_providers_id_seq'::regclass);
+
+
+--
+-- Name: order_activities id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.order_activities ALTER COLUMN id SET DEFAULT nextval('public.order_activities_id_seq'::regclass);
+
+
+--
+-- Name: order_items id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.order_items ALTER COLUMN id SET DEFAULT nextval('public.order_items_id_seq'::regclass);
+
+
+--
+-- Name: orders id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.orders ALTER COLUMN id SET DEFAULT nextval('public.orders_id_seq'::regclass);
+
+
+--
+-- Name: organizations id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.organizations ALTER COLUMN id SET DEFAULT nextval('public.organizations_id_seq'::regclass);
+
+
+--
+-- Name: payment_gateway_objects id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.payment_gateway_objects ALTER COLUMN id SET DEFAULT nextval('public.payment_gateway_objects_id_seq'::regclass);
+
+
+--
+-- Name: payment_schedule_items id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.payment_schedule_items ALTER COLUMN id SET DEFAULT nextval('public.payment_schedule_items_id_seq'::regclass);
+
+
+--
+-- Name: payment_schedule_objects id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.payment_schedule_objects ALTER COLUMN id SET DEFAULT nextval('public.payment_schedule_objects_id_seq'::regclass);
+
+
+--
+-- Name: payment_schedules id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.payment_schedules ALTER COLUMN id SET DEFAULT nextval('public.payment_schedules_id_seq'::regclass);
+
+
+--
+-- Name: plan_categories id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.plan_categories ALTER COLUMN id SET DEFAULT nextval('public.plan_categories_id_seq'::regclass);
+
+
+--
+-- Name: plan_limitations id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.plan_limitations ALTER COLUMN id SET DEFAULT nextval('public.plan_limitations_id_seq'::regclass);
+
+
+--
+-- Name: plans id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.plans ALTER COLUMN id SET DEFAULT nextval('public.plans_id_seq'::regclass);
+
+
+--
+-- Name: plans_availabilities id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.plans_availabilities ALTER COLUMN id SET DEFAULT nextval('public.plans_availabilities_id_seq'::regclass);
+
+
+--
+-- Name: prepaid_pack_reservations id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.prepaid_pack_reservations ALTER COLUMN id SET DEFAULT nextval('public.prepaid_pack_reservations_id_seq'::regclass);
+
+
+--
+-- Name: prepaid_packs id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.prepaid_packs ALTER COLUMN id SET DEFAULT nextval('public.prepaid_packs_id_seq'::regclass);
+
+
+--
+-- Name: price_categories id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.price_categories ALTER COLUMN id SET DEFAULT nextval('public.price_categories_id_seq'::regclass);
+
+
+--
+-- Name: prices id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.prices ALTER COLUMN id SET DEFAULT nextval('public.prices_id_seq'::regclass);
+
+
+--
+-- Name: product_categories id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.product_categories ALTER COLUMN id SET DEFAULT nextval('public.product_categories_id_seq'::regclass);
+
+
+--
+-- Name: product_stock_movements id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.product_stock_movements ALTER COLUMN id SET DEFAULT nextval('public.product_stock_movements_id_seq'::regclass);
+
+
+--
+-- Name: products id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.products ALTER COLUMN id SET DEFAULT nextval('public.products_id_seq'::regclass);
+
+
+--
+-- Name: profile_custom_fields id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.profile_custom_fields ALTER COLUMN id SET DEFAULT nextval('public.profile_custom_fields_id_seq'::regclass);
+
+
+--
+-- Name: profiles id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.profiles ALTER COLUMN id SET DEFAULT nextval('public.profiles_id_seq'::regclass);
+
+
+--
+-- Name: project_steps id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.project_steps ALTER COLUMN id SET DEFAULT nextval('public.project_steps_id_seq'::regclass);
+
+
+--
+-- Name: project_users id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.project_users ALTER COLUMN id SET DEFAULT nextval('public.project_users_id_seq'::regclass);
+
+
+--
+-- Name: projects id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.projects ALTER COLUMN id SET DEFAULT nextval('public.projects_id_seq'::regclass);
+
+
+--
+-- Name: projects_components id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.projects_components ALTER COLUMN id SET DEFAULT nextval('public.projects_components_id_seq'::regclass);
+
+
+--
+-- Name: projects_machines id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.projects_machines ALTER COLUMN id SET DEFAULT nextval('public.projects_machines_id_seq'::regclass);
+
+
+--
+-- Name: projects_spaces id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.projects_spaces ALTER COLUMN id SET DEFAULT nextval('public.projects_spaces_id_seq'::regclass);
+
+
+--
+-- Name: projects_themes id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.projects_themes ALTER COLUMN id SET DEFAULT nextval('public.projects_themes_id_seq'::regclass);
+
+
+--
+-- Name: reservations id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.reservations ALTER COLUMN id SET DEFAULT nextval('public.reservations_id_seq'::regclass);
+
+
+--
+-- Name: roles id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.roles ALTER COLUMN id SET DEFAULT nextval('public.roles_id_seq'::regclass);
+
+
+--
+-- Name: settings id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.settings ALTER COLUMN id SET DEFAULT nextval('public.settings_id_seq'::regclass);
+
+
+--
+-- Name: slots id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.slots ALTER COLUMN id SET DEFAULT nextval('public.slots_id_seq'::regclass);
+
+
+--
+-- Name: slots_reservations id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.slots_reservations ALTER COLUMN id SET DEFAULT nextval('public.slots_reservations_id_seq'::regclass);
+
+
+--
+-- Name: spaces id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.spaces ALTER COLUMN id SET DEFAULT nextval('public.spaces_id_seq'::regclass);
+
+
+--
+-- Name: spaces_availabilities id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.spaces_availabilities ALTER COLUMN id SET DEFAULT nextval('public.spaces_availabilities_id_seq'::regclass);
+
+
+--
+-- Name: statistic_custom_aggregations id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.statistic_custom_aggregations ALTER COLUMN id SET DEFAULT nextval('public.statistic_custom_aggregations_id_seq'::regclass);
+
+
+--
+-- Name: statistic_fields id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.statistic_fields ALTER COLUMN id SET DEFAULT nextval('public.statistic_fields_id_seq'::regclass);
+
+
+--
+-- Name: statistic_graphs id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.statistic_graphs ALTER COLUMN id SET DEFAULT nextval('public.statistic_graphs_id_seq'::regclass);
+
+
+--
+-- Name: statistic_indices id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.statistic_indices ALTER COLUMN id SET DEFAULT nextval('public.statistic_indices_id_seq'::regclass);
+
+
+--
+-- Name: statistic_profile_prepaid_packs id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.statistic_profile_prepaid_packs ALTER COLUMN id SET DEFAULT nextval('public.statistic_profile_prepaid_packs_id_seq'::regclass);
+
+
+--
+-- Name: statistic_profile_trainings id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.statistic_profile_trainings ALTER COLUMN id SET DEFAULT nextval('public.statistic_profile_trainings_id_seq'::regclass);
+
+
+--
+-- Name: statistic_profiles id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.statistic_profiles ALTER COLUMN id SET DEFAULT nextval('public.statistic_profiles_id_seq'::regclass);
+
+
+--
+-- Name: statistic_sub_types id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.statistic_sub_types ALTER COLUMN id SET DEFAULT nextval('public.statistic_sub_types_id_seq'::regclass);
+
+
+--
+-- Name: statistic_type_sub_types id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.statistic_type_sub_types ALTER COLUMN id SET DEFAULT nextval('public.statistic_type_sub_types_id_seq'::regclass);
+
+
+--
+-- Name: statistic_types id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.statistic_types ALTER COLUMN id SET DEFAULT nextval('public.statistic_types_id_seq'::regclass);
+
+
+--
+-- Name: statuses id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.statuses ALTER COLUMN id SET DEFAULT nextval('public.statuses_id_seq'::regclass);
+
+
+--
+-- Name: stylesheets id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.stylesheets ALTER COLUMN id SET DEFAULT nextval('public.stylesheets_id_seq'::regclass);
+
+
+--
+-- Name: subscriptions id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.subscriptions ALTER COLUMN id SET DEFAULT nextval('public.subscriptions_id_seq'::regclass);
+
+
+--
+-- Name: supporting_document_files id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.supporting_document_files ALTER COLUMN id SET DEFAULT nextval('public.supporting_document_files_id_seq'::regclass);
+
+
+--
+-- Name: supporting_document_refusals id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.supporting_document_refusals ALTER COLUMN id SET DEFAULT nextval('public.supporting_document_refusals_id_seq'::regclass);
+
+
+--
+-- Name: supporting_document_types id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.supporting_document_types ALTER COLUMN id SET DEFAULT nextval('public.supporting_document_types_id_seq'::regclass);
+
+
+--
+-- Name: supporting_document_types_groups id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.supporting_document_types_groups ALTER COLUMN id SET DEFAULT nextval('public.supporting_document_types_groups_id_seq'::regclass);
+
+
+--
+-- Name: tags id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.tags ALTER COLUMN id SET DEFAULT nextval('public.tags_id_seq'::regclass);
+
+
+--
+-- Name: themes id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.themes ALTER COLUMN id SET DEFAULT nextval('public.themes_id_seq'::regclass);
+
+
+--
+-- Name: tickets id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.tickets ALTER COLUMN id SET DEFAULT nextval('public.tickets_id_seq'::regclass);
+
+
+--
+-- Name: trainings id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.trainings ALTER COLUMN id SET DEFAULT nextval('public.trainings_id_seq'::regclass);
+
+
+--
+-- Name: trainings_availabilities id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.trainings_availabilities ALTER COLUMN id SET DEFAULT nextval('public.trainings_availabilities_id_seq'::regclass);
+
+
+--
+-- Name: trainings_machines id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.trainings_machines ALTER COLUMN id SET DEFAULT nextval('public.trainings_machines_id_seq'::regclass);
+
+
+--
+-- Name: trainings_pricings id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.trainings_pricings ALTER COLUMN id SET DEFAULT nextval('public.trainings_pricings_id_seq'::regclass);
+
+
+--
+-- Name: user_profile_custom_fields id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.user_profile_custom_fields ALTER COLUMN id SET DEFAULT nextval('public.user_profile_custom_fields_id_seq'::regclass);
+
+
+--
+-- Name: user_tags id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.user_tags ALTER COLUMN id SET DEFAULT nextval('public.user_tags_id_seq'::regclass);
+
+
+--
+-- Name: users id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.users ALTER COLUMN id SET DEFAULT nextval('public.users_id_seq'::regclass);
+
+
+--
+-- Name: users_credits id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.users_credits ALTER COLUMN id SET DEFAULT nextval('public.users_credits_id_seq'::regclass);
+
+
+--
+-- Name: wallet_transactions id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.wallet_transactions ALTER COLUMN id SET DEFAULT nextval('public.wallet_transactions_id_seq'::regclass);
+
+
+--
+-- Name: wallets id; Type: DEFAULT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.wallets ALTER COLUMN id SET DEFAULT nextval('public.wallets_id_seq'::regclass);
+
+
+--
+-- Name: abuses abuses_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.abuses
+ ADD CONSTRAINT abuses_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: accounting_lines accounting_lines_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.accounting_lines
+ ADD CONSTRAINT accounting_lines_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: accounting_periods accounting_periods_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.accounting_periods
+ ADD CONSTRAINT accounting_periods_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: addresses addresses_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.addresses
+ ADD CONSTRAINT addresses_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: advanced_accountings advanced_accountings_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.advanced_accountings
+ ADD CONSTRAINT advanced_accountings_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: age_ranges age_ranges_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.age_ranges
+ ADD CONSTRAINT age_ranges_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: ar_internal_metadata ar_internal_metadata_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.ar_internal_metadata
+ ADD CONSTRAINT ar_internal_metadata_pkey PRIMARY KEY (key);
+
+
+--
+-- Name: assets assets_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.assets
+ ADD CONSTRAINT assets_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: auth_provider_mappings auth_provider_mappings_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.auth_provider_mappings
+ ADD CONSTRAINT auth_provider_mappings_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: auth_providers auth_providers_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.auth_providers
+ ADD CONSTRAINT auth_providers_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: availabilities availabilities_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.availabilities
+ ADD CONSTRAINT availabilities_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: availability_tags availability_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.availability_tags
+ ADD CONSTRAINT availability_tags_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: cart_item_coupons cart_item_coupons_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.cart_item_coupons
+ ADD CONSTRAINT cart_item_coupons_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: cart_item_event_reservation_tickets cart_item_event_reservation_tickets_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.cart_item_event_reservation_tickets
+ ADD CONSTRAINT cart_item_event_reservation_tickets_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: cart_item_event_reservations cart_item_event_reservations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.cart_item_event_reservations
+ ADD CONSTRAINT cart_item_event_reservations_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: cart_item_free_extensions cart_item_free_extensions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.cart_item_free_extensions
+ ADD CONSTRAINT cart_item_free_extensions_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: cart_item_payment_schedules cart_item_payment_schedules_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.cart_item_payment_schedules
+ ADD CONSTRAINT cart_item_payment_schedules_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: cart_item_prepaid_packs cart_item_prepaid_packs_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.cart_item_prepaid_packs
+ ADD CONSTRAINT cart_item_prepaid_packs_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: cart_item_reservation_slots cart_item_reservation_slots_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.cart_item_reservation_slots
+ ADD CONSTRAINT cart_item_reservation_slots_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: cart_item_reservations cart_item_reservations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.cart_item_reservations
+ ADD CONSTRAINT cart_item_reservations_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: cart_item_subscriptions cart_item_subscriptions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.cart_item_subscriptions
+ ADD CONSTRAINT cart_item_subscriptions_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: categories categories_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.categories
+ ADD CONSTRAINT categories_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: components components_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.components
+ ADD CONSTRAINT components_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: coupons coupons_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.coupons
+ ADD CONSTRAINT coupons_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: credits credits_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.credits
+ ADD CONSTRAINT credits_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: custom_assets custom_assets_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.custom_assets
+ ADD CONSTRAINT custom_assets_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: database_providers database_providers_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.database_providers
+ ADD CONSTRAINT database_providers_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: event_price_categories event_price_categories_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.event_price_categories
+ ADD CONSTRAINT event_price_categories_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: event_themes event_themes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.event_themes
+ ADD CONSTRAINT event_themes_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: events_event_themes events_event_themes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.events_event_themes
+ ADD CONSTRAINT events_event_themes_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: events events_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.events
+ ADD CONSTRAINT events_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: exports exports_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.exports
+ ADD CONSTRAINT exports_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: footprint_debugs footprint_debugs_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.footprint_debugs
+ ADD CONSTRAINT footprint_debugs_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: friendly_id_slugs friendly_id_slugs_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.friendly_id_slugs
+ ADD CONSTRAINT friendly_id_slugs_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: groups groups_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.groups
+ ADD CONSTRAINT groups_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: history_values history_values_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.history_values
+ ADD CONSTRAINT history_values_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: i_calendar_events i_calendar_events_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.i_calendar_events
+ ADD CONSTRAINT i_calendar_events_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: i_calendars i_calendars_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.i_calendars
+ ADD CONSTRAINT i_calendars_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: imports imports_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.imports
+ ADD CONSTRAINT imports_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: invoice_items invoice_items_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.invoice_items
+ ADD CONSTRAINT invoice_items_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: invoices invoices_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.invoices
+ ADD CONSTRAINT invoices_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: invoicing_profiles invoicing_profiles_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.invoicing_profiles
+ ADD CONSTRAINT invoicing_profiles_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: licences licences_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.licences
+ ADD CONSTRAINT licences_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: machine_categories machine_categories_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.machine_categories
+ ADD CONSTRAINT machine_categories_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: machines_availabilities machines_availabilities_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.machines_availabilities
+ ADD CONSTRAINT machines_availabilities_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: machines machines_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.machines
+ ADD CONSTRAINT machines_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: notification_preferences notification_preferences_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.notification_preferences
+ ADD CONSTRAINT notification_preferences_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: notification_types notification_types_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.notification_types
+ ADD CONSTRAINT notification_types_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: notifications notifications_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.notifications
+ ADD CONSTRAINT notifications_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: o_auth2_providers o_auth2_providers_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.o_auth2_providers
+ ADD CONSTRAINT o_auth2_providers_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: offer_days offer_days_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.offer_days
+ ADD CONSTRAINT offer_days_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: open_api_clients open_api_clients_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.open_api_clients
+ ADD CONSTRAINT open_api_clients_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: open_id_connect_providers open_id_connect_providers_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.open_id_connect_providers
+ ADD CONSTRAINT open_id_connect_providers_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: order_activities order_activities_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.order_activities
+ ADD CONSTRAINT order_activities_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: order_items order_items_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.order_items
+ ADD CONSTRAINT order_items_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: orders orders_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.orders
+ ADD CONSTRAINT orders_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: organizations organizations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.organizations
+ ADD CONSTRAINT organizations_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: payment_gateway_objects payment_gateway_objects_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.payment_gateway_objects
+ ADD CONSTRAINT payment_gateway_objects_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: payment_schedule_items payment_schedule_items_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.payment_schedule_items
+ ADD CONSTRAINT payment_schedule_items_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: payment_schedule_objects payment_schedule_objects_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.payment_schedule_objects
+ ADD CONSTRAINT payment_schedule_objects_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: payment_schedules payment_schedules_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.payment_schedules
+ ADD CONSTRAINT payment_schedules_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: plan_categories plan_categories_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.plan_categories
+ ADD CONSTRAINT plan_categories_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: plan_limitations plan_limitations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.plan_limitations
+ ADD CONSTRAINT plan_limitations_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: plans_availabilities plans_availabilities_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.plans_availabilities
+ ADD CONSTRAINT plans_availabilities_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: plans plans_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.plans
+ ADD CONSTRAINT plans_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: prepaid_pack_reservations prepaid_pack_reservations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.prepaid_pack_reservations
+ ADD CONSTRAINT prepaid_pack_reservations_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: prepaid_packs prepaid_packs_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.prepaid_packs
+ ADD CONSTRAINT prepaid_packs_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: price_categories price_categories_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.price_categories
+ ADD CONSTRAINT price_categories_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: prices prices_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.prices
+ ADD CONSTRAINT prices_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: product_categories product_categories_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.product_categories
+ ADD CONSTRAINT product_categories_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: product_stock_movements product_stock_movements_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.product_stock_movements
+ ADD CONSTRAINT product_stock_movements_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: products products_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.products
+ ADD CONSTRAINT products_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: profile_custom_fields profile_custom_fields_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.profile_custom_fields
+ ADD CONSTRAINT profile_custom_fields_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: profiles profiles_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.profiles
+ ADD CONSTRAINT profiles_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: project_steps project_steps_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.project_steps
+ ADD CONSTRAINT project_steps_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: project_users project_users_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.project_users
+ ADD CONSTRAINT project_users_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: projects_components projects_components_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.projects_components
+ ADD CONSTRAINT projects_components_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: projects_machines projects_machines_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.projects_machines
+ ADD CONSTRAINT projects_machines_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: projects projects_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.projects
+ ADD CONSTRAINT projects_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: projects_spaces projects_spaces_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.projects_spaces
+ ADD CONSTRAINT projects_spaces_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: projects_themes projects_themes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.projects_themes
+ ADD CONSTRAINT projects_themes_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: reservations reservations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.reservations
+ ADD CONSTRAINT reservations_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: roles roles_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.roles
+ ADD CONSTRAINT roles_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: schema_migrations schema_migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.schema_migrations
+ ADD CONSTRAINT schema_migrations_pkey PRIMARY KEY (version);
+
+
+--
+-- Name: settings settings_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.settings
+ ADD CONSTRAINT settings_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: slots slots_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.slots
+ ADD CONSTRAINT slots_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: slots_reservations slots_reservations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.slots_reservations
+ ADD CONSTRAINT slots_reservations_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: spaces_availabilities spaces_availabilities_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.spaces_availabilities
+ ADD CONSTRAINT spaces_availabilities_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: spaces spaces_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.spaces
+ ADD CONSTRAINT spaces_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: statistic_custom_aggregations statistic_custom_aggregations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.statistic_custom_aggregations
+ ADD CONSTRAINT statistic_custom_aggregations_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: statistic_fields statistic_fields_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.statistic_fields
+ ADD CONSTRAINT statistic_fields_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: statistic_graphs statistic_graphs_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.statistic_graphs
+ ADD CONSTRAINT statistic_graphs_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: statistic_indices statistic_indices_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.statistic_indices
+ ADD CONSTRAINT statistic_indices_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: statistic_profile_prepaid_packs statistic_profile_prepaid_packs_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.statistic_profile_prepaid_packs
+ ADD CONSTRAINT statistic_profile_prepaid_packs_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: statistic_profile_trainings statistic_profile_trainings_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.statistic_profile_trainings
+ ADD CONSTRAINT statistic_profile_trainings_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: statistic_profiles statistic_profiles_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.statistic_profiles
+ ADD CONSTRAINT statistic_profiles_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: statistic_sub_types statistic_sub_types_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.statistic_sub_types
+ ADD CONSTRAINT statistic_sub_types_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: statistic_type_sub_types statistic_type_sub_types_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.statistic_type_sub_types
+ ADD CONSTRAINT statistic_type_sub_types_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: statistic_types statistic_types_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.statistic_types
+ ADD CONSTRAINT statistic_types_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: statuses statuses_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.statuses
+ ADD CONSTRAINT statuses_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: stylesheets stylesheets_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.stylesheets
+ ADD CONSTRAINT stylesheets_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: subscriptions subscriptions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.subscriptions
+ ADD CONSTRAINT subscriptions_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: supporting_document_files supporting_document_files_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.supporting_document_files
+ ADD CONSTRAINT supporting_document_files_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: supporting_document_refusals supporting_document_refusals_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.supporting_document_refusals
+ ADD CONSTRAINT supporting_document_refusals_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: supporting_document_types_groups supporting_document_types_groups_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.supporting_document_types_groups
+ ADD CONSTRAINT supporting_document_types_groups_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: supporting_document_types supporting_document_types_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.supporting_document_types
+ ADD CONSTRAINT supporting_document_types_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: tags tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.tags
+ ADD CONSTRAINT tags_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: themes themes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.themes
+ ADD CONSTRAINT themes_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: tickets tickets_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.tickets
+ ADD CONSTRAINT tickets_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: trainings_availabilities trainings_availabilities_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.trainings_availabilities
+ ADD CONSTRAINT trainings_availabilities_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: trainings_machines trainings_machines_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.trainings_machines
+ ADD CONSTRAINT trainings_machines_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: trainings trainings_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.trainings
+ ADD CONSTRAINT trainings_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: trainings_pricings trainings_pricings_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.trainings_pricings
+ ADD CONSTRAINT trainings_pricings_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: user_profile_custom_fields user_profile_custom_fields_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.user_profile_custom_fields
+ ADD CONSTRAINT user_profile_custom_fields_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: user_tags user_tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.user_tags
+ ADD CONSTRAINT user_tags_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: users_credits users_credits_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.users_credits
+ ADD CONSTRAINT users_credits_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: users users_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.users
+ ADD CONSTRAINT users_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: wallet_transactions wallet_transactions_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.wallet_transactions
+ ADD CONSTRAINT wallet_transactions_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: wallets wallets_pkey; Type: CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.wallets
+ ADD CONSTRAINT wallets_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: index_abuses_on_signaled_type_and_signaled_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_abuses_on_signaled_type_and_signaled_id ON public.abuses USING btree (signaled_type, signaled_id);
+
+
+--
+-- Name: index_accounting_lines_on_invoice_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_accounting_lines_on_invoice_id ON public.accounting_lines USING btree (invoice_id);
+
+
+--
+-- Name: index_accounting_lines_on_invoicing_profile_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_accounting_lines_on_invoicing_profile_id ON public.accounting_lines USING btree (invoicing_profile_id);
+
+
+--
+-- Name: index_advanced_accountings_on_accountable; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_advanced_accountings_on_accountable ON public.advanced_accountings USING btree (accountable_type, accountable_id);
+
+
+--
+-- Name: index_age_ranges_on_slug; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE UNIQUE INDEX index_age_ranges_on_slug ON public.age_ranges USING btree (slug);
+
+
+--
+-- Name: index_auth_provider_mappings_on_auth_provider_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_auth_provider_mappings_on_auth_provider_id ON public.auth_provider_mappings USING btree (auth_provider_id);
+
+
+--
+-- Name: index_auth_providers_on_name; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE UNIQUE INDEX index_auth_providers_on_name ON public.auth_providers USING btree (name);
+
+
+--
+-- Name: index_availability_tags_on_availability_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_availability_tags_on_availability_id ON public.availability_tags USING btree (availability_id);
+
+
+--
+-- Name: index_availability_tags_on_tag_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_availability_tags_on_tag_id ON public.availability_tags USING btree (tag_id);
+
+
+--
+-- Name: index_cart_item_coupons_on_coupon_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_cart_item_coupons_on_coupon_id ON public.cart_item_coupons USING btree (coupon_id);
+
+
+--
+-- Name: index_cart_item_coupons_on_customer_profile_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_cart_item_coupons_on_customer_profile_id ON public.cart_item_coupons USING btree (customer_profile_id);
+
+
+--
+-- Name: index_cart_item_coupons_on_operator_profile_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_cart_item_coupons_on_operator_profile_id ON public.cart_item_coupons USING btree (operator_profile_id);
+
+
+--
+-- Name: index_cart_item_event_reservations_on_customer_profile_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_cart_item_event_reservations_on_customer_profile_id ON public.cart_item_event_reservations USING btree (customer_profile_id);
+
+
+--
+-- Name: index_cart_item_event_reservations_on_event_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_cart_item_event_reservations_on_event_id ON public.cart_item_event_reservations USING btree (event_id);
+
+
+--
+-- Name: index_cart_item_event_reservations_on_operator_profile_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_cart_item_event_reservations_on_operator_profile_id ON public.cart_item_event_reservations USING btree (operator_profile_id);
+
+
+--
+-- Name: index_cart_item_free_extensions_on_customer_profile_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_cart_item_free_extensions_on_customer_profile_id ON public.cart_item_free_extensions USING btree (customer_profile_id);
+
+
+--
+-- Name: index_cart_item_free_extensions_on_subscription_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_cart_item_free_extensions_on_subscription_id ON public.cart_item_free_extensions USING btree (subscription_id);
+
+
+--
+-- Name: index_cart_item_payment_schedules_on_coupon_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_cart_item_payment_schedules_on_coupon_id ON public.cart_item_payment_schedules USING btree (coupon_id);
+
+
+--
+-- Name: index_cart_item_payment_schedules_on_customer_profile_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_cart_item_payment_schedules_on_customer_profile_id ON public.cart_item_payment_schedules USING btree (customer_profile_id);
+
+
+--
+-- Name: index_cart_item_payment_schedules_on_plan_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_cart_item_payment_schedules_on_plan_id ON public.cart_item_payment_schedules USING btree (plan_id);
+
+
+--
+-- Name: index_cart_item_prepaid_packs_on_customer_profile_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_cart_item_prepaid_packs_on_customer_profile_id ON public.cart_item_prepaid_packs USING btree (customer_profile_id);
+
+
+--
+-- Name: index_cart_item_prepaid_packs_on_prepaid_pack_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_cart_item_prepaid_packs_on_prepaid_pack_id ON public.cart_item_prepaid_packs USING btree (prepaid_pack_id);
+
+
+--
+-- Name: index_cart_item_reservation_slots_on_slot_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_cart_item_reservation_slots_on_slot_id ON public.cart_item_reservation_slots USING btree (slot_id);
+
+
+--
+-- Name: index_cart_item_reservation_slots_on_slots_reservation_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_cart_item_reservation_slots_on_slots_reservation_id ON public.cart_item_reservation_slots USING btree (slots_reservation_id);
+
+
+--
+-- Name: index_cart_item_reservations_on_customer_profile_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_cart_item_reservations_on_customer_profile_id ON public.cart_item_reservations USING btree (customer_profile_id);
+
+
+--
+-- Name: index_cart_item_reservations_on_operator_profile_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_cart_item_reservations_on_operator_profile_id ON public.cart_item_reservations USING btree (operator_profile_id);
+
+
+--
+-- Name: index_cart_item_reservations_on_plan_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_cart_item_reservations_on_plan_id ON public.cart_item_reservations USING btree (plan_id);
+
+
+--
+-- Name: index_cart_item_reservations_on_reservable; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_cart_item_reservations_on_reservable ON public.cart_item_reservations USING btree (reservable_type, reservable_id);
+
+
+--
+-- Name: index_cart_item_slots_on_cart_item; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_cart_item_slots_on_cart_item ON public.cart_item_reservation_slots USING btree (cart_item_type, cart_item_id);
+
+
+--
+-- Name: index_cart_item_subscriptions_on_customer_profile_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_cart_item_subscriptions_on_customer_profile_id ON public.cart_item_subscriptions USING btree (customer_profile_id);
+
+
+--
+-- Name: index_cart_item_subscriptions_on_plan_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_cart_item_subscriptions_on_plan_id ON public.cart_item_subscriptions USING btree (plan_id);
+
+
+--
+-- Name: index_cart_item_tickets_on_cart_item_event_reservation; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_cart_item_tickets_on_cart_item_event_reservation ON public.cart_item_event_reservation_tickets USING btree (cart_item_event_reservation_id);
+
+
+--
+-- Name: index_cart_item_tickets_on_event_price_category; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_cart_item_tickets_on_event_price_category ON public.cart_item_event_reservation_tickets USING btree (event_price_category_id);
+
+
+--
+-- Name: index_categories_on_slug; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE UNIQUE INDEX index_categories_on_slug ON public.categories USING btree (slug);
+
+
+--
+-- Name: index_coupons_on_code; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE UNIQUE INDEX index_coupons_on_code ON public.coupons USING btree (code);
+
+
+--
+-- Name: index_credits_on_plan_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_credits_on_plan_id ON public.credits USING btree (plan_id);
+
+
+--
+-- Name: index_credits_on_plan_id_and_creditable_id_and_creditable_type; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE UNIQUE INDEX index_credits_on_plan_id_and_creditable_id_and_creditable_type ON public.credits USING btree (plan_id, creditable_id, creditable_type);
+
+
+--
+-- Name: index_event_price_categories_on_event_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_event_price_categories_on_event_id ON public.event_price_categories USING btree (event_id);
+
+
+--
+-- Name: index_event_price_categories_on_price_category_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_event_price_categories_on_price_category_id ON public.event_price_categories USING btree (price_category_id);
+
+
+--
+-- Name: index_event_themes_on_slug; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE UNIQUE INDEX index_event_themes_on_slug ON public.event_themes USING btree (slug);
+
+
+--
+-- Name: index_events_event_themes_on_event_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_events_event_themes_on_event_id ON public.events_event_themes USING btree (event_id);
+
+
+--
+-- Name: index_events_event_themes_on_event_theme_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_events_event_themes_on_event_theme_id ON public.events_event_themes USING btree (event_theme_id);
+
+
+--
+-- Name: index_events_on_availability_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_events_on_availability_id ON public.events USING btree (availability_id);
+
+
+--
+-- Name: index_events_on_category_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_events_on_category_id ON public.events USING btree (category_id);
+
+
+--
+-- Name: index_events_on_deleted_at; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_events_on_deleted_at ON public.events USING btree (deleted_at);
+
+
+--
+-- Name: index_events_on_recurrence_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_events_on_recurrence_id ON public.events USING btree (recurrence_id);
+
+
+--
+-- Name: index_exports_on_user_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_exports_on_user_id ON public.exports USING btree (user_id);
+
+
+--
+-- Name: index_friendly_id_slugs_on_slug_and_sluggable_type; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_friendly_id_slugs_on_slug_and_sluggable_type ON public.friendly_id_slugs USING btree (slug, sluggable_type);
+
+
+--
+-- Name: index_friendly_id_slugs_on_slug_and_sluggable_type_and_scope; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE UNIQUE INDEX index_friendly_id_slugs_on_slug_and_sluggable_type_and_scope ON public.friendly_id_slugs USING btree (slug, sluggable_type, scope);
+
+
+--
+-- Name: index_friendly_id_slugs_on_sluggable_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_friendly_id_slugs_on_sluggable_id ON public.friendly_id_slugs USING btree (sluggable_id);
+
+
+--
+-- Name: index_friendly_id_slugs_on_sluggable_type; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_friendly_id_slugs_on_sluggable_type ON public.friendly_id_slugs USING btree (sluggable_type);
+
+
+--
+-- Name: index_groups_on_slug; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE UNIQUE INDEX index_groups_on_slug ON public.groups USING btree (slug);
+
+
+--
+-- Name: index_history_values_on_invoicing_profile_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_history_values_on_invoicing_profile_id ON public.history_values USING btree (invoicing_profile_id);
+
+
+--
+-- Name: index_history_values_on_setting_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_history_values_on_setting_id ON public.history_values USING btree (setting_id);
+
+
+--
+-- Name: index_i_calendar_events_on_i_calendar_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_i_calendar_events_on_i_calendar_id ON public.i_calendar_events USING btree (i_calendar_id);
+
+
+--
+-- Name: index_invoice_items_on_invoice_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_invoice_items_on_invoice_id ON public.invoice_items USING btree (invoice_id);
+
+
+--
+-- Name: index_invoice_items_on_object_type_and_object_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_invoice_items_on_object_type_and_object_id ON public.invoice_items USING btree (object_type, object_id);
+
+
+--
+-- Name: index_invoices_on_coupon_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_invoices_on_coupon_id ON public.invoices USING btree (coupon_id);
+
+
+--
+-- Name: index_invoices_on_invoice_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_invoices_on_invoice_id ON public.invoices USING btree (invoice_id);
+
+
+--
+-- Name: index_invoices_on_invoicing_profile_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_invoices_on_invoicing_profile_id ON public.invoices USING btree (invoicing_profile_id);
+
+
+--
+-- Name: index_invoices_on_statistic_profile_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_invoices_on_statistic_profile_id ON public.invoices USING btree (statistic_profile_id);
+
+
+--
+-- Name: index_invoices_on_wallet_transaction_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_invoices_on_wallet_transaction_id ON public.invoices USING btree (wallet_transaction_id);
+
+
+--
+-- Name: index_invoicing_profiles_on_user_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_invoicing_profiles_on_user_id ON public.invoicing_profiles USING btree (user_id);
+
+
+--
+-- Name: index_machines_availabilities_on_availability_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_machines_availabilities_on_availability_id ON public.machines_availabilities USING btree (availability_id);
+
+
+--
+-- Name: index_machines_availabilities_on_machine_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_machines_availabilities_on_machine_id ON public.machines_availabilities USING btree (machine_id);
+
+
+--
+-- Name: index_machines_on_deleted_at; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_machines_on_deleted_at ON public.machines USING btree (deleted_at);
+
+
+--
+-- Name: index_machines_on_machine_category_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_machines_on_machine_category_id ON public.machines USING btree (machine_category_id);
+
+
+--
+-- Name: index_machines_on_slug; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE UNIQUE INDEX index_machines_on_slug ON public.machines USING btree (slug);
+
+
+--
+-- Name: index_notification_preferences_on_notification_type_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_notification_preferences_on_notification_type_id ON public.notification_preferences USING btree (notification_type_id);
+
+
+--
+-- Name: index_notification_preferences_on_user_and_notification_type; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE UNIQUE INDEX index_notification_preferences_on_user_and_notification_type ON public.notification_preferences USING btree (user_id, notification_type_id);
+
+
+--
+-- Name: index_notification_types_on_name; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE UNIQUE INDEX index_notification_types_on_name ON public.notification_types USING btree (name);
+
+
+--
+-- Name: index_notifications_on_notification_type_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_notifications_on_notification_type_id ON public.notifications USING btree (notification_type_id);
+
+
+--
+-- Name: index_notifications_on_receiver_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_notifications_on_receiver_id ON public.notifications USING btree (receiver_id);
+
+
+--
+-- Name: index_offer_days_on_subscription_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_offer_days_on_subscription_id ON public.offer_days USING btree (subscription_id);
+
+
+--
+-- Name: index_order_activities_on_operator_profile_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_order_activities_on_operator_profile_id ON public.order_activities USING btree (operator_profile_id);
+
+
+--
+-- Name: index_order_activities_on_order_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_order_activities_on_order_id ON public.order_activities USING btree (order_id);
+
+
+--
+-- Name: index_order_items_on_order_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_order_items_on_order_id ON public.order_items USING btree (order_id);
+
+
+--
+-- Name: index_order_items_on_orderable_type_and_orderable_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_order_items_on_orderable_type_and_orderable_id ON public.order_items USING btree (orderable_type, orderable_id);
+
+
+--
+-- Name: index_orders_on_coupon_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_orders_on_coupon_id ON public.orders USING btree (coupon_id);
+
+
+--
+-- Name: index_orders_on_invoice_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_orders_on_invoice_id ON public.orders USING btree (invoice_id);
+
+
+--
+-- Name: index_orders_on_operator_profile_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_orders_on_operator_profile_id ON public.orders USING btree (operator_profile_id);
+
+
+--
+-- Name: index_orders_on_statistic_profile_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_orders_on_statistic_profile_id ON public.orders USING btree (statistic_profile_id);
+
+
+--
+-- Name: index_organizations_on_invoicing_profile_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_organizations_on_invoicing_profile_id ON public.organizations USING btree (invoicing_profile_id);
+
+
+--
+-- Name: index_p_o_i_t_groups_on_group_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_p_o_i_t_groups_on_group_id ON public.supporting_document_types_groups USING btree (group_id);
+
+
+--
+-- Name: index_p_o_i_t_groups_on_proof_of_identity_type_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_p_o_i_t_groups_on_proof_of_identity_type_id ON public.supporting_document_types_groups USING btree (supporting_document_type_id);
+
+
+--
+-- Name: index_payment_gateway_objects_on_item_type_and_item_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_payment_gateway_objects_on_item_type_and_item_id ON public.payment_gateway_objects USING btree (item_type, item_id);
+
+
+--
+-- Name: index_payment_gateway_objects_on_payment_gateway_object_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_payment_gateway_objects_on_payment_gateway_object_id ON public.payment_gateway_objects USING btree (payment_gateway_object_id);
+
+
+--
+-- Name: index_payment_schedule_items_on_invoice_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_payment_schedule_items_on_invoice_id ON public.payment_schedule_items USING btree (invoice_id);
+
+
+--
+-- Name: index_payment_schedule_items_on_payment_schedule_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_payment_schedule_items_on_payment_schedule_id ON public.payment_schedule_items USING btree (payment_schedule_id);
+
+
+--
+-- Name: index_payment_schedule_objects_on_object_type_and_object_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_payment_schedule_objects_on_object_type_and_object_id ON public.payment_schedule_objects USING btree (object_type, object_id);
+
+
+--
+-- Name: index_payment_schedule_objects_on_payment_schedule_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_payment_schedule_objects_on_payment_schedule_id ON public.payment_schedule_objects USING btree (payment_schedule_id);
+
+
+--
+-- Name: index_payment_schedules_on_coupon_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_payment_schedules_on_coupon_id ON public.payment_schedules USING btree (coupon_id);
+
+
+--
+-- Name: index_payment_schedules_on_invoicing_profile_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_payment_schedules_on_invoicing_profile_id ON public.payment_schedules USING btree (invoicing_profile_id);
+
+
+--
+-- Name: index_payment_schedules_on_operator_profile_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_payment_schedules_on_operator_profile_id ON public.payment_schedules USING btree (operator_profile_id);
+
+
+--
+-- Name: index_payment_schedules_on_statistic_profile_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_payment_schedules_on_statistic_profile_id ON public.payment_schedules USING btree (statistic_profile_id);
+
+
+--
+-- Name: index_payment_schedules_on_wallet_transaction_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_payment_schedules_on_wallet_transaction_id ON public.payment_schedules USING btree (wallet_transaction_id);
+
+
+--
+-- Name: index_plan_limitations_on_limitable_type_and_limitable_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_plan_limitations_on_limitable_type_and_limitable_id ON public.plan_limitations USING btree (limitable_type, limitable_id);
+
+
+--
+-- Name: index_plan_limitations_on_plan_and_limitable; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE UNIQUE INDEX index_plan_limitations_on_plan_and_limitable ON public.plan_limitations USING btree (plan_id, limitable_id, limitable_type);
+
+
+--
+-- Name: index_plan_limitations_on_plan_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_plan_limitations_on_plan_id ON public.plan_limitations USING btree (plan_id);
+
+
+--
+-- Name: index_plans_availabilities_on_availability_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_plans_availabilities_on_availability_id ON public.plans_availabilities USING btree (availability_id);
+
+
+--
+-- Name: index_plans_availabilities_on_plan_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_plans_availabilities_on_plan_id ON public.plans_availabilities USING btree (plan_id);
+
+
+--
+-- Name: index_plans_on_group_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_plans_on_group_id ON public.plans USING btree (group_id);
+
+
+--
+-- Name: index_plans_on_plan_category_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_plans_on_plan_category_id ON public.plans USING btree (plan_category_id);
+
+
+--
+-- Name: index_prepaid_pack_reservations_on_reservation_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_prepaid_pack_reservations_on_reservation_id ON public.prepaid_pack_reservations USING btree (reservation_id);
+
+
+--
+-- Name: index_prepaid_pack_reservations_on_sp_prepaid_pack_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_prepaid_pack_reservations_on_sp_prepaid_pack_id ON public.prepaid_pack_reservations USING btree (statistic_profile_prepaid_pack_id);
+
+
+--
+-- Name: index_prepaid_packs_on_group_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_prepaid_packs_on_group_id ON public.prepaid_packs USING btree (group_id);
+
+
+--
+-- Name: index_prepaid_packs_on_priceable_type_and_priceable_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_prepaid_packs_on_priceable_type_and_priceable_id ON public.prepaid_packs USING btree (priceable_type, priceable_id);
+
+
+--
+-- Name: index_price_categories_on_name; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE UNIQUE INDEX index_price_categories_on_name ON public.price_categories USING btree (name);
+
+
+--
+-- Name: index_prices_on_group_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_prices_on_group_id ON public.prices USING btree (group_id);
+
+
+--
+-- Name: index_prices_on_plan_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_prices_on_plan_id ON public.prices USING btree (plan_id);
+
+
+--
+-- Name: index_prices_on_plan_priceable_group_and_duration; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE UNIQUE INDEX index_prices_on_plan_priceable_group_and_duration ON public.prices USING btree (plan_id, priceable_id, priceable_type, group_id, duration);
+
+
+--
+-- Name: index_prices_on_priceable_type_and_priceable_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_prices_on_priceable_type_and_priceable_id ON public.prices USING btree (priceable_type, priceable_id);
+
+
+--
+-- Name: index_product_categories_on_parent_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_product_categories_on_parent_id ON public.product_categories USING btree (parent_id);
+
+
+--
+-- Name: index_product_categories_on_slug; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE UNIQUE INDEX index_product_categories_on_slug ON public.product_categories USING btree (slug);
+
+
+--
+-- Name: index_product_stock_movements_on_product_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_product_stock_movements_on_product_id ON public.product_stock_movements USING btree (product_id);
+
+
+--
+-- Name: index_products_on_product_category_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_products_on_product_category_id ON public.products USING btree (product_category_id);
+
+
+--
+-- Name: index_products_on_slug; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE UNIQUE INDEX index_products_on_slug ON public.products USING btree (slug);
+
+
+--
+-- Name: index_profiles_on_user_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_profiles_on_user_id ON public.profiles USING btree (user_id);
+
+
+--
+-- Name: index_project_steps_on_project_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_project_steps_on_project_id ON public.project_steps USING btree (project_id);
+
+
+--
+-- Name: index_project_users_on_project_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_project_users_on_project_id ON public.project_users USING btree (project_id);
+
+
+--
+-- Name: index_project_users_on_user_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_project_users_on_user_id ON public.project_users USING btree (user_id);
+
+
+--
+-- Name: index_projects_components_on_component_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_projects_components_on_component_id ON public.projects_components USING btree (component_id);
+
+
+--
+-- Name: index_projects_components_on_project_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_projects_components_on_project_id ON public.projects_components USING btree (project_id);
+
+
+--
+-- Name: index_projects_machines_on_machine_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_projects_machines_on_machine_id ON public.projects_machines USING btree (machine_id);
+
+
+--
+-- Name: index_projects_machines_on_project_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_projects_machines_on_project_id ON public.projects_machines USING btree (project_id);
+
+
+--
+-- Name: index_projects_on_slug; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE UNIQUE INDEX index_projects_on_slug ON public.projects USING btree (slug);
+
+
+--
+-- Name: index_projects_on_status_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_projects_on_status_id ON public.projects USING btree (status_id);
+
+
+--
+-- Name: index_projects_spaces_on_project_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_projects_spaces_on_project_id ON public.projects_spaces USING btree (project_id);
+
+
+--
+-- Name: index_projects_spaces_on_space_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_projects_spaces_on_space_id ON public.projects_spaces USING btree (space_id);
+
+
+--
+-- Name: index_projects_themes_on_project_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_projects_themes_on_project_id ON public.projects_themes USING btree (project_id);
+
+
+--
+-- Name: index_projects_themes_on_theme_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_projects_themes_on_theme_id ON public.projects_themes USING btree (theme_id);
+
+
+--
+-- Name: index_reservations_on_reservable_type_and_reservable_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_reservations_on_reservable_type_and_reservable_id ON public.reservations USING btree (reservable_type, reservable_id);
+
+
+--
+-- Name: index_reservations_on_statistic_profile_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_reservations_on_statistic_profile_id ON public.reservations USING btree (statistic_profile_id);
+
+
+--
+-- Name: index_roles_on_name; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_roles_on_name ON public.roles USING btree (name);
+
+
+--
+-- Name: index_roles_on_name_and_resource_type_and_resource_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_roles_on_name_and_resource_type_and_resource_id ON public.roles USING btree (name, resource_type, resource_id);
+
+
+--
+-- Name: index_settings_on_name; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE UNIQUE INDEX index_settings_on_name ON public.settings USING btree (name);
+
+
+--
+-- Name: index_slots_on_availability_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_slots_on_availability_id ON public.slots USING btree (availability_id);
+
+
+--
+-- Name: index_slots_on_places; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_slots_on_places ON public.slots USING gin (places);
+
+
+--
+-- Name: index_slots_reservations_on_reservation_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_slots_reservations_on_reservation_id ON public.slots_reservations USING btree (reservation_id);
+
+
+--
+-- Name: index_slots_reservations_on_slot_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_slots_reservations_on_slot_id ON public.slots_reservations USING btree (slot_id);
+
+
+--
+-- Name: index_spaces_availabilities_on_availability_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_spaces_availabilities_on_availability_id ON public.spaces_availabilities USING btree (availability_id);
+
+
+--
+-- Name: index_spaces_availabilities_on_space_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_spaces_availabilities_on_space_id ON public.spaces_availabilities USING btree (space_id);
+
+
+--
+-- Name: index_spaces_on_deleted_at; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_spaces_on_deleted_at ON public.spaces USING btree (deleted_at);
+
+
+--
+-- Name: index_statistic_custom_aggregations_on_statistic_type_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_statistic_custom_aggregations_on_statistic_type_id ON public.statistic_custom_aggregations USING btree (statistic_type_id);
+
+
+--
+-- Name: index_statistic_fields_on_statistic_index_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_statistic_fields_on_statistic_index_id ON public.statistic_fields USING btree (statistic_index_id);
+
+
+--
+-- Name: index_statistic_graphs_on_statistic_index_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_statistic_graphs_on_statistic_index_id ON public.statistic_graphs USING btree (statistic_index_id);
+
+
+--
+-- Name: index_statistic_profile_prepaid_packs_on_prepaid_pack_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_statistic_profile_prepaid_packs_on_prepaid_pack_id ON public.statistic_profile_prepaid_packs USING btree (prepaid_pack_id);
+
+
+--
+-- Name: index_statistic_profile_prepaid_packs_on_statistic_profile_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_statistic_profile_prepaid_packs_on_statistic_profile_id ON public.statistic_profile_prepaid_packs USING btree (statistic_profile_id);
+
+
+--
+-- Name: index_statistic_profile_trainings_on_statistic_profile_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_statistic_profile_trainings_on_statistic_profile_id ON public.statistic_profile_trainings USING btree (statistic_profile_id);
+
+
+--
+-- Name: index_statistic_profile_trainings_on_training_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_statistic_profile_trainings_on_training_id ON public.statistic_profile_trainings USING btree (training_id);
+
+
+--
+-- Name: index_statistic_profiles_on_group_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_statistic_profiles_on_group_id ON public.statistic_profiles USING btree (group_id);
+
+
+--
+-- Name: index_statistic_profiles_on_role_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_statistic_profiles_on_role_id ON public.statistic_profiles USING btree (role_id);
+
+
+--
+-- Name: index_statistic_profiles_on_user_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_statistic_profiles_on_user_id ON public.statistic_profiles USING btree (user_id);
+
+
+--
+-- Name: index_statistic_type_sub_types_on_statistic_sub_type_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_statistic_type_sub_types_on_statistic_sub_type_id ON public.statistic_type_sub_types USING btree (statistic_sub_type_id);
+
+
+--
+-- Name: index_statistic_type_sub_types_on_statistic_type_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_statistic_type_sub_types_on_statistic_type_id ON public.statistic_type_sub_types USING btree (statistic_type_id);
+
+
+--
+-- Name: index_statistic_types_on_statistic_index_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_statistic_types_on_statistic_index_id ON public.statistic_types USING btree (statistic_index_id);
+
+
+--
+-- Name: index_subscriptions_on_plan_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_subscriptions_on_plan_id ON public.subscriptions USING btree (plan_id);
+
+
+--
+-- Name: index_subscriptions_on_statistic_profile_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_subscriptions_on_statistic_profile_id ON public.subscriptions USING btree (statistic_profile_id);
+
+
+--
+-- Name: index_supporting_document_files_on_supporting_document_type_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_supporting_document_files_on_supporting_document_type_id ON public.supporting_document_files USING btree (supporting_document_type_id);
+
+
+--
+-- Name: index_supporting_document_files_on_user_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_supporting_document_files_on_user_id ON public.supporting_document_files USING btree (user_id);
+
+
+--
+-- Name: index_supporting_document_refusals_on_user_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_supporting_document_refusals_on_user_id ON public.supporting_document_refusals USING btree (user_id);
+
+
+--
+-- Name: index_tags_on_name; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE UNIQUE INDEX index_tags_on_name ON public.tags USING btree (name);
+
+
+--
+-- Name: index_tickets_on_event_price_category_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_tickets_on_event_price_category_id ON public.tickets USING btree (event_price_category_id);
+
+
+--
+-- Name: index_tickets_on_reservation_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_tickets_on_reservation_id ON public.tickets USING btree (reservation_id);
+
+
+--
+-- Name: index_trainings_availabilities_on_availability_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_trainings_availabilities_on_availability_id ON public.trainings_availabilities USING btree (availability_id);
+
+
+--
+-- Name: index_trainings_availabilities_on_training_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_trainings_availabilities_on_training_id ON public.trainings_availabilities USING btree (training_id);
+
+
+--
+-- Name: index_trainings_machines_on_machine_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_trainings_machines_on_machine_id ON public.trainings_machines USING btree (machine_id);
+
+
+--
+-- Name: index_trainings_machines_on_training_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_trainings_machines_on_training_id ON public.trainings_machines USING btree (training_id);
+
+
+--
+-- Name: index_trainings_on_slug; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE UNIQUE INDEX index_trainings_on_slug ON public.trainings USING btree (slug);
+
+
+--
+-- Name: index_trainings_pricings_on_group_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_trainings_pricings_on_group_id ON public.trainings_pricings USING btree (group_id);
+
+
+--
+-- Name: index_trainings_pricings_on_training_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_trainings_pricings_on_training_id ON public.trainings_pricings USING btree (training_id);
+
+
+--
+-- Name: index_user_profile_custom_fields_on_invoicing_profile_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_user_profile_custom_fields_on_invoicing_profile_id ON public.user_profile_custom_fields USING btree (invoicing_profile_id);
+
+
+--
+-- Name: index_user_profile_custom_fields_on_profile_custom_field_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_user_profile_custom_fields_on_profile_custom_field_id ON public.user_profile_custom_fields USING btree (profile_custom_field_id);
+
+
+--
+-- Name: index_user_tags_on_tag_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_user_tags_on_tag_id ON public.user_tags USING btree (tag_id);
+
+
+--
+-- Name: index_user_tags_on_user_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_user_tags_on_user_id ON public.user_tags USING btree (user_id);
+
+
+--
+-- Name: index_users_credits_on_credit_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_users_credits_on_credit_id ON public.users_credits USING btree (credit_id);
+
+
+--
+-- Name: index_users_credits_on_user_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_users_credits_on_user_id ON public.users_credits USING btree (user_id);
+
+
+--
+-- Name: index_users_on_auth_token; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_users_on_auth_token ON public.users USING btree (auth_token);
+
+
+--
+-- Name: index_users_on_confirmation_token; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE UNIQUE INDEX index_users_on_confirmation_token ON public.users USING btree (confirmation_token);
+
+
+--
+-- Name: index_users_on_email; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE UNIQUE INDEX index_users_on_email ON public.users USING btree (email);
+
+
+--
+-- Name: index_users_on_group_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_users_on_group_id ON public.users USING btree (group_id);
+
+
+--
+-- Name: index_users_on_provider; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_users_on_provider ON public.users USING btree (provider);
+
+
+--
+-- Name: index_users_on_reset_password_token; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE UNIQUE INDEX index_users_on_reset_password_token ON public.users USING btree (reset_password_token);
+
+
+--
+-- Name: index_users_on_slug; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE UNIQUE INDEX index_users_on_slug ON public.users USING btree (slug);
+
+
+--
+-- Name: index_users_on_uid; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_users_on_uid ON public.users USING btree (uid);
+
+
+--
+-- Name: index_users_on_unlock_token; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE UNIQUE INDEX index_users_on_unlock_token ON public.users USING btree (unlock_token);
+
+
+--
+-- Name: index_users_on_username; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE UNIQUE INDEX index_users_on_username ON public.users USING btree (username);
+
+
+--
+-- Name: index_users_roles_on_user_id_and_role_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_users_roles_on_user_id_and_role_id ON public.users_roles USING btree (user_id, role_id);
+
+
+--
+-- Name: index_wallet_transactions_on_invoicing_profile_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_wallet_transactions_on_invoicing_profile_id ON public.wallet_transactions USING btree (invoicing_profile_id);
+
+
+--
+-- Name: index_wallet_transactions_on_wallet_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_wallet_transactions_on_wallet_id ON public.wallet_transactions USING btree (wallet_id);
+
+
+--
+-- Name: index_wallets_on_invoicing_profile_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_wallets_on_invoicing_profile_id ON public.wallets USING btree (invoicing_profile_id);
+
+
+--
+-- Name: profiles_lower_unaccent_first_name_trgm_idx; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX profiles_lower_unaccent_first_name_trgm_idx ON public.profiles USING gin (lower(public.f_unaccent((first_name)::text)) public.gin_trgm_ops);
+
+
+--
+-- Name: profiles_lower_unaccent_last_name_trgm_idx; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX profiles_lower_unaccent_last_name_trgm_idx ON public.profiles USING gin (lower(public.f_unaccent((last_name)::text)) public.gin_trgm_ops);
+
+
+--
+-- Name: projects_search_vector_idx; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX projects_search_vector_idx ON public.projects USING gin (search_vector);
+
+
+--
+-- Name: proof_of_identity_type_id_and_proof_of_identity_refusal_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX proof_of_identity_type_id_and_proof_of_identity_refusal_id ON public.supporting_document_refusals_types USING btree (supporting_document_type_id, supporting_document_refusal_id);
+
+
+--
+-- Name: unique_not_null_external_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE UNIQUE INDEX unique_not_null_external_id ON public.invoicing_profiles USING btree (external_id) WHERE (external_id IS NOT NULL);
+
+
+--
+-- Name: accounting_periods accounting_periods_upd_protect; Type: RULE; Schema: public; Owner: -
+--
+
+CREATE RULE accounting_periods_upd_protect AS
+ ON UPDATE TO public.accounting_periods
+ WHERE ((new.start_at <> old.start_at) OR (new.end_at <> old.end_at) OR (new.closed_at <> old.closed_at) OR (new.period_total <> old.period_total) OR (new.perpetual_total <> old.perpetual_total)) DO INSTEAD NOTHING;
+
+
+--
+-- Name: projects projects_search_content_trigger; Type: TRIGGER; Schema: public; Owner: -
+--
+
+CREATE TRIGGER projects_search_content_trigger BEFORE INSERT OR UPDATE ON public.projects FOR EACH ROW EXECUTE PROCEDURE public.fill_search_vector_for_project();
+
+
+--
+-- Name: payment_schedules fk_rails_00308dc223; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.payment_schedules
+ ADD CONSTRAINT fk_rails_00308dc223 FOREIGN KEY (wallet_transaction_id) REFERENCES public.wallet_transactions(id);
+
+
+--
+-- Name: cart_item_free_extensions fk_rails_0d11862969; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.cart_item_free_extensions
+ ADD CONSTRAINT fk_rails_0d11862969 FOREIGN KEY (customer_profile_id) REFERENCES public.invoicing_profiles(id);
+
+
+--
+-- Name: tickets fk_rails_0efe03a510; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.tickets
+ ADD CONSTRAINT fk_rails_0efe03a510 FOREIGN KEY (event_price_category_id) REFERENCES public.event_price_categories(id);
+
+
+--
+-- Name: invoicing_profiles fk_rails_122b1ddaf2; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.invoicing_profiles
+ ADD CONSTRAINT fk_rails_122b1ddaf2 FOREIGN KEY (user_id) REFERENCES public.users(id);
+
+
+--
+-- Name: invoices fk_rails_13888eebf0; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.invoices
+ ADD CONSTRAINT fk_rails_13888eebf0 FOREIGN KEY (statistic_profile_id) REFERENCES public.statistic_profiles(id);
+
+
+--
+-- Name: wallet_transactions fk_rails_1548249e6b; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.wallet_transactions
+ ADD CONSTRAINT fk_rails_1548249e6b FOREIGN KEY (invoicing_profile_id) REFERENCES public.invoicing_profiles(id);
+
+
+--
+-- Name: cart_item_event_reservation_tickets fk_rails_17315e88ac; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.cart_item_event_reservation_tickets
+ ADD CONSTRAINT fk_rails_17315e88ac FOREIGN KEY (event_price_category_id) REFERENCES public.event_price_categories(id);
+
+
+--
+-- Name: statistic_custom_aggregations fk_rails_1742c38664; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.statistic_custom_aggregations
+ ADD CONSTRAINT fk_rails_1742c38664 FOREIGN KEY (statistic_type_id) REFERENCES public.statistic_types(id);
+
+
+--
+-- Name: cart_item_coupons fk_rails_1a058c9deb; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.cart_item_coupons
+ ADD CONSTRAINT fk_rails_1a058c9deb FOREIGN KEY (coupon_id) REFERENCES public.coupons(id);
+
+
+--
+-- Name: project_users fk_rails_1bf16ed5d0; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.project_users
+ ADD CONSTRAINT fk_rails_1bf16ed5d0 FOREIGN KEY (project_id) REFERENCES public.projects(id);
+
+
+--
+-- Name: history_values fk_rails_1c79bec847; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.history_values
+ ADD CONSTRAINT fk_rails_1c79bec847 FOREIGN KEY (setting_id) REFERENCES public.settings(id);
+
+
+--
+-- Name: prepaid_pack_reservations fk_rails_1d1e8ca696; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.prepaid_pack_reservations
+ ADD CONSTRAINT fk_rails_1d1e8ca696 FOREIGN KEY (reservation_id) REFERENCES public.reservations(id);
+
+
+--
+-- Name: cart_item_reservations fk_rails_2384b7ab3d; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.cart_item_reservations
+ ADD CONSTRAINT fk_rails_2384b7ab3d FOREIGN KEY (customer_profile_id) REFERENCES public.invoicing_profiles(id);
+
+
+--
+-- Name: prices fk_rails_2385efc06e; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.prices
+ ADD CONSTRAINT fk_rails_2385efc06e FOREIGN KEY (group_id) REFERENCES public.groups(id);
+
+
+--
+-- Name: slots_reservations fk_rails_246639af41; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.slots_reservations
+ ADD CONSTRAINT fk_rails_246639af41 FOREIGN KEY (reservation_id) REFERENCES public.reservations(id);
+
+
+--
+-- Name: i_calendar_events fk_rails_25e5a14f12; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.i_calendar_events
+ ADD CONSTRAINT fk_rails_25e5a14f12 FOREIGN KEY (i_calendar_id) REFERENCES public.i_calendars(id);
+
+
+--
+-- Name: plan_limitations fk_rails_2673f3a894; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.plan_limitations
+ ADD CONSTRAINT fk_rails_2673f3a894 FOREIGN KEY (plan_id) REFERENCES public.plans(id);
+
+
+--
+-- Name: exports fk_rails_26b155474a; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.exports
+ ADD CONSTRAINT fk_rails_26b155474a FOREIGN KEY (user_id) REFERENCES public.users(id);
+
+
+--
+-- Name: payment_schedules fk_rails_27cdd051f7; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.payment_schedules
+ ADD CONSTRAINT fk_rails_27cdd051f7 FOREIGN KEY (statistic_profile_id) REFERENCES public.statistic_profiles(id);
+
+
+--
+-- Name: payment_gateway_objects fk_rails_2a54622221; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.payment_gateway_objects
+ ADD CONSTRAINT fk_rails_2a54622221 FOREIGN KEY (payment_gateway_object_id) REFERENCES public.payment_gateway_objects(id);
+
+
+--
+-- Name: accounting_lines fk_rails_2b624271e3; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.accounting_lines
+ ADD CONSTRAINT fk_rails_2b624271e3 FOREIGN KEY (invoicing_profile_id) REFERENCES public.invoicing_profiles(id);
+
+
+--
+-- Name: statistic_profiles fk_rails_2c8874d1a1; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.statistic_profiles
+ ADD CONSTRAINT fk_rails_2c8874d1a1 FOREIGN KEY (user_id) REFERENCES public.users(id);
+
+
+--
+-- Name: invoices fk_rails_2f06166181; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.invoices
+ ADD CONSTRAINT fk_rails_2f06166181 FOREIGN KEY (wallet_transaction_id) REFERENCES public.wallet_transactions(id);
+
+
+--
+-- Name: cart_item_event_reservations fk_rails_302f96c6bf; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.cart_item_event_reservations
+ ADD CONSTRAINT fk_rails_302f96c6bf FOREIGN KEY (customer_profile_id) REFERENCES public.invoicing_profiles(id);
+
+
+--
+-- Name: cart_item_payment_schedules fk_rails_34a6d5887a; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.cart_item_payment_schedules
+ ADD CONSTRAINT fk_rails_34a6d5887a FOREIGN KEY (customer_profile_id) REFERENCES public.invoicing_profiles(id);
+
+
+--
+-- Name: subscriptions fk_rails_358a71f738; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.subscriptions
+ ADD CONSTRAINT fk_rails_358a71f738 FOREIGN KEY (statistic_profile_id) REFERENCES public.statistic_profiles(id);
+
+
+--
+-- Name: invoices fk_rails_40d78f8cf6; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.invoices
+ ADD CONSTRAINT fk_rails_40d78f8cf6 FOREIGN KEY (operator_profile_id) REFERENCES public.invoicing_profiles(id);
+
+
+--
+-- Name: projects_spaces fk_rails_43999be339; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.projects_spaces
+ ADD CONSTRAINT fk_rails_43999be339 FOREIGN KEY (space_id) REFERENCES public.spaces(id);
+
+
+--
+-- Name: order_activities fk_rails_45d167c69d; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.order_activities
+ ADD CONSTRAINT fk_rails_45d167c69d FOREIGN KEY (operator_profile_id) REFERENCES public.invoicing_profiles(id);
+
+
+--
+-- Name: spaces_availabilities fk_rails_4a1cac85d2; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.spaces_availabilities
+ ADD CONSTRAINT fk_rails_4a1cac85d2 FOREIGN KEY (availability_id) REFERENCES public.availabilities(id);
+
+
+--
+-- Name: projects_components fk_rails_4d88badb91; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.projects_components
+ ADD CONSTRAINT fk_rails_4d88badb91 FOREIGN KEY (component_id) REFERENCES public.components(id);
+
+
+--
+-- Name: event_price_categories fk_rails_4dc2c47476; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.event_price_categories
+ ADD CONSTRAINT fk_rails_4dc2c47476 FOREIGN KEY (price_category_id) REFERENCES public.price_categories(id);
+
+
+--
+-- Name: payment_schedule_items fk_rails_4e9d79c566; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.payment_schedule_items
+ ADD CONSTRAINT fk_rails_4e9d79c566 FOREIGN KEY (invoice_id) REFERENCES public.invoices(id);
+
+
+--
+-- Name: cart_item_event_reservation_tickets fk_rails_5307e8aab8; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.cart_item_event_reservation_tickets
+ ADD CONSTRAINT fk_rails_5307e8aab8 FOREIGN KEY (cart_item_event_reservation_id) REFERENCES public.cart_item_event_reservations(id);
+
+
+--
+-- Name: payment_schedules fk_rails_552bc65163; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.payment_schedules
+ ADD CONSTRAINT fk_rails_552bc65163 FOREIGN KEY (coupon_id) REFERENCES public.coupons(id);
+
+
+--
+-- Name: payment_schedule_objects fk_rails_56f6b6d2d2; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.payment_schedule_objects
+ ADD CONSTRAINT fk_rails_56f6b6d2d2 FOREIGN KEY (payment_schedule_id) REFERENCES public.payment_schedules(id);
+
+
+--
+-- Name: cart_item_prepaid_packs fk_rails_58f52df420; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.cart_item_prepaid_packs
+ ADD CONSTRAINT fk_rails_58f52df420 FOREIGN KEY (prepaid_pack_id) REFERENCES public.prepaid_packs(id);
+
+
+--
+-- Name: cart_item_event_reservations fk_rails_59c5c16548; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.cart_item_event_reservations
+ ADD CONSTRAINT fk_rails_59c5c16548 FOREIGN KEY (operator_profile_id) REFERENCES public.invoicing_profiles(id);
+
+
+--
+-- Name: statistic_profile_prepaid_packs fk_rails_5af0f4258a; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.statistic_profile_prepaid_packs
+ ADD CONSTRAINT fk_rails_5af0f4258a FOREIGN KEY (statistic_profile_id) REFERENCES public.statistic_profiles(id);
+
+
+--
+-- Name: cart_item_payment_schedules fk_rails_5da9437a85; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.cart_item_payment_schedules
+ ADD CONSTRAINT fk_rails_5da9437a85 FOREIGN KEY (coupon_id) REFERENCES public.coupons(id);
+
+
+--
+-- Name: cart_item_free_extensions fk_rails_62ad5e8b18; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.cart_item_free_extensions
+ ADD CONSTRAINT fk_rails_62ad5e8b18 FOREIGN KEY (subscription_id) REFERENCES public.subscriptions(id);
+
+
+--
+-- Name: tickets fk_rails_65422fe751; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.tickets
+ ADD CONSTRAINT fk_rails_65422fe751 FOREIGN KEY (reservation_id) REFERENCES public.reservations(id);
+
+
+--
+-- Name: cart_item_subscriptions fk_rails_674c95c433; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.cart_item_subscriptions
+ ADD CONSTRAINT fk_rails_674c95c433 FOREIGN KEY (plan_id) REFERENCES public.plans(id);
+
+
+--
+-- Name: prepaid_packs fk_rails_6ea2aaae74; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.prepaid_packs
+ ADD CONSTRAINT fk_rails_6ea2aaae74 FOREIGN KEY (group_id) REFERENCES public.groups(id);
+
+
+--
+-- Name: spaces_availabilities fk_rails_6f123023fd; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.spaces_availabilities
+ ADD CONSTRAINT fk_rails_6f123023fd FOREIGN KEY (space_id) REFERENCES public.spaces(id);
+
+
+--
+-- Name: user_tags fk_rails_7156651ad8; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.user_tags
+ ADD CONSTRAINT fk_rails_7156651ad8 FOREIGN KEY (tag_id) REFERENCES public.tags(id);
+
+
+--
+-- Name: events_event_themes fk_rails_725b0acd5b; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.events_event_themes
+ ADD CONSTRAINT fk_rails_725b0acd5b FOREIGN KEY (event_theme_id) REFERENCES public.event_themes(id);
+
+
+--
+-- Name: notifications fk_rails_75cdc2096d; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.notifications
+ ADD CONSTRAINT fk_rails_75cdc2096d FOREIGN KEY (notification_type_id) REFERENCES public.notification_types(id);
+
+
+--
+-- Name: wallets fk_rails_7bfc904eec; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.wallets
+ ADD CONSTRAINT fk_rails_7bfc904eec FOREIGN KEY (invoicing_profile_id) REFERENCES public.invoicing_profiles(id);
+
+
+--
+-- Name: statistic_profiles fk_rails_7cf6dfadf2; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.statistic_profiles
+ ADD CONSTRAINT fk_rails_7cf6dfadf2 FOREIGN KEY (group_id) REFERENCES public.groups(id);
+
+
+--
+-- Name: cart_item_prepaid_packs fk_rails_83291fbe82; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.cart_item_prepaid_packs
+ ADD CONSTRAINT fk_rails_83291fbe82 FOREIGN KEY (customer_profile_id) REFERENCES public.invoicing_profiles(id);
+
+
+--
+-- Name: prepaid_pack_reservations fk_rails_85a17dcd7d; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.prepaid_pack_reservations
+ ADD CONSTRAINT fk_rails_85a17dcd7d FOREIGN KEY (statistic_profile_prepaid_pack_id) REFERENCES public.statistic_profile_prepaid_packs(id);
+
+
+--
+-- Name: history_values fk_rails_860e5a38df; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.history_values
+ ADD CONSTRAINT fk_rails_860e5a38df FOREIGN KEY (invoicing_profile_id) REFERENCES public.invoicing_profiles(id);
+
+
+--
+-- Name: orders fk_rails_880df4b1ae; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.orders
+ ADD CONSTRAINT fk_rails_880df4b1ae FOREIGN KEY (operator_profile_id) REFERENCES public.invoicing_profiles(id);
+
+
+--
+-- Name: projects_machines fk_rails_88b280c24c; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.projects_machines
+ ADD CONSTRAINT fk_rails_88b280c24c FOREIGN KEY (machine_id) REFERENCES public.machines(id);
+
+
+--
+-- Name: payment_schedules fk_rails_8b73dd8d7d; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.payment_schedules
+ ADD CONSTRAINT fk_rails_8b73dd8d7d FOREIGN KEY (operator_profile_id) REFERENCES public.invoicing_profiles(id);
+
+
+--
+-- Name: cart_item_payment_schedules fk_rails_8c5ec85c7f; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.cart_item_payment_schedules
+ ADD CONSTRAINT fk_rails_8c5ec85c7f FOREIGN KEY (plan_id) REFERENCES public.plans(id);
+
+
+--
+-- Name: availability_tags fk_rails_8cb4e921f7; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.availability_tags
+ ADD CONSTRAINT fk_rails_8cb4e921f7 FOREIGN KEY (availability_id) REFERENCES public.availabilities(id);
+
+
+--
+-- Name: organizations fk_rails_8d4871c330; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.organizations
+ ADD CONSTRAINT fk_rails_8d4871c330 FOREIGN KEY (invoicing_profile_id) REFERENCES public.invoicing_profiles(id);
+
+
+--
+-- Name: invoices fk_rails_8f2dfb47ee; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.invoices
+ ADD CONSTRAINT fk_rails_8f2dfb47ee FOREIGN KEY (coupon_id) REFERENCES public.coupons(id);
+
+
+--
+-- Name: orders fk_rails_907a5e9f62; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.orders
+ ADD CONSTRAINT fk_rails_907a5e9f62 FOREIGN KEY (coupon_id) REFERENCES public.coupons(id);
+
+
+--
+-- Name: orders fk_rails_9147ddb417; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.orders
+ ADD CONSTRAINT fk_rails_9147ddb417 FOREIGN KEY (statistic_profile_id) REFERENCES public.statistic_profiles(id);
+
+
+--
+-- Name: supporting_document_refusals fk_rails_91d424352e; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.supporting_document_refusals
+ ADD CONSTRAINT fk_rails_91d424352e FOREIGN KEY (user_id) REFERENCES public.users(id);
+
+
+--
+-- Name: invoices fk_rails_94eb61be79; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.invoices
+ ADD CONSTRAINT fk_rails_94eb61be79 FOREIGN KEY (invoicing_profile_id) REFERENCES public.invoicing_profiles(id);
+
+
+--
+-- Name: notification_preferences fk_rails_9503aade25; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.notification_preferences
+ ADD CONSTRAINT fk_rails_9503aade25 FOREIGN KEY (user_id) REFERENCES public.users(id);
+
+
+--
+-- Name: cart_item_reservations fk_rails_951386f24e; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.cart_item_reservations
+ ADD CONSTRAINT fk_rails_951386f24e FOREIGN KEY (operator_profile_id) REFERENCES public.invoicing_profiles(id);
+
+
+--
+-- Name: accounting_lines fk_rails_97c9798d44; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.accounting_lines
+ ADD CONSTRAINT fk_rails_97c9798d44 FOREIGN KEY (invoice_id) REFERENCES public.invoices(id);
+
+
+--
+-- Name: project_users fk_rails_996d73fecd; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.project_users
+ ADD CONSTRAINT fk_rails_996d73fecd FOREIGN KEY (user_id) REFERENCES public.users(id);
+
+
+--
+-- Name: auth_provider_mappings fk_rails_9b679de4cc; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.auth_provider_mappings
+ ADD CONSTRAINT fk_rails_9b679de4cc FOREIGN KEY (auth_provider_id) REFERENCES public.auth_providers(id);
+
+
+--
+-- Name: machines fk_rails_9c12e5d709; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.machines
+ ADD CONSTRAINT fk_rails_9c12e5d709 FOREIGN KEY (machine_category_id) REFERENCES public.machine_categories(id);
+
+
+--
+-- Name: prices fk_rails_9f0e94b0c3; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.prices
+ ADD CONSTRAINT fk_rails_9f0e94b0c3 FOREIGN KEY (plan_id) REFERENCES public.plans(id);
+
+
+--
+-- Name: projects_themes fk_rails_9fd58ae797; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.projects_themes
+ ADD CONSTRAINT fk_rails_9fd58ae797 FOREIGN KEY (project_id) REFERENCES public.projects(id);
+
+
+--
+-- Name: supporting_document_types_groups fk_rails_a1f5531605; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.supporting_document_types_groups
+ ADD CONSTRAINT fk_rails_a1f5531605 FOREIGN KEY (supporting_document_type_id) REFERENCES public.supporting_document_types(id);
+
+
+--
+-- Name: notification_preferences fk_rails_a402db84f8; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.notification_preferences
+ ADD CONSTRAINT fk_rails_a402db84f8 FOREIGN KEY (notification_type_id) REFERENCES public.notification_types(id);
+
+
+--
+-- Name: cart_item_coupons fk_rails_a44bac1e45; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.cart_item_coupons
+ ADD CONSTRAINT fk_rails_a44bac1e45 FOREIGN KEY (operator_profile_id) REFERENCES public.invoicing_profiles(id);
+
+
+--
+-- Name: projects_themes fk_rails_b021a22658; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.projects_themes
+ ADD CONSTRAINT fk_rails_b021a22658 FOREIGN KEY (theme_id) REFERENCES public.themes(id);
+
+
+--
+-- Name: statistic_profile_prepaid_packs fk_rails_b0251cdfcf; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.statistic_profile_prepaid_packs
+ ADD CONSTRAINT fk_rails_b0251cdfcf FOREIGN KEY (prepaid_pack_id) REFERENCES public.prepaid_packs(id);
+
+
+--
+-- Name: orders fk_rails_b33ed6c672; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.orders
+ ADD CONSTRAINT fk_rails_b33ed6c672 FOREIGN KEY (invoice_id) REFERENCES public.invoices(id);
+
+
+--
+-- Name: projects fk_rails_b4a83cd9b3; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.projects
+ ADD CONSTRAINT fk_rails_b4a83cd9b3 FOREIGN KEY (status_id) REFERENCES public.statuses(id);
+
+
+--
+-- Name: statistic_profiles fk_rails_bba64e5eb9; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.statistic_profiles
+ ADD CONSTRAINT fk_rails_bba64e5eb9 FOREIGN KEY (role_id) REFERENCES public.roles(id);
+
+
+--
+-- Name: events_event_themes fk_rails_bd1415f169; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.events_event_themes
+ ADD CONSTRAINT fk_rails_bd1415f169 FOREIGN KEY (event_id) REFERENCES public.events(id);
+
+
+--
+-- Name: projects_machines fk_rails_c1427daf48; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.projects_machines
+ ADD CONSTRAINT fk_rails_c1427daf48 FOREIGN KEY (project_id) REFERENCES public.projects(id);
+
+
+--
+-- Name: plans fk_rails_c503ed4a8c; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.plans
+ ADD CONSTRAINT fk_rails_c503ed4a8c FOREIGN KEY (plan_category_id) REFERENCES public.plan_categories(id);
+
+
+--
+-- Name: project_steps fk_rails_c6306005c3; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.project_steps
+ ADD CONSTRAINT fk_rails_c6306005c3 FOREIGN KEY (project_id) REFERENCES public.projects(id);
+
+
+--
+-- Name: projects_components fk_rails_c80c60ead3; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.projects_components
+ ADD CONSTRAINT fk_rails_c80c60ead3 FOREIGN KEY (project_id) REFERENCES public.projects(id);
+
+
+--
+-- Name: user_profile_custom_fields fk_rails_c9a569c13e; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.user_profile_custom_fields
+ ADD CONSTRAINT fk_rails_c9a569c13e FOREIGN KEY (profile_custom_field_id) REFERENCES public.profile_custom_fields(id);
+
+
+--
+-- Name: order_activities fk_rails_cabaff5432; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.order_activities
+ ADD CONSTRAINT fk_rails_cabaff5432 FOREIGN KEY (order_id) REFERENCES public.orders(id);
+
+
+--
+-- Name: statistic_profile_trainings fk_rails_cb689a8d3d; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.statistic_profile_trainings
+ ADD CONSTRAINT fk_rails_cb689a8d3d FOREIGN KEY (statistic_profile_id) REFERENCES public.statistic_profiles(id);
+
+
+--
+-- Name: cart_item_subscriptions fk_rails_cb8daf6b0b; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.cart_item_subscriptions
+ ADD CONSTRAINT fk_rails_cb8daf6b0b FOREIGN KEY (customer_profile_id) REFERENCES public.invoicing_profiles(id);
+
+
+--
+-- Name: accounting_periods fk_rails_cc9abff81f; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.accounting_periods
+ ADD CONSTRAINT fk_rails_cc9abff81f FOREIGN KEY (closed_by) REFERENCES public.users(id);
+
+
+--
+-- Name: wallet_transactions fk_rails_d07bc24ce3; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.wallet_transactions
+ ADD CONSTRAINT fk_rails_d07bc24ce3 FOREIGN KEY (wallet_id) REFERENCES public.wallets(id);
+
+
+--
+-- Name: cart_item_reservations fk_rails_d0bb98e5fa; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.cart_item_reservations
+ ADD CONSTRAINT fk_rails_d0bb98e5fa FOREIGN KEY (plan_id) REFERENCES public.plans(id);
+
+
+--
+-- Name: availability_tags fk_rails_d262715d11; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.availability_tags
+ ADD CONSTRAINT fk_rails_d262715d11 FOREIGN KEY (tag_id) REFERENCES public.tags(id);
+
+
+--
+-- Name: payment_schedules fk_rails_d345f9b22a; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.payment_schedules
+ ADD CONSTRAINT fk_rails_d345f9b22a FOREIGN KEY (invoicing_profile_id) REFERENCES public.invoicing_profiles(id);
+
+
+--
+-- Name: slots_reservations fk_rails_d4ced1b26d; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.slots_reservations
+ ADD CONSTRAINT fk_rails_d4ced1b26d FOREIGN KEY (slot_id) REFERENCES public.slots(id);
+
+
+--
+-- Name: payment_schedule_items fk_rails_d6030dd0e7; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.payment_schedule_items
+ ADD CONSTRAINT fk_rails_d6030dd0e7 FOREIGN KEY (payment_schedule_id) REFERENCES public.payment_schedules(id);
+
+
+--
+-- Name: product_stock_movements fk_rails_dc802d5f48; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.product_stock_movements
+ ADD CONSTRAINT fk_rails_dc802d5f48 FOREIGN KEY (product_id) REFERENCES public.products(id);
+
+
+--
+-- Name: event_price_categories fk_rails_dcd2787d07; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.event_price_categories
+ ADD CONSTRAINT fk_rails_dcd2787d07 FOREIGN KEY (event_id) REFERENCES public.events(id);
+
+
+--
+-- Name: cart_item_coupons fk_rails_e1cb402fac; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.cart_item_coupons
+ ADD CONSTRAINT fk_rails_e1cb402fac FOREIGN KEY (customer_profile_id) REFERENCES public.invoicing_profiles(id);
+
+
+--
+-- Name: supporting_document_types_groups fk_rails_e2f3e565b7; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.supporting_document_types_groups
+ ADD CONSTRAINT fk_rails_e2f3e565b7 FOREIGN KEY (group_id) REFERENCES public.groups(id);
+
+
+--
+-- Name: order_items fk_rails_e3cb28f071; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.order_items
+ ADD CONSTRAINT fk_rails_e3cb28f071 FOREIGN KEY (order_id) REFERENCES public.orders(id);
+
+
+--
+-- Name: reservations fk_rails_e409fe73aa; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.reservations
+ ADD CONSTRAINT fk_rails_e409fe73aa FOREIGN KEY (statistic_profile_id) REFERENCES public.statistic_profiles(id);
+
+
+--
+-- Name: statistic_profile_trainings fk_rails_e759406c68; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.statistic_profile_trainings
+ ADD CONSTRAINT fk_rails_e759406c68 FOREIGN KEY (training_id) REFERENCES public.trainings(id);
+
+
+--
+-- Name: projects fk_rails_e812590204; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.projects
+ ADD CONSTRAINT fk_rails_e812590204 FOREIGN KEY (author_statistic_profile_id) REFERENCES public.statistic_profiles(id);
+
+
+--
+-- Name: user_tags fk_rails_ea0382482a; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.user_tags
+ ADD CONSTRAINT fk_rails_ea0382482a FOREIGN KEY (user_id) REFERENCES public.users(id);
+
+
+--
+-- Name: products fk_rails_efe167855e; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.products
+ ADD CONSTRAINT fk_rails_efe167855e FOREIGN KEY (product_category_id) REFERENCES public.product_categories(id);
+
+
+--
+-- Name: user_profile_custom_fields fk_rails_f0faa9ed79; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.user_profile_custom_fields
+ ADD CONSTRAINT fk_rails_f0faa9ed79 FOREIGN KEY (invoicing_profile_id) REFERENCES public.invoicing_profiles(id);
+
+
+--
+-- Name: projects_spaces fk_rails_f2103efed7; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.projects_spaces
+ ADD CONSTRAINT fk_rails_f2103efed7 FOREIGN KEY (project_id) REFERENCES public.projects(id);
+
+
+--
+-- Name: events fk_rails_fd5598a81d; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.events
+ ADD CONSTRAINT fk_rails_fd5598a81d FOREIGN KEY (category_id) REFERENCES public.categories(id);
+
+
+--
+-- Name: cart_item_reservation_slots fk_rails_fd8092749c; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.cart_item_reservation_slots
+ ADD CONSTRAINT fk_rails_fd8092749c FOREIGN KEY (slot_id) REFERENCES public.slots(id);
+
+
+--
+-- Name: cart_item_reservation_slots fk_rails_fe07d12d9f; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.cart_item_reservation_slots
+ ADD CONSTRAINT fk_rails_fe07d12d9f FOREIGN KEY (slots_reservation_id) REFERENCES public.slots_reservations(id);
+
+
+--
+-- Name: cart_item_event_reservations fk_rails_fe95ba05e8; Type: FK CONSTRAINT; Schema: public; Owner: -
+--
+
+ALTER TABLE ONLY public.cart_item_event_reservations
+ ADD CONSTRAINT fk_rails_fe95ba05e8 FOREIGN KEY (event_id) REFERENCES public.events(id);
+
+
+--
+-- PostgreSQL database dump complete
+--
+
+SET search_path TO "$user", public;
+
+INSERT INTO "schema_migrations" (version) VALUES
+('20140409083104'),
+('20140409083610'),
+('20140409153915'),
+('20140410101026'),
+('20140410140516'),
+('20140410162151'),
+('20140411152729'),
+('20140414141134'),
+('20140415104151'),
+('20140415123625'),
+('20140416130838'),
+('20140422085949'),
+('20140422090412'),
+('20140513152025'),
+('20140516083543'),
+('20140516083909'),
+('20140516093335'),
+('20140522115617'),
+('20140522175539'),
+('20140522175714'),
+('20140522180032'),
+('20140522180930'),
+('20140522181011'),
+('20140522181148'),
+('20140523083230'),
+('20140526144327'),
+('20140527092045'),
+('20140528134944'),
+('20140528140257'),
+('20140529145140'),
+('20140603084413'),
+('20140603085817'),
+('20140603164215'),
+('20140604094514'),
+('20140604113611'),
+('20140604113919'),
+('20140604132045'),
+('20140605125131'),
+('20140605142133'),
+('20140605151442'),
+('20140609092700'),
+('20140609092827'),
+('20140610153123'),
+('20140610170446'),
+('20140613150651'),
+('20140620131525'),
+('20140622121724'),
+('20140622122944'),
+('20140622145648'),
+('20140623023557'),
+('20140624123359'),
+('20140624123814'),
+('20140624124338'),
+('20140703100457'),
+('20140703231208'),
+('20140703233420'),
+('20140703233942'),
+('20140703235739'),
+('20140710144142'),
+('20140710144427'),
+('20140710144610'),
+('20140711084809'),
+('20140715095503'),
+('20140717143735'),
+('20140722162046'),
+('20140722162309'),
+('20140723075942'),
+('20140723171547'),
+('20140723172610'),
+('20140724125605'),
+('20140724131808'),
+('20140724132655'),
+('20140728110430'),
+('20141002111736'),
+('20141110131407'),
+('20141215142044'),
+('20141215153643'),
+('20141217141648'),
+('20141217172843'),
+('20150107103903'),
+('20150108082541'),
+('20150112160349'),
+('20150112160405'),
+('20150112160425'),
+('20150113112757'),
+('20150114111132'),
+('20150114111243'),
+('20150114141926'),
+('20150114142032'),
+('20150115143750'),
+('20150119082931'),
+('20150119092557'),
+('20150119093811'),
+('20150119160758'),
+('20150119161004'),
+('20150127101521'),
+('20150127155141'),
+('20150127161235'),
+('20150127172510'),
+('20150128132219'),
+('20150218154032'),
+('20150428075148'),
+('20150428091057'),
+('20150506090921'),
+('20150507075506'),
+('20150507075620'),
+('20150512123546'),
+('20150520132030'),
+('20150526130729'),
+('20150527153312'),
+('20150529113555'),
+('20150601125944'),
+('20150603104502'),
+('20150603104658'),
+('20150604081757'),
+('20150604131525'),
+('20150608142234'),
+('20150609094336'),
+('20150615135539'),
+('20150617085623'),
+('20150701090642'),
+('20150702150754'),
+('20150702151009'),
+('20150706102547'),
+('20150707135343'),
+('20150713090542'),
+('20150713151115'),
+('20150715135751'),
+('20150915144448'),
+('20150915144939'),
+('20150915152943'),
+('20150916091131'),
+('20150916093159'),
+('20150921135557'),
+('20150921135817'),
+('20150922095921'),
+('20150922100528'),
+('20150924093917'),
+('20150924094138'),
+('20150924094427'),
+('20150924141714'),
+('20151005133841'),
+('20151008152219'),
+('20151105125623'),
+('20151210113548'),
+('20160119131623'),
+('20160504085703'),
+('20160504085905'),
+('20160516090121'),
+('20160516124056'),
+('20160526095550'),
+('20160526102307'),
+('20160602075531'),
+('20160613093842'),
+('20160628092931'),
+('20160628124538'),
+('20160628131408'),
+('20160628134211'),
+('20160628134303'),
+('20160629091649'),
+('20160630083438'),
+('20160630083556'),
+('20160630083759'),
+('20160630100137'),
+('20160630140204'),
+('20160704095606'),
+('20160704165139'),
+('20160714095018'),
+('20160718165434'),
+('20160720124355'),
+('20160725131756'),
+('20160725131950'),
+('20160725135112'),
+('20160726081931'),
+('20160726111509'),
+('20160726131152'),
+('20160726144257'),
+('20160728095026'),
+('20160801145502'),
+('20160801153454'),
+('20160803085201'),
+('20160803104701'),
+('20160804073558'),
+('20160808113850'),
+('20160808113930'),
+('20160824080717'),
+('20160824084111'),
+('20160825141326'),
+('20160830154719'),
+('20160831084443'),
+('20160831084519'),
+('20160905141858'),
+('20160905142700'),
+('20160906094739'),
+('20160906094847'),
+('20160915105234'),
+('20161123104604'),
+('20170109085345'),
+('20170213100744'),
+('20170213101541'),
+('20170213103438'),
+('20170213142543'),
+('20170227104736'),
+('20170227104934'),
+('20170227113718'),
+('20170227114634'),
+('20170906100906'),
+('20171004135605'),
+('20171005141522'),
+('20171010143708'),
+('20171011100640'),
+('20171011125217'),
+('20181210105917'),
+('20181217103256'),
+('20181217103441'),
+('20181217110454'),
+('20190107103632'),
+('20190107111749'),
+('20190110150532'),
+('20190211124135'),
+('20190211124726'),
+('20190225101256'),
+('20190225102847'),
+('20190227143153'),
+('20190314095931'),
+('20190320091148'),
+('20190521122429'),
+('20190521123642'),
+('20190521124609'),
+('20190521151142'),
+('20190522115230'),
+('20190523123916'),
+('20190523140823'),
+('20190528140012'),
+('20190604064929'),
+('20190604065348'),
+('20190604070903'),
+('20190604075717'),
+('20190605141322'),
+('20190606074050'),
+('20190606074801'),
+('20190730085826'),
+('20190910131825'),
+('20190910141336'),
+('20190917123631'),
+('20190924140726'),
+('20191113103352'),
+('20191127153729'),
+('20191202135507'),
+('20200127111404'),
+('20200206132857'),
+('20200218092221'),
+('20200408101654'),
+('20200415141809'),
+('20200511075933'),
+('20200622135401'),
+('20200623134900'),
+('20200623141305'),
+('20200629123011'),
+('20200721162939'),
+('20201027092149'),
+('20201027100746'),
+('20201027101809'),
+('20201112092002'),
+('20210416073410'),
+('20210416083610'),
+('20210521085710'),
+('20210525134018'),
+('20210525150942'),
+('20210608082748'),
+('20210621122103'),
+('20210621123954'),
+('20211014135151'),
+('20211018121822'),
+('20211220143400'),
+('20220111134253'),
+('20220118123741'),
+('20220225143203'),
+('20220316133304'),
+('20220322135836'),
+('20220328141618'),
+('20220328144305'),
+('20220328145017'),
+('20220422090245'),
+('20220422090709'),
+('20220425095244'),
+('20220426162334'),
+('20220428123828'),
+('20220428125751'),
+('20220429164234'),
+('20220506143526'),
+('20220509105714'),
+('20220517140916'),
+('20220531160223'),
+('20220620072750'),
+('20220704084929'),
+('20220705125232'),
+('20220712153708'),
+('20220712160137'),
+('20220720135828'),
+('20220803091913'),
+('20220805083431'),
+('20220808161314'),
+('20220818160821'),
+('20220822081222'),
+('20220826074619'),
+('20220826085923'),
+('20220826090821'),
+('20220826091819'),
+('20220826093503'),
+('20220826133518'),
+('20220826140921'),
+('20220826175129'),
+('20220909131300'),
+('20220914145334'),
+('20220915133100'),
+('20220920131912'),
+('20221003133019'),
+('20221110120338'),
+('20221118092948'),
+('20221122123557'),
+('20221122123605'),
+('20221206100225'),
+('20221208123822'),
+('20221212162655'),
+('20221216090005'),
+('20221220105939'),
+('20221227141529'),
+('20221228152719'),
+('20221228152747'),
+('20221228160449'),
+('20221229085430'),
+('20221229094334'),
+('20221229100157'),
+('20221229103407'),
+('20221229105954'),
+('20221229115757'),
+('20221229120932'),
+('20230106081943'),
+('20230112151631'),
+('20230113145632'),
+('20230116142738'),
+('20230119143245'),
+('20230124094255'),
+('20230126160900'),
+('20230127091337'),
+('20230127100506'),
+('20230131104958'),
+('20230213134954'),
+('20230302120458'),
+('20230307123611'),
+('20230307123841'),
+('20230309094535'),
+('20230315095054');
+
+
diff --git a/doc/architecture.md b/doc/architecture.md
index aaf9f65d0..34640f0d2 100644
--- a/doc/architecture.md
+++ b/doc/architecture.md
@@ -93,7 +93,6 @@ It also provides another REST-JSON API, open to the 3rd-party applications, and
` ╠═ pdfs/` PDF documents generation;
` ╠═ policies/` Access policies for the API and OpenAPI endpoints;
` ╠═ services/` Utilities arranged by data models;
-` ╠═ sweepers/` Build cached version of some data;
` ╠═ themes/` SASS files that overrides the frontend styles. We plan to move all styles here to build multiple themes;
` ╠═ uploaders/` Handling of the uploaded files
` ╠═ validators/` Custom data validation (before saving);
@@ -126,4 +125,4 @@ For now, the main application is still using Angular.js but it uses some React.j
` ║ ║ ╠═ plugins.js.erb` Entrypoint for embedding Fab-manager's plugins in the frontend application;
` ║ ║ ╚═ router.js` Configuration for UI-Router (mapping between routes, controllers and templates)
` ║ ╚═ stylesheets/` SASS source for the application style
-` ╚═ templates/` Angular.js views (HTML)
+` ╚═ templates/` Angular.js views (HTML)
diff --git a/doc/development_readme.md b/doc/development_readme.md
index 6c09fdba5..918199ccd 100644
--- a/doc/development_readme.md
+++ b/doc/development_readme.md
@@ -125,13 +125,11 @@ This procedure is not easy to follow so if you don't need to write some code for
```bash
# for dev
- rails db:create
- rails db:migrate
+ rails db:schema:load
ADMIN_EMAIL='youradminemail' ADMIN_PASSWORD='youradminpassword' rails db:seed
rails fablab:es:build_stats
# for tests
- RAILS_ENV=test rails db:create
- RAILS_ENV=test rails db:migrate
+ RAILS_ENV=test rails db:schema:load
```
14. Enable Overcommit
diff --git a/doc/virtual-machine.md b/doc/virtual-machine.md
index ca01359eb..4ccdb7b8b 100644
--- a/doc/virtual-machine.md
+++ b/doc/virtual-machine.md
@@ -50,14 +50,12 @@ the host can provide but will usually be much more slower than a production envi
included in the migrations. Password minimal length is 8 characters):
```bash
- rails db:create
- rails db:migrate
+ rails db:schema:load
# Be sure not to use the default values below in production
ADMIN_EMAIL='admin@email' ADMIN_PASSWORD='adminpass' rails db:seed
rails fablab:es:build_stats
# for tests
- RAILS_ENV=test rails db:create
- RAILS_ENV=test rails db:migrate
+ RAILS_ENV=test rails db:schema:load
```
8. Start the application and visit `localhost:3000` on your browser to check that it works:
diff --git a/lib/fab_manager.rb b/lib/fab_manager.rb
index 56bbfba7e..5d450ea61 100644
--- a/lib/fab_manager.rb
+++ b/lib/fab_manager.rb
@@ -1,14 +1,15 @@
# frozen_string_literal: true
-require_dependency 'plugin/instance'
+load 'plugin/instance'
+# the FabManager application
module FabManager
class << self
attr_reader :plugins
end
def self.activate_plugins!
- all_plugins = Plugin::Instance.find_all("#{Rails.root}/plugins")
+ all_plugins = Plugin::Instance.find_all(Rails.root.join('plugins'))
@plugins = []
all_plugins.each do |p|
diff --git a/lib/pay_zen/helper.rb b/lib/pay_zen/helper.rb
index d4ec3a303..47115d44b 100644
--- a/lib/pay_zen/helper.rb
+++ b/lib/pay_zen/helper.rb
@@ -21,7 +21,7 @@ class PayZen::Helper < Payment::Helper
end
def human_error(error)
- I18n.t('errors.messages.gateway_error', { MESSAGE: error.message })
+ I18n.t('errors.messages.gateway_error', **{ MESSAGE: error.message })
end
## generate an unique string reference for the content of a cart
diff --git a/lib/stripe/helper.rb b/lib/stripe/helper.rb
index 507ba8ba7..d7cc83ca9 100644
--- a/lib/stripe/helper.rb
+++ b/lib/stripe/helper.rb
@@ -25,14 +25,14 @@ class Stripe::Helper < Payment::Helper
case error.code
when 'amount_too_small'
message.match(/\d+\.\d+\s\w+/) do |res|
- message = I18n.t('errors.messages.gateway_amount_too_small', { AMOUNT: res })
+ message = I18n.t('errors.messages.gateway_amount_too_small', **{ AMOUNT: res })
end
when 'amount_too_large'
message.match(/\d+\.\d+\s\w+/) do |res|
- message = I18n.t('errors.messages.gateway_amount_too_large', { AMOUNT: res })
+ message = I18n.t('errors.messages.gateway_amount_too_large', **{ AMOUNT: res })
end
else
- message = I18n.t('errors.messages.gateway_error', { MESSAGE: message })
+ message = I18n.t('errors.messages.gateway_error', **{ MESSAGE: message })
end
message
end
diff --git a/lib/tasks/fablab/fix.rake b/lib/tasks/fablab/fix.rake
index f80401da9..507f4ab56 100644
--- a/lib/tasks/fablab/fix.rake
+++ b/lib/tasks/fablab/fix.rake
@@ -291,7 +291,7 @@ namespace :fablab do
InvoiceItem.where(object_type: 'Error').update_all(object_id: 0) # rubocop:disable Rails/SkipsModelValidations
- Fablab::Application.load_tasks if Rake::Task.tasks.empty?
+ FabManager::Application.load_tasks if Rake::Task.tasks.empty?
Rake::Task['fablab:chain:invoices_items'].invoke
end
diff --git a/scripts/tests.sh b/scripts/tests.sh
index 836088631..e1130a257 100755
--- a/scripts/tests.sh
+++ b/scripts/tests.sh
@@ -15,8 +15,4 @@ if [[ -z "$stripe_secret_key" ]]; then
if [[ -z "$stripe_secret_key" ]]; then echo "Key was not set, exiting..."; exit 1; fi
fi
-RAILS_ENV='test' bin/rails db:drop
-RAILS_ENV='test' bin/rails db:create
-RAILS_ENV='test' bin/rails db:migrate
-clear
-STRIPE_PUBLISHABLE_KEY="$stripe_public_key" STRIPE_API_KEY="$stripe_secret_key" RAILS_ENV='test' bundle exec bin/rails test "$@"
+STRIPE_PUBLISHABLE_KEY="$stripe_public_key" STRIPE_API_KEY="$stripe_secret_key" RAILS_ENV='test' bin/rails test "$@"
diff --git a/setup/setup.sh b/setup/setup.sh
index e31e016e4..1b68c62c8 100755
--- a/setup/setup.sh
+++ b/setup/setup.sh
@@ -437,8 +437,7 @@ setup_assets_and_databases()
read -rp "Continue? (Y/n) " confirm 1.minute.ago
+ # Check response format & status
+ assert_equal 200, response.status, response.body
+ assert_match Mime[:json].to_s, response.content_type
- assert_equal 5, c.hours
- end
+ # Check the credit was correctly updated
+ credit = json_response(response.body)
+ assert_equal 13, credit[:id]
+ c = Credit.find(credit[:id])
+ assert c.updated_at > 1.minute.ago
+
+ assert_equal 5, c.hours
end
end
diff --git a/test/integration/credits/training_test.rb b/test/integration/credits/training_test.rb
index 55d3059b9..552a5ced2 100644
--- a/test/integration/credits/training_test.rb
+++ b/test/integration/credits/training_test.rb
@@ -2,54 +2,54 @@
require 'test_helper'
-module Credits
- class TrainingTest < ActionDispatch::IntegrationTest
- # Called before every test method runs. Can be used
- # to set up fixture information.
- def setup
- admin = User.with_role(:admin).first
- login_as(admin, scope: :user)
- end
+module Credits; end
- test 'create training credit' do
- # First, we create a new credit
- post '/api/credits',
- params: {
- credit: {
- creditable_id: 4,
- creditable_type: 'Training',
- plan_id: '1'
- }
- }.to_json,
- headers: default_headers
+class Credits::TrainingTest < ActionDispatch::IntegrationTest
+ # Called before every test method runs. Can be used
+ # to set up fixture information.
+ def setup
+ admin = User.with_role(:admin).first
+ login_as(admin, scope: :user)
+ end
- # Check response format & status
- assert_equal 201, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ test 'create training credit' do
+ # First, we create a new credit
+ post '/api/credits',
+ params: {
+ credit: {
+ creditable_id: 4,
+ creditable_type: 'Training',
+ plan_id: '1'
+ }
+ }.to_json,
+ headers: default_headers
- # Check the credit was created correctly
- credit = json_response(response.body)
- c = Credit.where(id: credit[:id]).first
- assert_not_nil c, 'Credit was not created in database'
+ # Check response format & status
+ assert_equal 201, response.status, response.body
+ assert_match Mime[:json].to_s, response.content_type
- # Check that no hours were associated with the credit
- assert_nil c.hours
- end
+ # Check the credit was created correctly
+ credit = json_response(response.body)
+ c = Credit.where(id: credit[:id]).first
+ assert_not_nil c, 'Credit was not created in database'
- test 'create a existing credit' do
- post '/api/credits',
- params: {
- credit: {
- creditable_id: 4,
- creditable_type: 'Training',
- plan_id: '2'
- }
- }.to_json,
- headers: default_headers
+ # Check that no hours were associated with the credit
+ assert_nil c.hours
+ end
- # Check response format & status
- assert_equal 422, response.status, response.body
- assert_equal Mime[:json], response.content_type
- end
+ test 'create a existing credit' do
+ post '/api/credits',
+ params: {
+ credit: {
+ creditable_id: 4,
+ creditable_type: 'Training',
+ plan_id: '2'
+ }
+ }.to_json,
+ headers: default_headers
+
+ # Check response format & status
+ assert_equal 422, response.status, response.body
+ assert_match Mime[:json].to_s, response.content_type
end
end
diff --git a/test/integration/credits/user_info_test.rb b/test/integration/credits/user_info_test.rb
index 8c6d8be2a..b18c0753f 100644
--- a/test/integration/credits/user_info_test.rb
+++ b/test/integration/credits/user_info_test.rb
@@ -2,46 +2,46 @@
require 'test_helper'
-module Credits
- class UserInfoTest < ActionDispatch::IntegrationTest
- def setup
- @user_without_subscription = User.find_by(username: 'lseguin')
- @user_with_subscription = User.find_by(username: 'kdumas')
- end
+module Credits; end
- test 'user fetch her credits info' do
- login_as(@user_with_subscription, scope: :user)
- get "/api/credits/user/#{@user_with_subscription.id}/Machine"
+class Credits::UserInfoTest < ActionDispatch::IntegrationTest
+ def setup
+ @user_without_subscription = User.find_by(username: 'lseguin')
+ @user_with_subscription = User.find_by(username: 'kdumas')
+ end
- # Check response format & status
- assert_equal 200, response.status
- assert_equal Mime[:json], response.content_type
+ test 'user fetch her credits info' do
+ login_as(@user_with_subscription, scope: :user)
+ get "/api/credits/user/#{@user_with_subscription.id}/Machine"
- # Check the correct credits was returned
- credits = json_response(response.body)
- assert_equal @user_with_subscription.subscribed_plan.credits.where(creditable_type: 'Machine').count,
- credits.length,
- 'not all credits were returned'
- end
+ # Check response format & status
+ assert_equal 200, response.status
+ assert_match Mime[:json].to_s, response.content_type
- test 'user without credits fetch his credits info' do
- login_as(@user_without_subscription, scope: :user)
- get "/api/credits/user/#{@user_without_subscription.id}/Machine"
+ # Check the correct credits was returned
+ credits = json_response(response.body)
+ assert_equal @user_with_subscription.subscribed_plan.credits.where(creditable_type: 'Machine').count,
+ credits.length,
+ 'not all credits were returned'
+ end
- # Check response format & status
- assert_equal 200, response.status
- assert_equal Mime[:json], response.content_type
+ test 'user without credits fetch his credits info' do
+ login_as(@user_without_subscription, scope: :user)
+ get "/api/credits/user/#{@user_without_subscription.id}/Machine"
- # Check the correct credits was returned
- credits = json_response(response.body)
- assert_equal 0, credits.length, 'unexpected credits returned'
- end
+ # Check response format & status
+ assert_equal 200, response.status
+ assert_match Mime[:json].to_s, response.content_type
- test 'user tries to fetch credits info from another user' do
- login_as(@user_without_subscription, scope: :user)
- get "/api/credits/user/#{@user_with_subscription.id}/Machine"
+ # Check the correct credits was returned
+ credits = json_response(response.body)
+ assert_equal 0, credits.length, 'unexpected credits returned'
+ end
- assert_equal 403, response.status
- end
+ test 'user tries to fetch credits info from another user' do
+ login_as(@user_without_subscription, scope: :user)
+ get "/api/credits/user/#{@user_with_subscription.id}/Machine"
+
+ assert_equal 403, response.status
end
end
diff --git a/test/integration/event_themes_test.rb b/test/integration/event_themes_test.rb
index 1422be021..9c41b748c 100644
--- a/test/integration/event_themes_test.rb
+++ b/test/integration/event_themes_test.rb
@@ -17,7 +17,7 @@ class EventThemesTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_equal 201, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check the correct event theme was created
res = json_response(response.body)
@@ -36,7 +36,7 @@ class EventThemesTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_equal 200, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check the event theme was updated
res = json_response(response.body)
@@ -49,7 +49,7 @@ class EventThemesTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_equal 200, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check the list items are ok
themes = json_response(response.body)
diff --git a/test/integration/events/as_admin_test.rb b/test/integration/events/as_admin_test.rb
index 33672f351..6480cc4ed 100644
--- a/test/integration/events/as_admin_test.rb
+++ b/test/integration/events/as_admin_test.rb
@@ -29,7 +29,7 @@ class Events::AsAdminTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_equal 201, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check the event was created correctly
event = json_response(response.body)
@@ -57,7 +57,7 @@ class Events::AsAdminTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_equal 200, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check the places numbers were updated successfully
e = Event.where(id: event[:id]).first
@@ -88,7 +88,7 @@ class Events::AsAdminTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_equal 201, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check the remaining places were updated successfully
e = Event.where(id: event[:id]).first
@@ -112,7 +112,7 @@ class Events::AsAdminTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_equal 200, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check the places numbers were updated successfully
e = Event.where(id: event[:id]).first
@@ -148,7 +148,7 @@ class Events::AsAdminTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_equal 201, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check the event was created correctly
event = json_response(response.body)
@@ -190,7 +190,7 @@ class Events::AsAdminTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_equal 201, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check the reservation match the required event
result = json_response(response.body)
diff --git a/test/integration/events/delete_test.rb b/test/integration/events/delete_test.rb
index 245bc62e6..4799d5d4e 100644
--- a/test/integration/events/delete_test.rb
+++ b/test/integration/events/delete_test.rb
@@ -16,7 +16,7 @@ class Events::DeleteTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_response :success
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
res = json_response(response.body)
assert_equal 1, res[:deleted]
diff --git a/test/integration/events/recurrence_test.rb b/test/integration/events/recurrence_test.rb
index 258f66c5c..6069ea00e 100644
--- a/test/integration/events/recurrence_test.rb
+++ b/test/integration/events/recurrence_test.rb
@@ -17,7 +17,7 @@ class Events::RecurrenceTest < ActionDispatch::IntegrationTest
event: {
title: name,
event_image_attributes: {
- attachment: fixture_file_upload('/files/event/Skateboard.jpg')
+ attachment: fixture_file_upload('event/Skateboard.jpg')
},
description: 'Come make you own skatebord from stratch...',
start_date: 1.week.from_now.utc,
@@ -30,8 +30,8 @@ class Events::RecurrenceTest < ActionDispatch::IntegrationTest
recurrence: 'week',
recurrence_end_at: 10.weeks.from_now.utc,
event_files_attributes: [
- { attachment: fixture_file_upload('/files/document.pdf', 'application/pdf', true) },
- { attachment: fixture_file_upload('/files/document2.pdf', 'application/pdf', true) }
+ { attachment: fixture_file_upload('document.pdf', 'application/pdf', true) },
+ { attachment: fixture_file_upload('document2.pdf', 'application/pdf', true) }
],
event_price_categories_attributes: [
{ price_category_id: 1, amount: 10 },
@@ -47,7 +47,7 @@ class Events::RecurrenceTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_equal 201, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check the events were correctly created
db_events = Event.where(title: name)
@@ -81,7 +81,7 @@ class Events::RecurrenceTest < ActionDispatch::IntegrationTest
event: {
title: name,
event_image_attributes: {
- attachment: fixture_file_upload('/files/event/Party.jpg')
+ attachment: fixture_file_upload('event/Party.jpg')
},
description: 'Come party tonight at the fablab...',
start_date: 2.weeks.from_now,
@@ -99,7 +99,7 @@ class Events::RecurrenceTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_equal 201, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check the events were correctly created
db_events = Event.where(title: name)
diff --git a/test/integration/events/recurrence_update_test.rb b/test/integration/events/recurrence_update_test.rb
index 81f2f2611..75d5fddd0 100644
--- a/test/integration/events/recurrence_update_test.rb
+++ b/test/integration/events/recurrence_update_test.rb
@@ -18,7 +18,7 @@ class Events::RecurrenceUpdateTest < ActionDispatch::IntegrationTest
event: {
title: name,
event_image_attributes: {
- attachment: fixture_file_upload('/files/event/Party.jpg')
+ attachment: fixture_file_upload('event/Party.jpg')
},
description: 'Come party tonight at the fablab...',
start_date: 2.weeks.from_now,
@@ -36,7 +36,7 @@ class Events::RecurrenceUpdateTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_equal 201, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check the events were correctly created
db_events = Event.where(title: name)
@@ -46,7 +46,7 @@ class Events::RecurrenceUpdateTest < ActionDispatch::IntegrationTest
event = db_events.first
new_title = 'Skateboard party'
new_descr = 'Come make a skateboard tonight at the Fablab'
- new_image = '/files/event/Skateboard.jpg'
+ new_image = 'event/Skateboard.jpg'
put "/api/events/#{event&.id}", params: {
event: {
title: new_title,
@@ -69,7 +69,7 @@ class Events::RecurrenceUpdateTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_response :success, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check the events were correctly updated
res = json_response(response.body)
@@ -85,7 +85,7 @@ class Events::RecurrenceUpdateTest < ActionDispatch::IntegrationTest
assert_includes db_event.event_theme_ids, 1
assert_equal 1, db_event.age_range_id
assert FileUtils.compare_file(
- File.join(ActionDispatch::IntegrationTest.fixture_path, new_image),
+ File.join(ActionDispatch::IntegrationTest.fixture_path, "files/#{new_image}"),
db_event.event_image.attachment.file.path
)
end
@@ -114,7 +114,7 @@ class Events::RecurrenceUpdateTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_response :success, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check the events were correctly updated
res = json_response(response.body)
@@ -126,7 +126,7 @@ class Events::RecurrenceUpdateTest < ActionDispatch::IntegrationTest
db_event = Event.find(res_event[:event][:id])
assert_equal 2, db_event.category_id
assert FileUtils.compare_file(
- File.join(ActionDispatch::IntegrationTest.fixture_path, new_image),
+ File.join(ActionDispatch::IntegrationTest.fixture_path, "files/#{new_image}"),
db_event.event_image.attachment.file.path
)
end
diff --git a/test/integration/events/timezone_test.rb b/test/integration/events/timezone_test.rb
index b7b5700ea..2c2489e41 100644
--- a/test/integration/events/timezone_test.rb
+++ b/test/integration/events/timezone_test.rb
@@ -31,7 +31,7 @@ class Events::TimezoneTest < ActionDispatch::IntegrationTest
analytical_section: ''
},
event_image_attributes: {
- attachment: fixture_file_upload('/files/event/Skateboard.jpg')
+ attachment: fixture_file_upload('event/Skateboard.jpg')
}
}
}.to_json,
@@ -39,7 +39,7 @@ class Events::TimezoneTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_equal 201, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check the event was created correctly
event = json_response(response.body)
diff --git a/test/integration/exports/accounting_export_test.rb b/test/integration/exports/accounting_export_test.rb
index 3056c753c..22f4ee40c 100644
--- a/test/integration/exports/accounting_export_test.rb
+++ b/test/integration/exports/accounting_export_test.rb
@@ -32,7 +32,7 @@ class Exports::AccountingExportTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_equal 200, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check the export was created correctly
res = json_response(response.body)
diff --git a/test/integration/exports/availabilites_export_test.rb b/test/integration/exports/availabilites_export_test.rb
index d254509eb..46ca89f05 100644
--- a/test/integration/exports/availabilites_export_test.rb
+++ b/test/integration/exports/availabilites_export_test.rb
@@ -17,7 +17,7 @@ class Exports::AvailabilitiesExportTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_equal 200, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check the export was created correctly
res = json_response(response.body)
@@ -57,4 +57,4 @@ class Exports::AvailabilitiesExportTest < ActionDispatch::IntegrationTest
require 'fileutils'
FileUtils.rm(e.file)
end
-end
\ No newline at end of file
+end
diff --git a/test/integration/exports/members_export_test.rb b/test/integration/exports/members_export_test.rb
index a2a8f44bd..c15d2117a 100644
--- a/test/integration/exports/members_export_test.rb
+++ b/test/integration/exports/members_export_test.rb
@@ -17,7 +17,7 @@ class Exports::MembersExportTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_equal 200, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check the export was created correctly
res = json_response(response.body)
diff --git a/test/integration/exports/reservations_export_test.rb b/test/integration/exports/reservations_export_test.rb
index 942b966b9..f36499ee0 100644
--- a/test/integration/exports/reservations_export_test.rb
+++ b/test/integration/exports/reservations_export_test.rb
@@ -17,7 +17,7 @@ class Exports::ReservationsExportTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_equal 200, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check the export was created correctly
res = json_response(response.body)
@@ -49,4 +49,4 @@ class Exports::ReservationsExportTest < ActionDispatch::IntegrationTest
require 'fileutils'
FileUtils.rm(e.file)
end
-end
\ No newline at end of file
+end
diff --git a/test/integration/exports/statistics_export_test.rb b/test/integration/exports/statistics_export_test.rb
index 00a5cd4cd..0169aec0c 100644
--- a/test/integration/exports/statistics_export_test.rb
+++ b/test/integration/exports/statistics_export_test.rb
@@ -17,18 +17,17 @@ class Exports::StatisticsExportTest < ActionDispatch::IntegrationTest
::Statistics::BuilderService.generate_statistic({ start_date: '2015-06-01'.to_date.beginning_of_day,
end_date: '2015-06-30'.to_date.end_of_day })
# Create a new export
- post '/stats/machine/export', {
- params: {
- type_key: 'booking',
- body: '{"query":{"bool":{"must":[{"term":{"type":"booking"}},{"range":{"date":{"gte":"2015-06-01T02:00:00+02:00",' \
- '"lte":"2015-06-30T23:59:59+02:00"}}}]}},"sort":[{"date":{"order":"desc"}}],"aggs":{"total_ca":{"sum":{"field":"ca"}}, ' \
- '"average_age":{"avg":{"field":"age"}},"total_stat":{"sum":{"field":"stat"}}}}'
- }
- }
+ post '/stats/machine/export',
+ params: {
+ type_key: 'booking',
+ body: '{"query":{"bool":{"must":[{"term":{"type":"booking"}},{"range":{"date":{"gte":"2015-06-01T02:00:00+02:00",' \
+ '"lte":"2015-06-30T23:59:59+02:00"}}}]}},"sort":[{"date":{"order":"desc"}}],"aggs":{"total_ca":{"sum":{"field":"ca"}}, ' \
+ '"average_age":{"avg":{"field":"age"}},"total_stat":{"sum":{"field":"stat"}}}}'
+ }
# Check response format & status
assert_equal 200, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check the export was created correctly
res = json_response(response.body)
@@ -76,16 +75,15 @@ class Exports::StatisticsExportTest < ActionDispatch::IntegrationTest
::Statistics::BuilderService.generate_statistic({ start_date: '2015-06-01'.to_date.beginning_of_day,
end_date: '2015-06-30'.to_date.end_of_day })
# Create a new export
- post '/stats/global/export', {
- params: {
- type_key: 'booking',
- body: '{"query":{"bool":{"must":[{"range":{"date":{"gte":"2015-06-01T02:00:00+02:00","lte":"2015-06-30T23:59:59+02:00"}}}]}}}'
- }
- }
+ post '/stats/global/export',
+ params: {
+ type_key: 'booking',
+ body: '{"query":{"bool":{"must":[{"range":{"date":{"gte":"2015-06-01T02:00:00+02:00","lte":"2015-06-30T23:59:59+02:00"}}}]}}}'
+ }
# Check response format & status
assert_equal 200, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check the export was created correctly
res = json_response(response.body)
diff --git a/test/integration/exports/subscriptions_export_test.rb b/test/integration/exports/subscriptions_export_test.rb
index 9129074b3..af9beedd2 100644
--- a/test/integration/exports/subscriptions_export_test.rb
+++ b/test/integration/exports/subscriptions_export_test.rb
@@ -17,7 +17,7 @@ class Exports::SubscriptionsExportTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_equal 200, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check the export was created correctly
res = json_response(response.body)
@@ -49,4 +49,4 @@ class Exports::SubscriptionsExportTest < ActionDispatch::IntegrationTest
require 'fileutils'
FileUtils.rm(e.file)
end
-end
\ No newline at end of file
+end
diff --git a/test/integration/groups_test.rb b/test/integration/groups_test.rb
index 77e85777c..ad7e1288b 100644
--- a/test/integration/groups_test.rb
+++ b/test/integration/groups_test.rb
@@ -18,7 +18,7 @@ class GroupsTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_equal 201, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check the correct group was created
res = json_response(response.body)
@@ -38,7 +38,7 @@ class GroupsTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_equal 200, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check the group was updated
res = json_response(response.body)
@@ -51,7 +51,7 @@ class GroupsTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_equal 200, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check the list items are ok
groups = json_response(response.body)
diff --git a/test/integration/invoices/as_admin_test.rb b/test/integration/invoices/as_admin_test.rb
index e07703c9d..8299834a8 100644
--- a/test/integration/invoices/as_admin_test.rb
+++ b/test/integration/invoices/as_admin_test.rb
@@ -22,7 +22,7 @@ class InvoicesTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_equal 200, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check that we have all invoices
invoices = json_response(response.body)
@@ -49,7 +49,7 @@ class InvoicesTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_equal 201, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check that the refund match
refund = json_response(response.body)
diff --git a/test/integration/invoices/round_test.rb b/test/integration/invoices/round_test.rb
index 6f3f6d166..f50b48205 100644
--- a/test/integration/invoices/round_test.rb
+++ b/test/integration/invoices/round_test.rb
@@ -45,7 +45,7 @@ class Invoices::RoundTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_equal 201, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# in the invoice, we should have:
# - machine reservation = 121 (97, coupon applied)
@@ -108,7 +108,7 @@ class Invoices::RoundTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_equal 201, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# in the invoice, we should have:
# - machine reservation = 1423 (1138, coupon applied)
@@ -171,7 +171,7 @@ class Invoices::RoundTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_equal 201, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# in the invoice, we should have:
# - machine reservation = 121 (99, coupon applied)
@@ -234,7 +234,7 @@ class Invoices::RoundTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_equal 201, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# in the invoice, we should have:
# - machine reservation = 1423 (1277, coupon applied)
diff --git a/test/integration/invoices/vat_test.rb b/test/integration/invoices/vat_test.rb
index a9d8a64fc..9e388551a 100644
--- a/test/integration/invoices/vat_test.rb
+++ b/test/integration/invoices/vat_test.rb
@@ -32,14 +32,14 @@ class Invoices::VATTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_equal 201, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
invoice = Invoice.last
assert_invoice_pdf invoice do |lines|
vat_line = I18n.t('invoices.including_VAT_RATE',
- RATE: Setting.get('invoice_VAT-rate'),
- AMOUNT: number_to_currency(invoice.total / 100.00),
- NAME: 'TVQ+TPS')
+ **{ RATE: Setting.get('invoice_VAT-rate'),
+ AMOUNT: number_to_currency(invoice.total / 100.00),
+ NAME: 'TVQ+TPS' })
assert(lines.any? { |l| /#{Regexp.escape(vat_line)}/.match(l) })
end
end
diff --git a/test/integration/machine_categories_test.rb b/test/integration/machine_categories_test.rb
index 4ad8fdc33..f44c55ead 100644
--- a/test/integration/machine_categories_test.rb
+++ b/test/integration/machine_categories_test.rb
@@ -21,7 +21,7 @@ class MachineCategoriesTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_equal 201, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check the machine category was correctly created
category = MachineCategory.where(name: name).first
@@ -45,7 +45,7 @@ class MachineCategoriesTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_equal 200, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check the machine category was correctly updated
category = MachineCategory.find(1)
diff --git a/test/integration/machines_test.rb b/test/integration/machines_test.rb
index 1c9f73b32..b2c448f99 100644
--- a/test/integration/machines_test.rb
+++ b/test/integration/machines_test.rb
@@ -15,13 +15,13 @@ class MachinesTest < ActionDispatch::IntegrationTest
machine: {
name: name,
machine_image_attributes: {
- attachment: fixture_file_upload('/files/machines/Laser_cutting_machine.jpg')
+ attachment: fixture_file_upload('machines/Laser_cutting_machine.jpg')
},
description: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore...',
spec: 'Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium...',
machine_files_attributes: [
- { attachment: fixture_file_upload('/files/document.pdf', 'application/pdf', true) },
- { attachment: fixture_file_upload('/files/document2.pdf', 'application/pdf', true) }
+ { attachment: fixture_file_upload('document.pdf', 'application/pdf', true) },
+ { attachment: fixture_file_upload('document2.pdf', 'application/pdf', true) }
],
disabled: false,
machine_category_id: 1
@@ -31,7 +31,7 @@ class MachinesTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_equal 201, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check the machine was correctly created
db_machine = Machine.where(name: name).first
@@ -59,7 +59,7 @@ class MachinesTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_equal 200, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check the machine was correctly updated
db_machine = Machine.find(3)
diff --git a/test/integration/members/as_admin_test.rb b/test/integration/members/as_admin_test.rb
index 8a2d08a7e..ddebb1b77 100644
--- a/test/integration/members/as_admin_test.rb
+++ b/test/integration/members/as_admin_test.rb
@@ -39,7 +39,7 @@ class MembersTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_equal 201, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check that the user's match
user = json_response(response.body)
@@ -57,7 +57,7 @@ class MembersTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_equal 422, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check error message
res = json_response(response.body)
@@ -80,7 +80,7 @@ class MembersTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_equal 200, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check update result
res = json_response(response.body)
@@ -93,7 +93,7 @@ class MembersTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_equal 200, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check search result
res = json_response(response.body)
@@ -114,7 +114,7 @@ class MembersTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_equal 200, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check search result
res = json_response(response.body)
diff --git a/test/integration/members/import_test.rb b/test/integration/members/import_test.rb
index a5ec2677c..520197ad1 100644
--- a/test/integration/members/import_test.rb
+++ b/test/integration/members/import_test.rb
@@ -11,7 +11,7 @@ class ImportTest < ActionDispatch::IntegrationTest
end
test 'bulk import members through CSV' do
- bulk_csv = fixture_file_upload('files/members.csv', 'text/csv')
+ bulk_csv = fixture_file_upload('members.csv', 'text/csv')
post '/api/imports/members',
params: {
import_members: bulk_csv,
@@ -19,7 +19,7 @@ class ImportTest < ActionDispatch::IntegrationTest
}, headers: default_headers
assert_equal 201, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check that the returned import was created
import = json_response(response.body)
diff --git a/test/integration/notifications/notification_preferences_test.rb b/test/integration/notifications/notification_preferences_test.rb
index 0909cbe63..c4ec4ad97 100644
--- a/test/integration/notifications/notification_preferences_test.rb
+++ b/test/integration/notifications/notification_preferences_test.rb
@@ -13,7 +13,7 @@ class NotificationPreferencesTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_equal 200, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check the list items are ok and don't include other users' notification preferences
notification_preferences = json_response(response.body)
@@ -36,7 +36,7 @@ class NotificationPreferencesTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_equal 200, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check the status was updated
res = json_response(response.body)
diff --git a/test/integration/notifications/notification_types_test.rb b/test/integration/notifications/notification_types_test.rb
index 81f5fdc90..df993771b 100644
--- a/test/integration/notifications/notification_types_test.rb
+++ b/test/integration/notifications/notification_types_test.rb
@@ -13,7 +13,7 @@ class NotificationTypesTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_equal 200, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check the list items are ok
notification_types = json_response(response.body)
@@ -26,7 +26,7 @@ class NotificationTypesTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_equal 200, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check the list items are ok
notification_types = json_response(response.body)
diff --git a/test/integration/notifications/notifications_test.rb b/test/integration/notifications/notifications_test.rb
index cbdef9571..69b6ce9d2 100644
--- a/test/integration/notifications/notifications_test.rb
+++ b/test/integration/notifications/notifications_test.rb
@@ -11,7 +11,7 @@ class NotificationsTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_equal 200, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check the list items are ok
# ! Only works if notifications fixtures for this user are < NOTIFICATIONS_PER_PAGE (See NotificationsController#index)
@@ -29,7 +29,7 @@ class NotificationsTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_equal 200, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check the list items are ok
notifications_total = json_response(response.body)[:totals][:total]
@@ -51,7 +51,7 @@ class NotificationsTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_equal 200, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check the list items are ok
# Beware that the order of last unread notifications is descending,
@@ -76,7 +76,7 @@ class NotificationsTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_equal 200, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check the list items are ok
updated_notification = json_response(response.body)
diff --git a/test/integration/open_api/accounting_test.rb b/test/integration/open_api/accounting_test.rb
index 9feca27af..8647d38f3 100644
--- a/test/integration/open_api/accounting_test.rb
+++ b/test/integration/open_api/accounting_test.rb
@@ -12,7 +12,7 @@ class OpenApi::AccountingTest < ActionDispatch::IntegrationTest
test 'list all accounting lines' do
get '/open_api/v1/accounting', headers: open_api_headers(@token)
assert_response :success
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
lines = json_response(response.body)
assert_not_empty lines[:lines]
@@ -40,7 +40,7 @@ class OpenApi::AccountingTest < ActionDispatch::IntegrationTest
test 'list all accounting lines with pagination' do
get '/open_api/v1/accounting?page=1&per_page=5', headers: open_api_headers(@token)
assert_response :success
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
lines = json_response(response.body)
assert_equal 5, lines[:lines].count
@@ -49,7 +49,7 @@ class OpenApi::AccountingTest < ActionDispatch::IntegrationTest
test 'list all accounting lines with dates filtering' do
get '/open_api/v1/accounting?after=2022-09-01T00:00:00+02:00&before=2022-09-30T23:59:59+02:00', headers: open_api_headers(@token)
assert_response :success
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
lines = json_response(response.body)
assert lines[:lines].count.positive?
@@ -62,7 +62,7 @@ class OpenApi::AccountingTest < ActionDispatch::IntegrationTest
test 'list all accounting lines with invoices filtering' do
get '/open_api/v1/accounting?invoice_id=[1,2,3]', headers: open_api_headers(@token)
assert_response :success
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
lines = json_response(response.body)
assert lines[:lines].count.positive?
@@ -72,7 +72,7 @@ class OpenApi::AccountingTest < ActionDispatch::IntegrationTest
test 'list all accounting lines with type filtering' do
get '/open_api/v1/accounting?type=[payment,vat]', headers: open_api_headers(@token)
assert_response :success
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
lines = json_response(response.body)
assert lines[:lines].count.positive?
@@ -82,7 +82,7 @@ class OpenApi::AccountingTest < ActionDispatch::IntegrationTest
test 'list all accounting payment lines should have payment details' do
get '/open_api/v1/accounting?type=payment', headers: open_api_headers(@token)
assert_response :success
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
card_code = Setting.get('accounting_payment_card_code')
wallet_code = Setting.get('accounting_payment_wallet_code')
diff --git a/test/integration/open_api/invoices_test.rb b/test/integration/open_api/invoices_test.rb
index eb19a02e6..1158d20cd 100644
--- a/test/integration/open_api/invoices_test.rb
+++ b/test/integration/open_api/invoices_test.rb
@@ -12,7 +12,7 @@ class OpenApi::InvoicesTest < ActionDispatch::IntegrationTest
test 'list invoices' do
get '/open_api/v1/invoices', headers: open_api_headers(@token)
assert_response :success
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
assert_not_empty json_response(response.body)[:invoices]
end
diff --git a/test/integration/open_api/prices_test.rb b/test/integration/open_api/prices_test.rb
index efe43a3d5..116399e17 100644
--- a/test/integration/open_api/prices_test.rb
+++ b/test/integration/open_api/prices_test.rb
@@ -33,7 +33,7 @@ class OpenApi::PricesTest < ActionDispatch::IntegrationTest
test 'list all prices for some groups' do
get '/open_api/v1/prices?group_id=[1,2]', headers: open_api_headers(@token)
assert_response :success
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
prices = json_response(response.body)
assert_equal [1, 2], prices[:prices].pluck(:group_id).uniq.sort
diff --git a/test/integration/open_api/reservations_test.rb b/test/integration/open_api/reservations_test.rb
index 3f3b71b88..84d2a0759 100644
--- a/test/integration/open_api/reservations_test.rb
+++ b/test/integration/open_api/reservations_test.rb
@@ -12,7 +12,7 @@ class OpenApi::ReservationsTest < ActionDispatch::IntegrationTest
test 'list reservations ' do
get '/open_api/v1/reservations', headers: open_api_headers(@token)
assert_response :success
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
assert_not_empty json_response(response.body)[:reservations]
end
@@ -20,7 +20,7 @@ class OpenApi::ReservationsTest < ActionDispatch::IntegrationTest
test 'list all reservations with pagination' do
get '/open_api/v1/reservations?page=1&per_page=5', headers: open_api_headers(@token)
assert_response :success
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
reservations = json_response(response.body)
assert reservations[:reservations].count <= 5
@@ -29,7 +29,7 @@ class OpenApi::ReservationsTest < ActionDispatch::IntegrationTest
test 'list all reservations for a user' do
get '/open_api/v1/reservations?user_id=3', headers: open_api_headers(@token)
assert_response :success
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
reservations = json_response(response.body)
assert_not_empty reservations[:reservations]
@@ -39,7 +39,7 @@ class OpenApi::ReservationsTest < ActionDispatch::IntegrationTest
test 'list all reservations for a user with pagination' do
get '/open_api/v1/reservations?user_id=3&page=1&per_page=5', headers: open_api_headers(@token)
assert_response :success
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
reservations = json_response(response.body)
assert reservations[:reservations].count <= 5
@@ -49,7 +49,7 @@ class OpenApi::ReservationsTest < ActionDispatch::IntegrationTest
test 'list all reservations with dates filtering' do
get '/open_api/v1/reservations?after=2012-01-01T00:00:00+02:00&before=2012-12-31T23:59:59+02:00', headers: open_api_headers(@token)
assert_response :success
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
reservations = json_response(response.body)
assert reservations[:reservations].count.positive?
@@ -62,7 +62,7 @@ class OpenApi::ReservationsTest < ActionDispatch::IntegrationTest
test 'list all machine reservations for a user' do
get '/open_api/v1/reservations?reservable_type=Machine&user_id=3', headers: open_api_headers(@token)
assert_response :success
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
reservations = json_response(response.body)
assert_not_empty reservations[:reservations]
@@ -73,7 +73,7 @@ class OpenApi::ReservationsTest < ActionDispatch::IntegrationTest
test 'list all machine 2 reservations' do
get '/open_api/v1/reservations?reservable_type=Machine&reservable_id=2', headers: open_api_headers(@token)
assert_response :success
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
reservations = json_response(response.body)
assert_not_empty reservations[:reservations]
diff --git a/test/integration/open_api/subscriptions_test.rb b/test/integration/open_api/subscriptions_test.rb
index 2ea5e26bf..5273c1778 100644
--- a/test/integration/open_api/subscriptions_test.rb
+++ b/test/integration/open_api/subscriptions_test.rb
@@ -12,7 +12,7 @@ class OpenApi::SubscriptionsTest < ActionDispatch::IntegrationTest
test 'list subscriptions' do
get '/open_api/v1/subscriptions', headers: open_api_headers(@token)
assert_response :success
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
assert_not_empty json_response(response.body)[:subscriptions]
end
@@ -20,7 +20,7 @@ class OpenApi::SubscriptionsTest < ActionDispatch::IntegrationTest
test 'list subscriptions with pagination' do
get '/open_api/v1/subscriptions?page=1&per_page=5', headers: open_api_headers(@token)
assert_response :success
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
subscriptions = json_response(response.body)
assert subscriptions[:subscriptions].count <= 5
diff --git a/test/integration/open_api/users_test.rb b/test/integration/open_api/users_test.rb
index fde626a3c..03b10f7b5 100644
--- a/test/integration/open_api/users_test.rb
+++ b/test/integration/open_api/users_test.rb
@@ -12,7 +12,7 @@ class OpenApi::UsersTest < ActionDispatch::IntegrationTest
test 'list all users' do
get '/open_api/v1/users', headers: open_api_headers(@token)
assert_response :success
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
users = json_response(response.body)
assert_equal User.count, users[:users].length
@@ -32,7 +32,7 @@ class OpenApi::UsersTest < ActionDispatch::IntegrationTest
test 'list all users with pagination' do
get '/open_api/v1/users?page=1&per_page=5', headers: open_api_headers(@token)
assert_response :success
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
users = json_response(response.body)
assert_equal 5, users[:users].length
@@ -41,7 +41,7 @@ class OpenApi::UsersTest < ActionDispatch::IntegrationTest
test 'list all users filtering by IDs' do
get '/open_api/v1/users?user_id=[3,4,5]', headers: open_api_headers(@token)
assert_response :success
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
users = json_response(response.body)
assert users[:users].count.positive?
@@ -51,7 +51,7 @@ class OpenApi::UsersTest < ActionDispatch::IntegrationTest
test 'list all users filtering by IDs other syntax' do
get '/open_api/v1/users?user_id[]=3&user_id[]=4&user_id[]=5', headers: open_api_headers(@token)
assert_response :success
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
users = json_response(response.body)
assert users[:users].count.positive?
@@ -61,7 +61,7 @@ class OpenApi::UsersTest < ActionDispatch::IntegrationTest
test 'list a user filtering by ID' do
get '/open_api/v1/users?user_id=2', headers: open_api_headers(@token)
assert_response :success
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
users = json_response(response.body)
assert_equal 1, users[:users].count
@@ -71,7 +71,7 @@ class OpenApi::UsersTest < ActionDispatch::IntegrationTest
test 'list all users filtering by email' do
get '/open_api/v1/users?email=jean.dupond@gmail.com', headers: open_api_headers(@token)
assert_response :success
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
users = json_response(response.body)
assert_equal 1, users[:users].count
@@ -81,7 +81,7 @@ class OpenApi::UsersTest < ActionDispatch::IntegrationTest
test 'list all users created after date' do
get '/open_api/v1/users?created_after=2018-01-01T00:00:00+01:00', headers: open_api_headers(@token)
assert_response :success
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
users = json_response(response.body)
assert users[:users].count.positive?
diff --git a/test/integration/open_id_connect_test.rb b/test/integration/open_id_connect_test.rb
index ef408c587..f570c204f 100644
--- a/test/integration/open_id_connect_test.rb
+++ b/test/integration/open_id_connect_test.rb
@@ -9,7 +9,7 @@ class OpenIdConnectTest < ActionDispatch::IntegrationTest
setup do
@admin = User.find_by(username: 'admin')
login_as(@admin, scope: :user)
- Fablab::Application.load_tasks if Rake::Task.tasks.empty?
+ FabManager::Application.load_tasks if Rake::Task.tasks.empty?
end
test 'create and activate an OIDC provider' do
@@ -22,7 +22,7 @@ class OpenIdConnectTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_equal 201, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check the provider was correctly created
db_provider = OpenIdConnectProvider.includes(:auth_provider).where('auth_providers.name': name).first&.auth_provider
diff --git a/test/integration/order/create_cart_item_test.rb b/test/integration/order/create_cart_item_test.rb
index 11a712ee9..35fa923f9 100644
--- a/test/integration/order/create_cart_item_test.rb
+++ b/test/integration/order/create_cart_item_test.rb
@@ -20,7 +20,7 @@ class CreateCartItemTest < ActionDispatch::IntegrationTest
}
# general assertions
assert_equal 201, response.status
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check the cart item was created correctly
res = json_response(response.body)
@@ -46,7 +46,7 @@ class CreateCartItemTest < ActionDispatch::IntegrationTest
}
# general assertions
assert_equal 201, response.status
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check the cart item was created correctly
res = json_response(response.body)
@@ -70,7 +70,7 @@ class CreateCartItemTest < ActionDispatch::IntegrationTest
}
# general assertions
assert_equal 201, response.status
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check the cart item was created correctly
res = json_response(response.body)
@@ -94,7 +94,7 @@ class CreateCartItemTest < ActionDispatch::IntegrationTest
}
# general assertions
assert_equal 201, response.status
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check the cart item was created correctly
res = json_response(response.body)
@@ -119,7 +119,7 @@ class CreateCartItemTest < ActionDispatch::IntegrationTest
}
# general assertions
assert_equal 201, response.status
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check the cart item was created correctly
res = json_response(response.body)
@@ -138,7 +138,7 @@ class CreateCartItemTest < ActionDispatch::IntegrationTest
}
# general assertions
assert_equal 201, response.status
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check the cart item was created correctly
res = json_response(response.body)
@@ -156,7 +156,7 @@ class CreateCartItemTest < ActionDispatch::IntegrationTest
}
# general assertions
assert_equal 201, response.status
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check the cart item was created correctly
res = json_response(response.body)
diff --git a/test/integration/plans/create_plan_test.rb b/test/integration/plans/create_plan_test.rb
index 9070d7224..bb2eeb06f 100644
--- a/test/integration/plans/create_plan_test.rb
+++ b/test/integration/plans/create_plan_test.rb
@@ -27,7 +27,7 @@ class CreatePlanTest < ActionDispatch::IntegrationTest
description: 'lorem ipsum dolor sit amet',
partner_id: 6,
plan_file_attributes: {
- attachment: fixture_file_upload('/files/document.pdf')
+ attachment: fixture_file_upload('document.pdf')
}
}
}.to_json,
@@ -35,7 +35,7 @@ class CreatePlanTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_equal 201, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check the created plans
res = json_response(response.body)
@@ -68,7 +68,7 @@ class CreatePlanTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_equal 201, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check the created plan
res = json_response(response.body)
diff --git a/test/integration/prepaid_packs_test.rb b/test/integration/prepaid_packs_test.rb
index b161ab915..31e730890 100644
--- a/test/integration/prepaid_packs_test.rb
+++ b/test/integration/prepaid_packs_test.rb
@@ -25,7 +25,7 @@ class PrepaidPacksTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_equal 201, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check the correct prepaid pack was created
res = json_response(response.body)
@@ -52,7 +52,7 @@ class PrepaidPacksTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_equal 200, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check the prepaid pack was updated
res = json_response(response.body)
@@ -65,7 +65,7 @@ class PrepaidPacksTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_equal 200, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check the list items are ok
pack = json_response(response.body)
diff --git a/test/integration/prices/compute_test.rb b/test/integration/prices/compute_test.rb
index fb63358db..0b54e581e 100644
--- a/test/integration/prices/compute_test.rb
+++ b/test/integration/prices/compute_test.rb
@@ -2,94 +2,94 @@
require 'test_helper'
-module Prices
- class AsAdminTest < ActionDispatch::IntegrationTest
- setup do
- admin = User.with_role(:admin).first
- login_as(admin, scope: :user)
- end
+module Prices; end
- test 'compute price for a simple training' do
- user = User.find_by(username: 'jdupond')
- availability = Availability.find(2)
- slot = Availability.find(2).slots.first
- printer_training = availability.trainings.first
+class Prices::AsAdminTest < ActionDispatch::IntegrationTest
+ setup do
+ admin = User.with_role(:admin).first
+ login_as(admin, scope: :user)
+ end
- post '/api/prices/compute',
- params: {
- customer_id: user.id,
- items: [
- {
- reservation: {
- reservable_id: printer_training.id,
- reservable_type: printer_training.class.name,
- slots_reservations_attributes: [
- {
- slot_id: slot.id,
- offered: false
- }
- ]
- }
+ test 'compute price for a simple training' do
+ user = User.find_by(username: 'jdupond')
+ availability = Availability.find(2)
+ slot = Availability.find(2).slots.first
+ printer_training = availability.trainings.first
+
+ post '/api/prices/compute',
+ params: {
+ customer_id: user.id,
+ items: [
+ {
+ reservation: {
+ reservable_id: printer_training.id,
+ reservable_type: printer_training.class.name,
+ slots_reservations_attributes: [
+ {
+ slot_id: slot.id,
+ offered: false
+ }
+ ]
}
- ]
- }.to_json,
- headers: default_headers
+ }
+ ]
+ }.to_json,
+ headers: default_headers
- # Check response format & status
- assert_equal 200, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ # Check response format & status
+ assert_equal 200, response.status, response.body
+ assert_match Mime[:json].to_s, response.content_type
- # Check the price was computed correctly
- price = json_response(response.body)
- assert_equal (printer_training.trainings_pricings.where(group_id: user.group_id).first.amount / 100.0),
- price[:price],
- 'Computed price did not match training price'
- end
+ # Check the price was computed correctly
+ price = json_response(response.body)
+ assert_equal (printer_training.trainings_pricings.where(group_id: user.group_id).first.amount / 100.0),
+ price[:price],
+ 'Computed price did not match training price'
+ end
- test 'compute price for a machine reservation with an offered slot and a subscription' do
- user = User.find_by(username: 'jdupond')
- availability = Availability.find(3)
- laser = availability.machines.where(id: 1).first
- plan = Plan.find_by(group_id: user.group_id, interval: 'month')
+ test 'compute price for a machine reservation with an offered slot and a subscription' do
+ user = User.find_by(username: 'jdupond')
+ availability = Availability.find(3)
+ laser = availability.machines.where(id: 1).first
+ plan = Plan.find_by(group_id: user.group_id, interval: 'month')
- post '/api/prices/compute',
- params: {
- customer_id: user.id,
- items: [
- {
- reservation: {
- reservable_id: laser.id,
- reservable_type: laser.class.name,
- slots_reservations_attributes: [
- {
- slot_id: availability.slots.first.id,
- offered: true
- },
- {
- slot_id: availability.slots.last.id,
- offered: false
- }
- ]
- }
- },
- {
- subscription: {
- plan_id: plan.id
- }
+ post '/api/prices/compute',
+ params: {
+ customer_id: user.id,
+ items: [
+ {
+ reservation: {
+ reservable_id: laser.id,
+ reservable_type: laser.class.name,
+ slots_reservations_attributes: [
+ {
+ slot_id: availability.slots.first.id,
+ offered: true
+ },
+ {
+ slot_id: availability.slots.last.id,
+ offered: false
+ }
+ ]
}
- ]
- }.to_json,
- headers: default_headers
+ },
+ {
+ subscription: {
+ plan_id: plan.id
+ }
+ }
+ ]
+ }.to_json,
+ headers: default_headers
- # Check response format & status
- assert_equal 200, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ # Check response format & status
+ assert_equal 200, response.status, response.body
+ assert_match Mime[:json].to_s, response.content_type
- # Check the event was created correctly
- price = json_response(response.body)
- assert_equal ((laser.prices.where(group_id: user.group_id, plan_id: plan.id).first.amount + plan.amount) / 100.0),
- price[:price],
- 'Computed price did not match machine + subscription price'
- end
+ # Check the event was created correctly
+ price = json_response(response.body)
+ assert_equal ((laser.prices.where(group_id: user.group_id, plan_id: plan.id).first.amount + plan.amount) / 100.0),
+ price[:price],
+ 'Computed price did not match machine + subscription price'
end
end
diff --git a/test/integration/products_test.rb b/test/integration/products_test.rb
index 96a827523..174df95d8 100644
--- a/test/integration/products_test.rb
+++ b/test/integration/products_test.rb
@@ -26,12 +26,12 @@ class ProductsTest < ActionDispatch::IntegrationTest
low_stock_threshold: 100,
machine_ids: [4, 6],
product_files_attributes: [
- { attachment: fixture_file_upload('/files/document.pdf', 'application/pdf', true) },
- { attachment: fixture_file_upload('/files/document2.pdf', 'application/pdf', true) }
+ { attachment: fixture_file_upload('document.pdf', 'application/pdf', true) },
+ { attachment: fixture_file_upload('document2.pdf', 'application/pdf', true) }
],
product_images_attributes: [
- { attachment: fixture_file_upload('/files/products/pla-filament.jpg', 'image/jpg'), is_main: true },
- { attachment: fixture_file_upload('/files/products/pla-filament2.jpg', 'image/jpg'), is_main: false }
+ { attachment: fixture_file_upload('products/pla-filament.jpg', 'image/jpg'), is_main: true },
+ { attachment: fixture_file_upload('products/pla-filament2.jpg', 'image/jpg'), is_main: false }
],
advanced_accounting_attributes: {
code: '704611',
@@ -47,7 +47,7 @@ class ProductsTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_equal 201, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check the poduct was correctly created
db_product = Product.where(name: name).first
@@ -90,7 +90,7 @@ class ProductsTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_equal 200, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check the product was correctly updated
db_product.reload
@@ -121,7 +121,7 @@ class ProductsTest < ActionDispatch::IntegrationTest
}.to_json,
headers: default_headers
assert_response :success
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check the new product
product = Product.last
diff --git a/test/integration/reservations/last_minute_test.rb b/test/integration/reservations/last_minute_test.rb
index 88b366f75..b91c87e8f 100644
--- a/test/integration/reservations/last_minute_test.rb
+++ b/test/integration/reservations/last_minute_test.rb
@@ -40,7 +40,7 @@ class Reservations::LastMinuteTest < ActionDispatch::IntegrationTest
# general assertions
assert_equal 422, response.status
- assert_match(I18n.t('cart_item_validation.deadline', { MINUTES: 120 }), response.body)
+ assert_match(I18n.t('cart_item_validation.deadline', **{ MINUTES: 120 }), response.body)
end
test 'user can reserve last minute booking' do
diff --git a/test/integration/reservations/local_payment_test.rb b/test/integration/reservations/local_payment_test.rb
index 44b017821..810a1375e 100644
--- a/test/integration/reservations/local_payment_test.rb
+++ b/test/integration/reservations/local_payment_test.rb
@@ -247,7 +247,7 @@ class Reservations::LocalPaymentTest < ActionDispatch::IntegrationTest
# general assertions
assert_equal 201, response.status
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
result = json_response(response.body)
# Check the DB objects have been created as they should
diff --git a/test/integration/reservations/pay_with_wallet_test.rb b/test/integration/reservations/pay_with_wallet_test.rb
index 9c531017d..f2856290d 100644
--- a/test/integration/reservations/pay_with_wallet_test.rb
+++ b/test/integration/reservations/pay_with_wallet_test.rb
@@ -223,7 +223,7 @@ class Reservations::PayWithWalletTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_equal 201, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check the response
res = json_response(response.body)
diff --git a/test/integration/reservations/payment_schedule_test.rb b/test/integration/reservations/payment_schedule_test.rb
index df7147d6a..392515824 100644
--- a/test/integration/reservations/payment_schedule_test.rb
+++ b/test/integration/reservations/payment_schedule_test.rb
@@ -56,7 +56,7 @@ class Reservations::PaymentScheduleTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_equal 201, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
assert_equal reservations_count + 1, Reservation.count, 'missing the reservation'
assert_equal invoice_count, Invoice.count, "an invoice was generated but it shouldn't"
assert_equal invoice_items_count, InvoiceItem.count, "some invoice items were generated but they shouldn't"
diff --git a/test/integration/reservations/reserve_machine_test.rb b/test/integration/reservations/reserve_machine_test.rb
index ba4df59b1..8a49f70bd 100644
--- a/test/integration/reservations/reserve_machine_test.rb
+++ b/test/integration/reservations/reserve_machine_test.rb
@@ -124,7 +124,7 @@ class Reservations::ReserveMachineTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_equal 200, response.status, "API does not return the expected status. #{response.body}"
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check the error was handled
assert_match(/Your card was declined/, response.body)
diff --git a/test/integration/reservations/reserve_training_test.rb b/test/integration/reservations/reserve_training_test.rb
index 1cefca105..4fea80f0f 100644
--- a/test/integration/reservations/reserve_training_test.rb
+++ b/test/integration/reservations/reserve_training_test.rb
@@ -178,7 +178,7 @@ class Reservations::ReserveTrainingTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_equal 201, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check the response
sub = json_response(response.body)
@@ -187,7 +187,7 @@ class Reservations::ReserveTrainingTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_equal 201, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
assert_equal reservations_count + 1, Reservation.count, 'missing the reservation'
assert_equal invoice_count, Invoice.count, "an invoice was generated but it shouldn't"
assert_equal invoice_items_count, InvoiceItem.count, "some invoice items were generated but they shouldn't"
diff --git a/test/integration/reservations/space_seats_test.rb b/test/integration/reservations/space_seats_test.rb
index 5370e4b9a..664fd8155 100644
--- a/test/integration/reservations/space_seats_test.rb
+++ b/test/integration/reservations/space_seats_test.rb
@@ -38,7 +38,7 @@ class Reservations::SpaceSeatsTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_equal 201, response.status
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check the availability
res = json_response(response.body)
diff --git a/test/integration/settings_test.rb b/test/integration/settings_test.rb
index 03decf6fa..5396d9c8d 100644
--- a/test/integration/settings_test.rb
+++ b/test/integration/settings_test.rb
@@ -1,5 +1,7 @@
# frozen_string_literal: true
+require 'test_helper'
+
class SettingsTest < ActionDispatch::IntegrationTest
# Called before every test method runs. Can be used
# to set up fixture information.
@@ -16,7 +18,7 @@ class SettingsTest < ActionDispatch::IntegrationTest
}
}
assert_equal 200, response.status
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
resp = json_response(response.body)
assert_equal 'fablab_name', resp[:setting][:name]
assert_equal 'Test Fablab', resp[:setting][:value]
@@ -37,14 +39,14 @@ class SettingsTest < ActionDispatch::IntegrationTest
}
}
assert_equal 422, response.status
- assert_match /Name is not included in the list/, response.body
+ assert_match(/Name is not included in the list/, response.body)
end
test 'show setting' do
get '/api/settings/fablab_name'
assert_equal 200, response.status
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
resp = json_response(response.body)
assert_equal 'fablab_name', resp[:setting][:name], 'wrong parameter name'
assert_equal 'Fab Lab de La Casemate', resp[:setting][:value], 'wrong parameter value'
diff --git a/test/integration/slots_reservations_test.rb b/test/integration/slots_reservations_test.rb
index c538345e1..8ed33ebc9 100644
--- a/test/integration/slots_reservations_test.rb
+++ b/test/integration/slots_reservations_test.rb
@@ -14,7 +14,7 @@ class SlotsReservationsTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_equal 200, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check the reservation was correctly canceled
slots_reservation = SlotsReservation.find(1)
@@ -77,7 +77,7 @@ class SlotsReservationsTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_equal 200, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check the reservation was correctly moved
slots_reservation.reload
diff --git a/test/integration/spaces_test.rb b/test/integration/spaces_test.rb
index 11143f6f1..d29ff1eeb 100644
--- a/test/integration/spaces_test.rb
+++ b/test/integration/spaces_test.rb
@@ -15,14 +15,14 @@ class SpacesTest < ActionDispatch::IntegrationTest
space: {
name: name,
space_image_attributes: {
- attachment: fixture_file_upload('/files/spaces/Biology_laboratory.jpg')
+ attachment: fixture_file_upload('spaces/Biology_laboratory.jpg')
},
description: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras ante mi, porta ac dictum quis, feugiat...',
characteristics: 'Sed fermentum ante ut elit lobortis, id auctor libero cursus. Sed augue lectus, mollis at luctus eu...',
default_places: 6,
space_files_attributes: [
- { attachment: fixture_file_upload('/files/document.pdf', 'application/pdf', true) },
- { attachment: fixture_file_upload('/files/document2.pdf', 'application/pdf', true) }
+ { attachment: fixture_file_upload('document.pdf', 'application/pdf', true) },
+ { attachment: fixture_file_upload('document2.pdf', 'application/pdf', true) }
],
disabled: false
}
@@ -31,7 +31,7 @@ class SpacesTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_equal 201, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check the space was correctly created
db_space = Space.where(name: name).first
@@ -59,7 +59,7 @@ class SpacesTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_equal 200, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check the space was correctly updated
db_space = Space.find(1)
diff --git a/test/integration/statuses_test.rb b/test/integration/statuses_test.rb
index 0910a5f12..f05b11943 100644
--- a/test/integration/statuses_test.rb
+++ b/test/integration/statuses_test.rb
@@ -17,7 +17,7 @@ class StatusesTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_equal 201, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check the correct status was created
res = json_response(response.body)
@@ -36,7 +36,7 @@ class StatusesTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_equal 200, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check the status was updated
res = json_response(response.body)
@@ -49,7 +49,7 @@ class StatusesTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_equal 200, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check the list items are ok
statuses = json_response(response.body)
diff --git a/test/integration/subscriptions/cancel_test.rb b/test/integration/subscriptions/cancel_test.rb
index 46f657699..6abdcd1c0 100644
--- a/test/integration/subscriptions/cancel_test.rb
+++ b/test/integration/subscriptions/cancel_test.rb
@@ -17,7 +17,7 @@ class Subscriptions::CancelTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_response :success
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check the subscription was canceled
subscription.reload
@@ -55,7 +55,7 @@ class Subscriptions::CancelTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_response :success
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check the subscription was canceled
subscription.reload
diff --git a/test/integration/subscriptions/create_as_admin_test.rb b/test/integration/subscriptions/create_as_admin_test.rb
index 76a1ec91e..0f39fc4fa 100644
--- a/test/integration/subscriptions/create_as_admin_test.rb
+++ b/test/integration/subscriptions/create_as_admin_test.rb
@@ -30,7 +30,7 @@ class Subscriptions::CreateAsAdminTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_equal 201, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check the correct plan was subscribed
result = json_response(response.body)
@@ -97,7 +97,7 @@ class Subscriptions::CreateAsAdminTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_equal 201, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check the response
res = json_response(response.body)
diff --git a/test/integration/subscriptions/create_as_user_test.rb b/test/integration/subscriptions/create_as_user_test.rb
index 2ea35a3da..1d3c63644 100644
--- a/test/integration/subscriptions/create_as_user_test.rb
+++ b/test/integration/subscriptions/create_as_user_test.rb
@@ -31,7 +31,7 @@ class Subscriptions::CreateAsUserTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_equal 201, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check the correct plan was subscribed
result = json_response(response.body)
@@ -99,7 +99,7 @@ class Subscriptions::CreateAsUserTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_equal 422, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check the error was handled
assert_match(/plan is reserved for members of group/, response.body)
@@ -133,7 +133,7 @@ class Subscriptions::CreateAsUserTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_equal 201, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check the correct plan was subscribed
result = json_response(response.body)
@@ -215,7 +215,7 @@ class Subscriptions::CreateAsUserTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_equal 200, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check the response
res = json_response(response.body)
@@ -244,7 +244,7 @@ class Subscriptions::CreateAsUserTest < ActionDispatch::IntegrationTest
# Check generalities
assert_equal 200, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
res = json_response(response.body)
assert res[:requires_action]
diff --git a/test/integration/subscriptions/create_with_payment_schedule_test.rb b/test/integration/subscriptions/create_with_payment_schedule_test.rb
index 59b551297..a8b177aae 100644
--- a/test/integration/subscriptions/create_with_payment_schedule_test.rb
+++ b/test/integration/subscriptions/create_with_payment_schedule_test.rb
@@ -34,7 +34,7 @@ class Subscriptions::CreateWithPaymentScheduleTest < ActionDispatch::Integration
# Check response format & status
assert_equal 201, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check the response
sub = json_response(response.body)
diff --git a/test/integration/subscriptions/free_extension_test.rb b/test/integration/subscriptions/free_extension_test.rb
index 33b9c34ec..cc04f5bb9 100644
--- a/test/integration/subscriptions/free_extension_test.rb
+++ b/test/integration/subscriptions/free_extension_test.rb
@@ -32,7 +32,7 @@ class Subscriptions::FreeExtensionTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_equal 201, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check that the subscribed plan was not altered
res = json_response(response.body)
@@ -77,7 +77,7 @@ class Subscriptions::FreeExtensionTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_equal 422, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check that the subscribed plan was not altered
res = json_response(response.body)
diff --git a/test/integration/subscriptions/renew_as_admin_test.rb b/test/integration/subscriptions/renew_as_admin_test.rb
index 80db5fca9..39fe7c659 100644
--- a/test/integration/subscriptions/renew_as_admin_test.rb
+++ b/test/integration/subscriptions/renew_as_admin_test.rb
@@ -30,7 +30,7 @@ class Subscriptions::RenewAsAdminTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_equal 201, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check the correct plan was subscribed
result = json_response(response.body)
@@ -103,7 +103,7 @@ class Subscriptions::RenewAsAdminTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_equal 201, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
res_subscription = json_response(response.body)
assert_equal 'Subscription', res_subscription[:main_object][:type]
diff --git a/test/integration/subscriptions/renew_as_user_test.rb b/test/integration/subscriptions/renew_as_user_test.rb
index 005e5fe64..22d645ff1 100644
--- a/test/integration/subscriptions/renew_as_user_test.rb
+++ b/test/integration/subscriptions/renew_as_user_test.rb
@@ -31,7 +31,7 @@ class Subscriptions::RenewAsUserTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_equal 201, response.status, "API does not return the expected status. #{response.body}"
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check the correct plan was subscribed
result = json_response(response.body)
@@ -103,7 +103,7 @@ class Subscriptions::RenewAsUserTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_equal 200, response.status, "API does not return the expected status. #{response.body}"
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check the error was handled
assert_match(/Your card was declined/, response.body)
diff --git a/test/integration/tags_test.rb b/test/integration/tags_test.rb
index 39abed9f6..fa76e96dd 100644
--- a/test/integration/tags_test.rb
+++ b/test/integration/tags_test.rb
@@ -17,7 +17,7 @@ class TagsTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_equal 201, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check the correct tag was created
res = json_response(response.body)
@@ -36,7 +36,7 @@ class TagsTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_equal 200, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check the tag was updated
res = json_response(response.body)
@@ -49,7 +49,7 @@ class TagsTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_equal 200, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check the list items are ok
tags = json_response(response.body)
diff --git a/test/integration/themes_test.rb b/test/integration/themes_test.rb
index 94226b6e4..f479edd51 100644
--- a/test/integration/themes_test.rb
+++ b/test/integration/themes_test.rb
@@ -17,7 +17,7 @@ class ThemesTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_equal 201, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check the correct tag was created
res = json_response(response.body)
@@ -36,7 +36,7 @@ class ThemesTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_equal 200, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check the tag was updated
res = json_response(response.body)
@@ -49,7 +49,7 @@ class ThemesTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_equal 200, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check the list items are ok
themes = json_response(response.body)
diff --git a/test/integration/trainings/availabilities_test.rb b/test/integration/trainings/availabilities_test.rb
index 6e0c31450..ce3d39311 100644
--- a/test/integration/trainings/availabilities_test.rb
+++ b/test/integration/trainings/availabilities_test.rb
@@ -16,7 +16,7 @@ class Trainings::AvailabilitiesTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_equal 200, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check the correct training was returned
result = json_response(response.body)
diff --git a/test/integration/trainings_test.rb b/test/integration/trainings_test.rb
index 0b627649c..3171aa077 100644
--- a/test/integration/trainings_test.rb
+++ b/test/integration/trainings_test.rb
@@ -15,7 +15,7 @@ class TrainingsTest < ActionDispatch::IntegrationTest
training: {
name: name,
training_image_attributes: {
- attachment: fixture_file_upload('/files/trainings/first-aid.jpg')
+ attachment: fixture_file_upload('trainings/first-aid.jpg')
},
description: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore...',
machine_ids: [],
@@ -32,7 +32,7 @@ class TrainingsTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_equal 201, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check the training was correctly created
db_training = Training.where(name: name).first
@@ -61,7 +61,7 @@ class TrainingsTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_equal 200, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Check the training was correctly updated
db_training = Training.find(3)
diff --git a/test/integration/wallets_test.rb b/test/integration/wallets_test.rb
index 1e050cf08..037147ce0 100644
--- a/test/integration/wallets_test.rb
+++ b/test/integration/wallets_test.rb
@@ -20,7 +20,7 @@ class WalletsTest < ActionDispatch::IntegrationTest
test 'get my wallet' do
get "/api/wallet/by_user/#{@vlonchamp.id}"
assert_equal 200, response.status
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
wallet = json_response(response.body)
assert_equal @vlonchamp.wallet.invoicing_profile_id, wallet[:invoicing_profile_id]
assert_equal @vlonchamp.wallet.amount, wallet[:amount]
@@ -32,7 +32,7 @@ class WalletsTest < ActionDispatch::IntegrationTest
@user1 = User.first
get "/api/wallet/by_user/#{@user1.id}"
assert_equal 200, response.status
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
wallet = json_response(response.body)
assert_equal @user1.wallet.invoicing_profile_id, wallet[:invoicing_profile_id]
assert_equal @user1.wallet.amount, wallet[:amount]
@@ -48,7 +48,7 @@ class WalletsTest < ActionDispatch::IntegrationTest
w = @vlonchamp.wallet
get "/api/wallet/#{w.id}/transactions"
assert_equal 200, response.status
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
transactions = json_response(response.body)
assert_equal w.wallet_transactions.count, transactions.size
assert_equal wallet_transactions(:transaction1).id, transactions.first[:id]
@@ -70,7 +70,7 @@ class WalletsTest < ActionDispatch::IntegrationTest
params: { amount: amount }
assert_equal 200, response.status
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
wallet = json_response(response.body)
w.reload
assert_equal w.amount, expected_amount
@@ -96,7 +96,7 @@ class WalletsTest < ActionDispatch::IntegrationTest
}
assert_equal 200, response.status
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
wallet = json_response(response.body)
w.reload
assert_equal w.amount, expected_amount
diff --git a/test/models/space_test.rb b/test/models/space_test.rb
index 54806fa80..008de7e84 100644
--- a/test/models/space_test.rb
+++ b/test/models/space_test.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require 'test_helper'
class SpaceTest < ActiveSupport::TestCase
@@ -17,7 +19,7 @@ class SpaceTest < ActiveSupport::TestCase
test 'update a space' do
new_name = 'Bio-tech lab'
space = Space.create!(bio_lab)
- space.update_attributes(name: new_name)
+ space.update(name: new_name)
subtype = StatisticSubType.find_by(key: space.slug)
assert_equal new_name, subtype.label
end
diff --git a/test/services/accounting_service_test.rb b/test/services/accounting_service_test.rb
index d0c42333b..00dbfb983 100644
--- a/test/services/accounting_service_test.rb
+++ b/test/services/accounting_service_test.rb
@@ -52,7 +52,7 @@ class AccountingServiceTest < ActionDispatch::IntegrationTest
# Check response format & status
assert_equal 201, response.status, response.body
- assert_equal Mime[:json], response.content_type
+ assert_match Mime[:json].to_s, response.content_type
# Build the accounting lines
invoice_id = Invoice.last.id
diff --git a/test/services/availabilities/visibility_service_test.rb b/test/services/availabilities/visibility_service_test.rb
index b461ed38f..17a9c52f8 100644
--- a/test/services/availabilities/visibility_service_test.rb
+++ b/test/services/availabilities/visibility_service_test.rb
@@ -42,15 +42,15 @@ class Availabilities::VisibilityServiceTest < ActiveSupport::TestCase
starting = Time.current.beginning_of_day
ending = 1.month.from_now.end_of_day
window = Availabilities::VisibilityService.new.visibility(@no_subscription, 'space', starting, ending)
- assert_datetimes_equal Time.current, window[0]
- assert_datetimes_equal 1.month.from_now, window[1]
+ assert_datetimes_near Time.current, window[0]
+ assert_datetimes_near 1.month.from_now, window[1]
end
test 'member visibility for the previous month' do
starting = 1.month.ago.end_of_day
ending = Time.current.beginning_of_day
window = Availabilities::VisibilityService.new.visibility(@no_subscription, 'space', starting, ending)
- assert_datetimes_equal Time.current, window[0]
+ assert_datetimes_near Time.current, window[0]
assert_equal ending, window[1]
end
@@ -58,23 +58,23 @@ class Availabilities::VisibilityServiceTest < ActiveSupport::TestCase
starting = Time.current.beginning_of_day
ending = 1.year.from_now.end_of_day
window = Availabilities::VisibilityService.new.visibility(@no_subscription, 'space', starting, ending)
- assert_datetimes_equal Time.current, window[0]
- assert_datetimes_equal 1.month.from_now, window[1]
+ assert_datetimes_near Time.current, window[0]
+ assert_datetimes_near 1.month.from_now, window[1]
end
test 'subscriber visibility for the coming month' do
starting = Time.current.beginning_of_day
ending = 1.month.from_now.end_of_day
window = Availabilities::VisibilityService.new.visibility(@with_subscription, 'space', starting, ending)
- assert_datetimes_equal Time.current, window[0]
- assert_datetimes_equal 1.month.from_now, window[1]
+ assert_datetimes_near Time.current, window[0]
+ assert_datetimes_near 1.month.from_now, window[1]
end
test 'subscriber visibility for the previous month' do
starting = 1.month.ago.end_of_day
ending = Time.current.beginning_of_day
window = Availabilities::VisibilityService.new.visibility(@with_subscription, 'space', starting, ending)
- assert_datetimes_equal Time.current, window[0]
+ assert_datetimes_near Time.current, window[0]
assert_equal ending, window[1]
end
@@ -82,15 +82,15 @@ class Availabilities::VisibilityServiceTest < ActiveSupport::TestCase
starting = Time.current.beginning_of_day
ending = 1.year.from_now.end_of_day
window = Availabilities::VisibilityService.new.visibility(@with_subscription, 'space', starting, ending)
- assert_datetimes_equal Time.current, window[0]
- assert_datetimes_equal 1.month.from_now, window[1]
+ assert_datetimes_near Time.current, window[0]
+ assert_datetimes_near 1.month.from_now, window[1]
end
test '1 year subscriber visibility for the coming month' do
starting = Time.current.beginning_of_day
ending = 1.month.from_now.end_of_day
window = Availabilities::VisibilityService.new.visibility(@with_1y_subscription, 'space', starting, ending)
- assert_datetimes_equal Time.current, window[0]
+ assert_datetimes_near Time.current, window[0]
assert_equal ending, window[1]
end
@@ -98,7 +98,7 @@ class Availabilities::VisibilityServiceTest < ActiveSupport::TestCase
starting = 1.month.ago.end_of_day
ending = Time.current.beginning_of_day
window = Availabilities::VisibilityService.new.visibility(@with_1y_subscription, 'space', starting, ending)
- assert_datetimes_equal Time.current, window[0]
+ assert_datetimes_near Time.current, window[0]
assert_equal ending, window[1]
end
@@ -106,16 +106,16 @@ class Availabilities::VisibilityServiceTest < ActiveSupport::TestCase
starting = Time.current.beginning_of_day
ending = 1.year.from_now.end_of_day
window = Availabilities::VisibilityService.new.visibility(@with_1y_subscription, 'space', starting, ending)
- assert_datetimes_equal Time.current, window[0]
- assert_datetimes_equal 3.months.from_now, window[1]
+ assert_datetimes_near Time.current, window[0]
+ assert_datetimes_near 3.months.from_now, window[1]
end
test '1 year subscriber visibility for trainings in the coming year' do
starting = Time.current.beginning_of_day
ending = 1.year.from_now.end_of_day
window = Availabilities::VisibilityService.new.visibility(@with_1y_subscription, 'training', starting, ending)
- assert_datetimes_equal Time.current, window[0]
- assert_datetimes_equal 1.month.from_now, window[1]
+ assert_datetimes_near Time.current, window[0]
+ assert_datetimes_near 1.month.from_now, window[1]
end
test 'subscriber with plan custom visibility' do
@@ -124,7 +124,7 @@ class Availabilities::VisibilityServiceTest < ActiveSupport::TestCase
starting = Time.current.beginning_of_day
ending = 1.month.from_now.end_of_day
window = Availabilities::VisibilityService.new.visibility(@with_subscription, 'machines', starting, ending)
- assert_datetimes_equal Time.current, window[0]
- assert_datetimes_equal 48.hours.from_now, window[1]
+ assert_datetimes_near Time.current, window[0]
+ assert_datetimes_near 48.hours.from_now, window[1]
end
end
diff --git a/test/test_helper.rb b/test/test_helper.rb
index ec78bdec9..98497d57a 100644
--- a/test/test_helper.rb
+++ b/test/test_helper.rb
@@ -114,9 +114,9 @@ class ActiveSupport::TestCase
assert_equal expected.to_date, actual.to_date, msg
end
- def assert_datetimes_equal(expected, actual, msg = nil)
+ def assert_datetimes_near(expected, actual, msg = nil)
assert_not_nil actual, msg
- assert_equal expected.iso8601, actual.iso8601, msg
+ assert_in_delta expected.to_i, actual.to_i, 1, msg
end
end